UploadFile

<< Click to Display Table of Contents >>

Navigation:  Reference (Scripting) > Docklight Script Commands - The DL Object > Methods (Advanced) >

UploadFile

Opens an existing file and sends out its contents. Starts the communication, if not already running (see StartCommunication).

 

Return Value

 

Void

 

Syntax

 

DL.UploadFile filePathName [, representation]

 

The UploadFile method syntax has these parts:

 

Part

Description

filePathName

Required. String containing the file path (directory and file name) of the file to send. If no directory is specified, Docklight uses the current working directory. If filePathName is an empty string, a file dialog will be displayed to choose a file.

representation

Optional. String value to define the format of the filePathName file.  

"A" = ASCII (default):

filePathName is a text file that is sent out directly, no further parsing.

"H" = HEX:

filePathName contains HEX sequence data, e.g. 5F 54 65 73 74 ...

"D" = Decimal:

filePathName contains Decimal sequence data, e.g. 095 084 101 115 ...

"B" = Binary:

filePathName contains Binary sequence data, e.g. 01011111 01010100 ...

"R" = Raw Data:

filePathName is a binary file that needs that is sent out unmodified.

 

Remarks

 

File upload is only possible in Communication Mode Send/Receive.

 

If filePathName does not exist, Docklight reports an error and the script execution is stopped.

 

The "A" ASCII default representation allows sending text files without further modification. For raw binary data files that need to be sent unmodified, use the "R" (Raw Data) option. It is not to be confused with the "B" (Binary) representation used by Docklight to display data with 0's and 1's only.

 

You can use the UploadFile method to transfer the contents of a Docklight Log file. Please make sure that your log file is in plain text mode (see Log File Settings), and the file contains the raw data only, with no additional comments and no date/time stamps (see Options).

 

The UploadFile method does not support specific compiler output file formats, such as "Intel HEX File". If you have any specific requirements, please contact our e-mail support.

 

NOTE: The data is sent in blocks of max. 512 bytes. If you send a Send Sequence manually during a file upload, the sequence will be sent between one of these blocks and will corrupt the data transmission.

 

Example

 

' Example Upload File

 

' Send a text file

DL.UploadFile "helloworld.txt", "A"

 

' Send raw binary data file directly

DL.UploadFile "test.dat", "R"

 

' Parse and send a HEX data file

DL.UploadFile "hexfile.txt", "H"