file$synchronously. The string
file$can also contain arguments that shall be passed to the program. If you need to execute a program asynchronously, you have to use the Run() function.
If supported by the operating system, this command can also be used to view data files like documents or images using their default viewer.
file$ has to be either a data file like a JPEG image
or a package name like
com.airsoftsoftwair.hollywood if you
want this function to start another app.
Due to historical reasons this command expects program and arguments
in just a single string. This means that you need to be very careful
when passing program paths that contain spaces since the very first
file$ is interpreted as the separator of program and
arguments. If you want to start a program whose path specification
uses spaces, you need to use double quotes around this path
specification or it won't work. See below for an example.
The optional argument
resetkeys is only interesting for advanced
users. If this is set to
Execute() won't reset all internal
key states after executing the program. By default, all key states
will be reset when
Execute() returns because programs started using
Execute() often assume the keyboard focus and Hollywood might be
unable to reset its internal state flags because the new program
Execute() takes over keyboard focus. That's why by
Execute() will reset all internal key state flags when it
returns. Disabling this behaviour can make sense if you use
to start programs that don't have a GUI and don't take away the
Execute("Sys:Prefs/Locale")On AmigaOS systems the above code executes the locale preferences. Your script's execution will be halted until the user closes the locale preferences (synchronous execution).
Execute("Echo >Ram:Test \"Hello World\"")On AmigaOS systems the above code writes "Hello World" to "Ram:Test".
Execute("\"C:\\Program Files (x86)\\Hollywood\\ide.exe\"")The code above runs the Hollywood IDE on Windows systems. Note that we've embedded the program specification inside double quotes. This is absolutely necessary because the first space in the string passed to
Execute()is normally interpreted as the separator between program and arguments. If we didn't use double quotes in the code above,
Execute()would try to start the program "C:\Program" and pass the arguments "Files (x86)\Hollywood\ide.exe" to it which we obviously don't want.