Util Functions
There are some built in utility functions availble in Grid Studio.
Directories and Files
sp.util.createDirectory("DirectoryPath")
create a directory by the defined path
sp.util.createDirectory("D:/Test/Folder")
sp.util.directoryExists("DirectoryPath")
return 1 if directory exist or 0 if not
sp.util.directoryExists("D:/Test/Folder")
sp.util.fileExists("FilePath")
return 1 if file exist or 0 if not
sp.util.fileExists("C:/Program Files/Stage Precision/Stage Precision.exe")
sp.util.readFile("FileName")
return the content of a *.txt file
sp.util.readFile("C:/Log.txt")
sp.util.readDirectory("DirectoryPath")
returns all files within the given path as array
sp.util.readDirectory("C:/")
sp.util.renameFile("FilePath", "newName")
rename the defined file
sp.util.renameFile("D:/Test.txt", "NewText.txt")
sp.util.writeFile("Path/File", "content")
write a file on the given path with the given content
sp.util.writeFile("D:/Test/Test.txt", "Some content for this file")
Start/Kill Applications and Files
sp.util.killApp("AppName")
close the defined application
sp.util.killApp("mspaint.exe")
sp.util.launchFile("Path/FileName")
open the defined file/application
sp.util.launchFile("C:/Users/Test/Pictures/Image.png")
System Functions
sp.util.copyToClipboard("value")
copy the defined value into the clipboard
sp.util.copyToClipboard("Hello World")
sp.util.getFromClipboard()
return the content of the clipboard
sp.util.getAppVersion()
return the Stage Precision version number
sp.util.getIPs()
return an array with all avaiable IP addresses
sp.util.getOSInfos()
return a dict with information about the OS
sp.util.getOSInfos()['name']
get the OS Name
sp.util.getOSInfos()['type']
get the OS type
sp.util.getOSInfos()['computerName']
get the system computer name
sp.util.getOSInfos().['language']
get the os language
sp.util.getOSInfos().['username']
get the system user name
sp.util.getTime()
returned the number of seconds since the last system boot
sp.util.getTimestamp()
returned the number of seconds since January 1, 1970 (midnight UTC/GMT)
Last updated