Built-in functions
The following functions can be used with Variables and IF statements.
- GetSelectedFolder
Returns the name of the selected folder.
Example:
$selected = GetSelectedFolder
MessageBox "The selected folder {$selected} will now be checked..."
CheckFolder "{$selected}"
- GetUpdatedBookmarkCount
Returns the number of updated bookmarks. - GetLastCheckUpdatedBookmarkCount
Returns the number of updated bookmarks from the last check run. - GetFolderBookmarkCount(...)
Returns the number of bookmarks in the specified folder. Folder and subfolders must be separated with a backslash, for example GetFolderBookmarkCount("Software\WSW"). - GetFolderUpdatedBookmarkCount(...)
Returns the number of updated bookmarks in the specified folder. Folder and subfolders must be separated with a backslash, for example GetFolderUpdatedBookmarkCount("Software\WSW"). - GetUniqueID
Returns a unique string ID, for example 20041212120023123. This value can be used if unique file names are required, for example to generate a report in a new, unique file. - GetDateTime(...)
Returns the current date and time. As a parameter, you can define the date format.
Format:
yy - current year with 2 digits
yyyy - current year with 4 digits
m - current month with 1 or 2 digits, no leading zero (1-12)
mm - current month with 2 digits, with leading zero (01-12)
mmm - name of the current month, 3 characters (jan, feb...)
mmmm - full name of the current month
d - current day with 1 or 2 digits, no leading zero (1-31)
dd - current day with 2 digits, with leading zero (01-31)
ddd - name of the current day with 3 characters
dddd - full name of the current day
hh - hours
nn - minutes
ss - seconds
Example:
$date1 = GetDateTime("yyyy-mm-dd")
$format = "dd-mm-yyyy"
$date2 = GetDateTime($format)
- Now
Returns the current date as a string. The format is yyyymmddhhnnss. - MinutesAgo(...)
Returns an integer that specifies the number of minutes between the specified parameter and the current date. The parameter must have the format "yyyymmddhhnnss". The result is always a positive value.
Example:
$time = "20231224234500"
$diff = MinutesAgo($time)
$time = Now
$diff = MinutesAgo($time)
- HoursAgo(...)
Returns an integer that specifies the number of hours between the specified parameter and the current date. The parameter must have the format "yyyymmddhhnnss". The result is always a positive value.
Example:
$time = "20231224234500"
$diff = HoursAgo($time)
$time = Now
$diff = HoursAgo($time)
- GetDayOfTheWeek
Returns the number of the current day of the week, 1 for Monday, 2 for Tuesday, 3 for Wednesday, and so on. - GetQuestionBoxResult
Returns the button clicked in the QuestionBox command. The result is "yes" or "no". - Uppercase
Converts a string to uppercase. - Lowercase
Converts a string to lowercase. - StrToInt
Converts a string to an integer value. - IntToStr
Converts an integer value to a string. - FileExists("...")
Checks whether the specified file exists. The result is "1" or "0".
Example:
if FileExists("c:\test\export.htm") = "1" then MessageBox "File export.htm exists"
- FileToString("...")
Reads the content of the specified file. To write the value of a variable to a file, use the function StringToFile.
Example:
//Save the current date/time to a file
$s = Now
StringToFile("c:\files\script.dat", $s)
//Read string from file
$Date = FileToString("c:\files\script.dat")
MessageBox "Value is: {$Date}"
- GetBookmarkFileName
Returns the name of the currently opened bookmark file (full path + file name), for example "c:\wsw\bm.wsw".
Example:
// Store absolute path + filename of the currently opened bookmark file in variable $s
$s = "{bookmarkdir}" + GetBookmarkFilename
// Open the bookmark file "c:\wsw\bm.wsw" if it is not the opened bookmark file
$s1 = "{bookmarkdir}" + GetBookmarkFilename
$s1 = Lowercase($s1)
if $s1 <> "c:\wsw\bm.wsw" then OpenBookmarkFile "c:\wsw\bm.wsw"
- TestConnection(...)
Tests whether an internet connection exists by accessing the specified URL. If the URL can be accessed, this function returns 1. If the URL reports an error, this function returns 0.
Example:
if TestConnection("https://www.domain.com") = 0 then AbortScript