Skip to content

Application Command Line Switches

PHP GUI applications support some command line arguments: if you want to call your application from another one and display a specific page for instance, or just run it using the Start|Run option of Windows.

About command line switches

The following command line switches are supported: page and ignoreuserpos. However, you can add your own switches too, thanks to HEScript: see below.

Warning

This topic is not for console applications. Use common PHP's argc and argv for them.

Command line usage is especially useful with the "Only one instance of the application" option (available in Security -> Global Protection). For example, if you launch your application again with different command line arguments, the second and subsequent invocation of the EXE doesn't start a new instance. Instead, it uses the one that's already running and only changes the page displayed in it according to the command line.

For instance: if you create an HTML exe application myapp.exe, you can get myapp.exe to start with a certain page by using myapp.exe page page2.php. If you then call myapp.exe page page3.php the first instance of the app will show the page named page3.php.

page

Syntax:

PUBFILE.EXE page [page to display]

Use this switch to specify the virtual path to the HTML or PHP page that should be displayed by the application.

Examples:

MYPUBFILE.EXE page comments.htm

PUBFILE.EXE page "my path page1.htm"

When you have spaces, be sure to enclose the path in quotes ("").

ignoreuserpos

Syntax:

PUBFILE.EXE ignoreuserpos

While it's helpful to allow the end user to set the size and move the window around, sometimes users will move to a 2nd monitor, then run without it or forget to turn it on, and they will "lose" it. This command line option will open the application screen-centered.

add your own switches

If you work with HEScript, it is possible to read the parameters passed to the application .exe file when the latter is run.

You can do this using the ParamStr internal function.