|
Startup From Command Line - Sample Script: LogStartupScript.pts |
|
|
The Docklight script LogStartupScript.pts, the related project file LogStartupSettings.ptp, and the batch file LogStartup.bat demonstrate how to start Docklight from the command line, create a log file according to predefined settings and start communications automatically.
The project file uses the communication settings listed below.
Getting started
Docklight Scripting is started, an ASCII log file C:\DocklightScripting_Logfile_asc.txt is created and communication is started immediately.
Use Shift+F6 to stop the script's execution and close the communication ports and log file.
NOTE: This sample requires a software license for the Docklight standard version, since it makes use of the Docklight Logging function. A Docklight Scripting license is not required when running the sample.
Further Information
The batch file, LogStartup.bat, contains the following line:
..\Docklight_Scripting.exe -r LogStartupScript.pts
This will start Docklight Scripting, open the script file LogStartupScript.pts and run it immediately (-r option). The script LogStartupScript.pts contains the following commands:
' LogStartupScript.pts ' Start up logging and communication DL.OpenProject "LogStartupSettings" ' Create (or append to) a ASCII log file DL.StartLogging "C:\DocklightScripting_Logfile", True, "A" DL.StartCommunication ' Keep communication & logging alive until user stops Do DL.Pause 1 ' (the pause reduces CPU load while idle) Loop
The communication settings used in LogStartupSettings.ptp are just an example. If you require different settings, you need to open the project file, modify the project settings and save the changes. It is recommended that all related files (LogStartupScript.pts, LogStartupSettings.ptp and LogStartup.bat) be copied to a different location before making any changes. You need to provide the complete actual path to the Docklight_Scripting.exe application within the .bat file in this case. |