<< Click to Display Table of Contents >> Navigation: Examples and Tutorials (Scripting) > 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.
Communication Mode |
Monitoring (receive only) |
Receive channel 1 |
COM1 |
Receive channel 2 |
COM3 |
COM Port Settings |
9600 Baud, No parity, 8 Data Bits, 1 Stop Bit |
Getting started
•Start the batch file LogStartup.bat from a command line or go to the \ScriptSamples directory and run LogStartup.bat by double-clicking the file.
..\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.