Startup From Command Line - Sample Script: LogStartupScript.pts

<< 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


Receive channel 2


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 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"


' Keep communication & logging alive until user stops


   DL.Pause 1 ' (the pause reduces CPU load while idle)



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.