Run(file$[, resetkeys, userdata])
file$asynchronously. The string
file$can also contain arguments that shall be passed to the program. If you need to execute a program synchronously, you have to use the Execute() 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.
If you want to be informed when the program started using
terminated, you can install a listener for the
event handler using InstallEventHandler().
See InstallEventHandler for details.
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
Run() won't reset all internal
key states after executing the program. By default, all key states
will be reset when
Run() returns because programs started using
Run() often assume the keyboard focus and Hollywood might be
unable to reset its internal state flags because the new program
Run() takes over keyboard focus. That's why by
Run() 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
Starting with Hollywood 6.1 there is a new optional
This argument can be used to specify user data that should be passed
RunFinished event handler that can be installed via
InstallEventHandler(). See InstallEventHandler for details.
The user data can be of any type.
RunFinishedevent handler; this can be of any type (V6.1)
Run("Sys:Prefs/Locale")The above code executes the locale preferences on AmigaOS based systems. Your script's execution will go on immediately after executing the locale program (asynchronous execution).
Run("\"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
Run()is normally interpreted as the separator between program and arguments. If we didn't use double quotes in the code above,
Run()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.