pmStartup - the script commands
===============================
Build 40, September 2026

pmStartup is a small program launcher and updater for a Project Magenta
computer. On start it reads pmStartup.txt from its own folder and works
through it line by line. Put pmStartup.exe (with pm.dll beside it) in the
folder you start the sim programs from - usually the WideClient folder - and
place a shortcut to it in the Windows Startup folder, with "Start in" set to
that folder, so it finds its script after a reboot.

Everything it does is written to pmStartup.log in the same folder.
Esc stops the script at any time.

Lines starting with // are comments. Commands are one per line, keywords are
not case sensitive, and anything after the command on the same line is its
argument.


COPYING FILES FROM A MAIN COMPUTER
----------------------------------

source <folder>
    The folder to copy from, for example \\main\c\updates\ or D:\pmupdates\.
    pmStartup checks that it can write there. If that folder holds a newer
    pmStartup.exe than the one running, pmStartup replaces itself with it.
    "source dir <name>" means the folder <name> under pmStartup's own folder.

dest <folder>
    The folder to copy into. Every copy command that follows uses the last
    dest given, so: dest once, then several copy lines.
    "dest dir <name>" works like source dir.

copy <file>
copy <wildcard>
copy all
    Copies one file, or every file matching a pattern such as *.exe or
    pmsys*.txt, or everything (copy all is the same as copy *.*).
    A file that already exists in dest is only replaced when its date differs
    from the source copy; a file with the same date is reported as current and
    left alone. A file that does not exist in dest is skipped, unless its name
    contains ".update". Both source and dest must have been set first.

overwrite on
overwrite off
    With overwrite on, copy replaces files even when the dates match.
    Default is off.

slow
    Adds short pauses between the steps, for slow networks.


STARTING AND STOPPING PROGRAMS
------------------------------

run <program> [arguments]
    Starts a program, minimised. Give the full path if it is not in
    pmStartup's own folder; the .exe extension may be left out. The program
    is started from its own folder. A program that is not found is skipped and
    logged.

runready <program> [arguments]
    Like run, but waits until the flight simulator is reachable through
    FSUIPC / WideClient before starting the program. While waiting, any key
    press continues without the sim.

runreadyex <program> [arguments]
    The same as runready, but the program window opens normally instead of
    minimised.

kill <name.exe>
    Ends a running program by its exe name (taskkill /f /t).

closeall
exitpm
closepm
    Tells every running Project Magenta program to close, by way of the
    Project Magenta control offset (542E = 12345). All three words do the same.


TIMING
------

wait <seconds>
sleep <seconds>
    Pauses for the given number of seconds. The two words are the same.

end
exit
    Stops working through the script at that point.


WIDECLIENT
----------

If WideClient is running when pmStartup starts, it is stopped first so that
wideclient.exe can be replaced as well, and it is started again when the
script has finished - unless the script itself started it with a run or
runready line, or the word ignorewideclient appears anywhere in the script.


RUNNING ONE COMMAND WITHOUT A SCRIPT
------------------------------------

pmStartup.exe can be started with a single command on its command line, for
example

    pmStartup.exe closeall

which is carried out instead of reading pmStartup.txt.


A SHORT EXAMPLE
---------------

// update from the main computer, then start the cockpit
wait 5
source \\main\c\updates\
dest c:\wideFS\
overwrite on
copy wideclient.exe
overwrite off
dest c:\pmSystems\
copy pmsystems.exe
copy pmsys320.txt
run c:\wideFS\wideclient.exe
sleep 2
runready c:\pmSystems\pmsystems.exe
runready c:\abgc\abgc.exe
end
