
Model 2450 Interactive SourceMeter® Instrument Reference Manual
Section 8: TSP command reference
2450-901-01 Rev. B/September 2013
8-61
file.usbdriveexists()
This function detects if a USB flash drive is inserted into the front panel USB connector.
Type
TSP-Link accessible
Affected by
Where saved
Default value
Function
No
Usage
driveInserted
= file.usbdriveexists()
driveInserted
0
if no flash drive is detected
1
if a flash drive is detected
Details
You can call this command from a script to verify that a USB flash drive is inserted before attempting to write
data to it.
Example
print(file.usbdriveexists())
If the USB drive is not inserted in the USB
connector on the front panel, this returns
0
.
Also see
None
file.write()
This function writes data to a file.
Type
TSP-Link accessible
Affected by
Where saved
Default value
Function
No
Usage
file.write(
fileNumber
,
string
)
fileNumber
The file number from file open command of the file to which to write
string
The data to write to the file
Example
file_num = file.open("testfile.txt",
file.MODE_WRITE)
if file_num != nil then
file.write(file_num,"This is my test file")
file.close(file_num)
end
Opens file
testfile.txt
for
writing. If no errors were found
while opening, writes
"This is
my test file"
and closes the
file.
Also see
None