nnCron Predefined Variables

%hh%
current hour (00-23)
%mm% current minute (00-59)
%ss%

current second (00-59).
nnCron automatically updates the value of this variable once a minute; use the word GET-CUR-TIME to update it manually

%MM% month (01-12)
%MMM% month (Jan-Dec)
%DD% day of a month (01-31)
%WW% day of a week (Mo-Su)
%WD% day of a week (1-7, where 1 is Monday, and 7 is Sunday)
%YYYY% year (4 digit)
%YY% year (last 2 digit)

%crlf% carriage return followed by line feed
%QUOTE% quotation mark (")
%% percent sign (%)
%PERCENT% percent sign (%)
%FILE: filename%

inserts the contents of a file filename.
There also exists a postfix version of this word: S" filename" FILE.


%FOUND-FILENAME%

name of a found file (see FOR-FILES:)

%FOUND-FULLPATH% full path and name of a found file (see FOR-FILES:)
%FOUND-RELPATH% path and name of a found file relative to the directory where search is performed (see FOR-FILES:)

%WIN-TITLE% window title (see "Working with Application Windows")

%ACTIVE-WINDOW%

title of the active window (see "Working with Application Windows")

%FOUND-WINDOW% title of a found window (see "Working with Application Windows")
%FOUND-CHILD-WINDOW% title of a found child window (see FOR-CHILD-WINDOWS:)

%FOUND-PROC% the name of the found process (see "Working with processes")

%FOUND-PID%

the PID of the found process (see "Working with processes")

%[if] <condition>% ... %[else]% ... %[end]% - the easy way to change your string depending on given condition

Examples:

#( test_string_constr
NoActive
Action:
MSG: "I'm %[if] ONLINE?%online%[else]%offline%[end]%!"
MSG: 'Notepad is %[if] S" notepad.exe" PROC-EXIST?%%[else]%not %[end]%running!'
)#

#( test_string_constr1
NoActive
: opera? WIN-EXIST: "*Opera" ;
Action:
MSG: "Opera is %[if] opera?%%[else]%not %[end]%running!"
)#

#( test_string_constr2
NoActive
\ postfix form, printing message to console
: opera? WIN-EXIST: "*Opera" ;
Action:
S" Opera is %[if] opera?%%[else]%not %[end]%running!" EVAL-SUBST TYPE CR
)#


%n esPICK%
- inserting the n-th value from the stack

%n esPICKS%

- inserting the string from the stack. The starting address of the string should be the n-th value on the stack and the counter should be the n-th value on the stack minus one (n-1)

Note: the stack numbering starts with zero (0), so the value on top of the stack is always the value 0. After %n esPICK% and %n esPICKS% usage the stack is cleared up to the n-th value plus 1 (n+1) , so the n-th value plus 1 (n+1) becomes the topmost value on the stack.

Examples:

#( test_esPICK
NoActive
Action:
\ placing three values on the stack (the current year, month and day):
Year@ Mon@ Day@
\ displaying these values in a message:
MSG: "The current date: %0 esPICK%-%1 esPICK%-%2 esPICK%"
)#

#( test_esPICK1
NoActive
Action:
\ placing three values on the stack (the current year, month and day):
Year@ Mon@ Day@
\ displaying these values in a messages (one by one):
MSG: "Current day: %0 esPICK%"
MSG: "Current month: %0 esPICK%"
MSG: "Current year: %0 esPICK%"
)#

#( test_esPICKS
NoActive
Action:
\ placing two strings on the stack:
S" first string" S" second string"
\ displaying these strings in a message:
MSG: "%1 esPICKS% and %3 esPICKS%"
)#

#( test_esPICKS1
NoActive
Action:
\ placing two strings on the stack:
S" first string" S" second string"
\ displaying these strings in a messages (one by one):
MSG: "The second string: %1 esPICKS%"
MSG: "The first string: %1 esPICKS%"
)#


%COMSPEC% name or the command interpreter (command.com in Win9* and cmd.exe in WinNT/2000/XP)
%CLIPBOARD% current contents of the Windows clipboard
%USERNAME%

name of the current logged in user

%CONNECTION% a list of all active remote connections (conn1, conn2, ...)
%LAST-CONNECTION% name of the last remote connection (e.g. for WatchDisconnect)
%ModuleDirName% the full path to the directory, where nnCron is installed
%CHAR X FREE-SPACE%

amount of free space on disk X: (in kilobytes).

For example, for C: drive it will be %CHAR C FREE-SPACE%, for D: drive—%CHAR D FREE-SPACE% etc.

%$0% %$1% .... %$15% variables used in regular expressions
%ExitCodeProc% exit code (error level) of an application. Used after execution of START-APPW:
%ThreadId% number of a thread in which a task is started, task process identifier
%WATCH-PROC-ID% contains process identifier (PID). This variable is filled after words WatchProc:/WatchProcStop: have been used. It is used as an argument for words used to handle processes.
%WATCH-SESSIONID% contains the SessionID.This variable is filled after WTSWatch* words have been used.
%DRIVE-LETTER% contains the inserted/removed removable data storage device letter. This variable is filled after words WatchDrive:/WatchDriveRemove: have been used.
%TempFile%

contains a unique string which is built in this way: <running number >.<ThreadId>.<TickCounter>, e.g.:

5.120.5434173
6.968.5439611
7.544.5446721
8.1100.5451629

Such a string maybe conveniently used, for example, as a unique file name.

%PrevTempFile%

contains the previous %TempFile%

PROC-ID process identifier (PID) of an application started by nnCron. It is used as an argument for words handling processes. This variable is filled after each time an applications is started successfully (see START-APP:, START-APPW:, QSTART-APP:).
WIN-HWND contains window handle of a window. It is filled after most of command having to do with windows (and WIN-EXIST: as well).
WIN-CHILD-HWND contains window handle of a child window. This variable is filled inside of the FOR-CHILD-WINDOWS: loop.

Special folders (variables which return path and name of user folders will contain empty strings unless a user profile is loaded):

%FOLDER-APP-DATA% Application data folder
%FOLDER-COMMON-DESKTOP% Common desktop for all users
%FOLDER-COMMON-STARTMENU% Common Start menu
%FOLDER-COMMON-PROGRAMS% Common Programs menu
%FOLDER-DESKTOP% Desktop
%FOLDER-FAVOURITES% Favorites
%FOLDER-PERSONAL% Personal Folder
%FOLDER-STARTMENU% Start menu
%FOLDER-PROGRAMS% Programs menu
%FOLDER-RECENT% Documents menu (within Start menu)
%FOLDER-SENDTO% "Send to" menu
%FOLDER-STARTUP% Startup menu
%FOLDER-TEMPLATES% Templates folder
%FOLDER-TEMP% Temp folder (for temporary files)
%FOLDER-WINDOWS% Windows folder
%FOLDER-SYSTEM% System folder

Besides, any environment variables, e.g. %PATH%, and any Forth words can also be used as nnCron variables, but in this case an expression must return a string ( addr u) or a 32-bit integer ( n).

Example:

\ the number of milliseconds since system startup, 
\ will be inserted to a string
MSG: "%GetTickCount%"