Name
GetCommandLine -- get the arguments from the command line (V3.0)
Synopsis
t, n, console = GetCommandLine()
Function
This function allows you to obtain the arguments that your script has been started with. This makes it possible for your script to take arguments from the user and then react on it accordingly. All arguments that are not recognized by Hollywood will be forwarded to your script. Please note that arguments must be prefixed by a dash character (-). A parameter may also follow after each argument.

GetCommandLine() returns three values: The second return value is a number which simply specifies how many arguments have been passed to your script from the command line. The first return value is a table which contains all arguments and their parameters. The table is an array of "n"-tables with the items arg and param. arg will be initialized to the argument excluding the dash character. param will receive the parameter for that argument if there is one, else it will be receive an empty string (""). The third return value is new in Hollywood 4.7 and indicates whether or not Hollywood was started from a console. In that case, the third return value will be True, else it will be False.

Under AmigaOS this function will also take the tooltypes of the script's or applet's icon into account if the program was started from Workbench.

Under macOS this function will look into the CFBundleExecutableArgs dictionary entry in the application bundle's Info.plist if the program was started from Finder.

Inputs
none

Results
t
table containing all arguments and their parameters
n
number of arguments that have been passed to the program
console
True if program was started from a console, otherwise False (V4.7)
Example
args, count = GetCommandLine()
NPrint("Number of arguments:", count)
For Local k = 0 to count - 1
   NPrint("Arg #", k, ":", args[k].arg, "Param:", args[k].param)
Next
The code above gets all arguments from the command line and prints them to the screen.

Show TOC