The ScriptQ object is available to all scripts running in ScriptQ. This object is global and does not need to be instantiated. Here is a VBScript example of writing a message to a log file:
Function Add(sScript As String, [bAsync As Boolean = True], [sLanguage As String = "VBScript"], [sDescription As String], [lPriority As Long = 2], [sGroupID As String], [lRetryDelay As Long = 60], [lTimeout As Long = 5000], [lRetryCount As Long], [sID As String], [vArguments As Variant], [sServer As String], [lPort As Long]) As Boolean
Add job.
Sub AppendBinaryToFile(vData As Variant, sPath As String)
Append data to the end of a file.
Sub AppendTextToFile(sText As String, sPath As String)
Append text to the end of a file.
Function CombinePath(sPath1 As String, sPath2 As String) As String
Combines two path strings.
Property CommandPort As Long
(read-only)
Command port number.
Property ComputerName As String
(read-only)
Computer name.
Function ConvertDateToISO8601(dtDate As Date) As String
Convert Date object to an ISO8601 formatted string.
Function ConvertISO8601ToDate(sISO8601 As String) As Date
Convert ISO8601 formatted string to a Date object.
Sub CopyFile(sSource As String, sDestination As String, [bOverWriteFiles As Boolean = True])
Copy a file.
Sub CopyFolder(sSource As String, sDestination As String, [bOverWriteFiles As Boolean = True])
Copy a folder.
Sub CreateFolder(sPath As String)
Create a folder.
Function CreateGUID() As String
Create a new Globally Unique Identifier.
Property CurrentDirectory As String
Get or set current working directory for all jobs.
Function Delete(sID As String, [sServer As String], [lPort As Long]) As Boolean
Delete a queued job.
Sub DeleteFile(sPath As String)
Delete a file.
Sub DeleteFolder(sPath As String)
Delete a folder and its contents.
Function Echo(sMessage As String, [sServer As String], [lPort As Long]) As Boolean
Write to log file.
Property ElapsedTime As Double
(read-only)
Script execution time in seconds.
Function FileExists(sPath As String) As Boolean
Check if a file exists.
Function Files(sPath As String, [bFullPath As Boolean = False]) As Variant
Get a list of files.
Function FolderExists(sPath As String) As Boolean
Check if a folder exists.
Function GetBaseName(sPath As String) As String
Return base name from a path.
Function GetCheckSumFromFile(sPathName As String) As String
Return checksum of a file.
Function GetCheckSumFromString(sString As String) As String
Return checksum of a string.
Function GetExecutingJobs([sServer As String], [lPort As Long]) As String
Return jobs currently being executed in XML format. For example:
<executing-jobs>
<job>
<thread>1</thread>
<id>6C77BBDF-4DE3-4A68-AFD5-1D4D5371B475</id>
<description>Convert files to PDF</description>
<attempt>1</attempt>
</job>
<job>
<thread>2</thread>
<id>599D37AF-F999-4444-9A7A-A9E27EBC86F9</id>
<description>Copy files to production server</description>
<attempt>1</attempt>
</job>
</executing-jobs>
Function GetExtensionName(sPath As String) As String
Return extension from path.
Function GetFileName(sPath As String) As String
Return file name from a path.
Function GetQueuedJobs([sServer As String], [lPort As Long]) As String
Return jobs pending execution in XML format. For example:
<queued-jobs>
<job>
<id>062ED97F-C108-4A53-969E-EA34C52AC4E7</id>
<description>Aggregate data and print report</description>
<attempts>0</attempts>
</job>
<job>
<id>1DA62F06-BBA3-4716-9A4A-68AB84D9488D</id>
<description>Export nightly receipts</description>
<attempts>0</attempts>
</job>
</queued-jobs>
Function GetTempName() As String
Return a random name.
Function Instantiate(sTemplate As String, [sID As String], [vArguments As Variant], [sServer As String], [lPort As Long]) As Boolean
Create job from a template.
Function IsExecuting(sID As String, [sServer As String], [lPort As Long]) As Boolean
Check if a job is executing.
Function IsQueued(ByVal sID As String, [sServer As String], [lPort As Long]) As Boolean
Check if a job is queued.
Property IPAddress As String
(read-only)
An IP address on which is ScriptQ is listening for remote commands.
Function JobArguments() As Variant
An array of arguments for this job.
Property JobAsync As Boolean
(read-only)
Determine if this job is executing asynchronously.
Property JobDescription As String
(read-only)
Description for this job.
Property JobExecutionAttempt As Long
(read-only)
Number of times the execution of this job has been attemped.
Property JobGroupID As String
(read-only)
Grouping ID for this job.
Property JobID As String
(read-only)
ID for this job.
Property JobLanguage As String
(read-only)
Script language for this job.
Property JobPriority As Long
(read-only)
Priority for this job.
Property JobRetryCount As Long
(read-only)
Number of attempts to retry executing this job if job fails.
Property JobRetryDelay As Long
(read-only)
Seconds before a retry is attemped if job fails.
Property JobsAwaitingPickup As Long
(read-only)
Number of jobs awaiting pick-up.
Property JobScript As String
(read-only)
Script for this job.
Property JobsQueued As Long
(read-only)
Number of jobs pending execution.
Property JobTimeout As Long
Milliseconds before this job times out. A running job can change its own timeout. For example:
ScriptQ.JobTimeout = ScriptQ.JobTimeout + 10000
Property LogFile As String
(read-only)
Path to log file.
Property MonitorPort As Long
(read-only)
Port number for administration.
Sub MoveFile(sSource As String, sDestination As String)
Move a file.
Sub MoveFolder(sSource As String, sDestination As String)
Move a folder.
Property Path As String
(read-only)
Path to ScriptQ instance.
Property ProcessOwner As String
(read-only)
Security context of the Windows process.
Sub Quit()
Forces script execution to stop at any time.
Function ReadBinaryFromFile(sPath As String) As Variant
Read binary data from a file.
Function ReadTextFromFile(sPath As String) As String
Read text from file.
Sub RenameFile(sPath As String, sNewName As String)
Rename a file.
Sub RenameFolder(sPath As String, sNewName As String)
Rename a folder.
Sub Run(sCommand As String, [bWaitOnReturn As Boolean = False])
Runs a program.
Sub SharedAdd(vKey As Variant, vItem As Variant)
Add a new key and item to shared memory.
Property SharedCount As Long
(read-only)
Get the number of items in shared memory.
Function SharedExists(vKey As Variant) As Boolean
Determine if a given key is in shared memory.
Function SharedIsLocked() As Boolean
Determine if shared memory is blocked for the current thread.
Property SharedItem (vKey As Variant)
Set or get the item for a given key.
Function SharedItems() As Variant
Get an array containing all items in shared memory.
Function SharedKeys() As Variant
Get an array containing all keys in shared memory.
Sub SharedLock()
Block requests from other threads to add, modify or remove items in shared memory.
Sub SharedRemove(vKey As Variant)
Remove a given key from the shared memory.
Sub SharedRemoveAll()
Remove all information from shared memory.
Sub SharedUnlock()
Release the block to shared memory.
Sub Sleep(lMilliseconds As Long)
Suspends script execution for a specified length of time, then continues execution.
Function SubFolders(sPath As String, [bFullPath As Boolean = False]) As Variant
Get a list of sub-folders.
Property TemplatePath As String
(read-only)
Path to template folder.
Function Upload(sPath As String, [sID As String], [sServer As String], [lPort As Long]) As Boolean
Upload file/folder.
Property UploadPath As String
(read-only)
Path to upload folder.
Property Version As String
(read-only)
Product version.
Sub WriteBinaryToFile(vData As Variant, sPath As String)
Create a new file or replace the contents of an existing file.
Sub WriteTextToFile(sText As String, sPath As String, [bUnicode As Boolean = False])
Create a new file or replace the contents of an existing file.