PPSR > Built-in Functions 
- Overview
- Built-in functions differ in that they don't follow the standard Command.Action() format, instead being standalone calls of one word (or multiple words concatenated into one), with one specific purpose.
- Functions
- By Category
- Clipboard
- clip
- Description
- Retrieves the 1st line of clipboard
- Syntax
- Return Value
- (string) 1st line of the clipboard
- Notes
- See Clip plugin for information on using the full clipboard.
- This function does not retrieve the full contents of the clipboard -- use Clip.Get to achieve that.
- Examples
- do("c:\path\to\notepad.exe", clip)
- Win.Debug(clip, "saved to clipboard")
- cliptrackon
- Description
- Checks if clip tracking is on.
- Syntax
- Return values
- Examples
- Win.Debug("clip tracking is ", ifelse(cliptrackon==1, "on", "off"))
- Checks if clip tracking is on & outputs a statement about it to a debug window.
- lastclipname
- Description
- Gets the file name of the last captured clipboard item.
- Syntax
- Return Value
- (string) name of the last captured clip file
- Examples
- Win.Debug( lastclipname )
- Debugs the name of the last clip file.
- Notes
- This function only returns the clip file's name, not its full file path.
- Clip tracking must be on.
- lastclippath
- Description
- Retrieves the full path to the last captured clipboard item.
- Syntax
- Return Value
- (string) full path to the last captured clip file
- Examples
- Win.Debug( lastclippath )
- Outputs the value of the lastclippath to a debug window.
- Control Structures
- do
- built-in command
- expression syntax
- literal syntax
- "ppcmd", "action and params", "keywords"
- Description
- Executes a command.
- The do() command can take one of two formats, depending on the command target, which may be an external program or file, or a built-in PowerPro command.
- Syntax
- do(filepath, params[, workfolder[, howstart]])
- to run an external program or file
- do(ppcmd.action(params))
- to run a PowerPro command
- Parameters
- filepath
- (string) path to an external program or file to run
- params
- (string) with both formats, params is a string of the parameters for the command
- workfolder
- (string) work directory to use if filepath points to a program
- howstart
- (string) how to open any windows created by the call
- Possible Values
- "min"
- "max"
- "hidden"
- "hide"
- "traymin"
- "normal"
- ppcmd
- PowerPro command or plugin name
- action
- desired action or service
- Examples
- do("Batch.bat", "", ?"C:\Working\Folder", "Hide")
- Runs a batch file on folder "C:\Working\Folder", hiding any windows that may be created by the process.
- do("c:\programs\pgm.exe", "mydocs\pgmfile.xxx")
- Opens the program "pgm.exe" with parameter being a file, given with a file path relative to the program.
- do("Menu Folder", ?"C:\Program Files\PowerPro", ;;+
"nofolders explorer2 nohidden maxtext 32 ")
- Uses PowerPro's Literal syntax to build a do() command that shows a menu from the specified folder, with menu parameters also as specified. (See the Menu.Folder() command for more information on that command.)
- do(window.trans(-254, "HTML Help*PowerPro"))
- Uses Expression syntax to build a do() command that toggles the transparency value of the PowerPro Help (CHM) file.
- Notes
- Wait.Until() cannot be used as the command in a do() statement.
- Global Variables
- if
- Description
- Evaluates a condition & returns specified result if true, else returns an empty string.
- Syntax
- Parameters
- condition
- (mixed) condition to be evaluated
- result
- (mixed) return value if condition is true
- Return Value
- (string) either:
- condition = true
- Returns the value of parameter "result".
- condition = false
- Examples
- Win.Debug( if(10<20,"alpha,omega") )
- Notes
- Unlike the if()do statement, which is used at the start of a line, this function can be used in parameters.
- ifelse
- Description
- Evaluates an expression & returns a particular result if true, or a different result if false.
- Syntax
- ifelse(expr, sTrue, sFalse)
- With three operands: returns sTrue if expr is true, or sFalse if it is false.
- ifelse(expr, sTrueFalse)
- With two operands: the second string should contain a comma; result is everything up to this comma if expr is true, or everything after the comma otherwise.
- Parameters
- expr
- (mixed) expression to be evaluated
- sTrue
- (mixed) value assigned if expr is true
- sFalse
- (mixed) value assigned if expr is false
- sTrueFalse
- (string) value made up of 2 comma-separated parts:
- part before comma
- value assigned if expr is true
- part after comma
- value assigned if expr is false
- Return Value
- (mixed) value, as determined by evaluation of expr.
- Examples
- Win.Debug( ifelse (10<20,"alpha,omega") )
- local hrs = formattime("hh",time)
Win.Debug("Good", ifelse(hrs<12, "Morning", ifelse(hrs<18, "Afternoon", "Evening")))
- Gets the hour of the day, then uses nested ifelse statements to compare the hour with certain times in order to determine the second word of a greeting, which is then output to a debug window.
- Notes
- "True" is considered to be any value that is Not 0 and Not "".
"False" is any value that is 0 or "".
sTrue & sFalse cannot be input dialogs -- they seem to get executed every time, no matter the outcome of expr.
- not
- Description
- Checks whether an expression is false.
- Syntax
- Parameters
- expr
- (mixed) expression to check
- Return Value
- Result is 1 if following expression is zero or empty string; else 0
- (boolean)
- 1
- expr is false, zero, or an empty string
- 0
- expr is true, not zero, or a non-empty string
- Examples
- if (not(anywindow("=notepad")))
do("notepad")
- Opens a Notepad window if there are none already open.
- Date
- date
- Description
- Retrieves today's date as an 8-digit string: yyyymmdd
- Syntax
- Return Value
- (string) today's date as an 8-digit string: yyyymmdd
- Examples
- local dt = date
- Sets local variable dt to the current date.
- Win.Debug("The date is", formatdate("d/M/yyy", date))
- Outputs a string like the following to a debug window:
"The date is 3/12/05"
- dayofweek
- Description
- Retrieves the current day of the week as a single digit.
- Syntax
- Return Value
- (integer) day of week, where:
- Examples
- if (dayofweek == 3)
Win.Debug("It is Wednesday today")
- Checks if it is Wednesday & outputs a debug message if so.
- dayofyear
- Description
- Retrieves the day number of today in the current year as an integer between 0-365 (0-366 in leap years).
- Syntax
- Return Value
- (integer) day number of today
- Examples
- if (dayofyear == 267 || dayofyear == 268)
Win.Debug("Today is September 24.")
- Checks if today is the 24th of Sep & outputs a debug message if so.
- Notes
- Day numbers will change in leap years!
- formatdate
- Description
- Formats a date according to the specified format.
- Syntax
- formatdate(format_string, date_string)
- Parameters
- format_string
- (string) date output format, represented by a predefined or custom string
- Predefined Formats
- Formats the date according to the Control Panel Regional Settings.
- Possible Values
- Custom Formats
- String is composed of any combination of the following characters:
- Possible Values
- d
- Day of month as digits
- No leading zero for single-digit days
- dd
- Day of month as digits
- With leading zero for single-digit days
- ddd
- Day of week as a three-letter abbreviation
- dddd
- Day of week as its full name
- M
- Month as digits
- No leading zero for single-digit months
- MM
- Month as digits
- With leading zero for single-digit months
- MMM
- Month as a three-letter abbreviation
- MMMM
- y
- yy
- Last 2 digits of year
- With leading zero for years less than 10
- yyy or yyyy
- Full year, represented by 4 digits
- date_string
- (string) date to format, as an 8-digit date string: "yyyymmdd"
- Return Value
- (string) the formatted date string
- Examples
- Win.Debug(formatdate("dd/M/yy", date))
- Outputs the current date in a string like: "03/12/05"
- formatdate( "dddd, dd MMMM yyyy", "20040822")
- Yields: "Thursday, 22 August 2004"
- Static d = formatdate(longdate, date)
Win.Debug(d)
- Formats the current date according to the Control Panel Regional Settings, then outputs the value to a debug window.
- longdate
- Description
- Retrieves today's date in Control Panel Regional long date format.
- Syntax
- Return values
- (string) the long date string
- Examples
- Win.Debug( longdate )
- Outputs a string like: "Saturday, 3 December 2005"
- shortdate
- Description
- Retrieves today's date in Control Panel Regional short date format.
- Syntax
- Return values
- (string) the short date string
- Examples
- Win.Debug( shortdate )
- Outputs a string like: "3/12/2005"
- unixtime
- Description
- Calculates the number of seconds since midnight on January 1, 1970.
- Syntax
- Return values
- (integer) number of seconds
- Examples
- Notes
- The functions unixtime & timesec are the same.
- See Also
- See the date plugin for more functions to manipulate dates.
- Dialogs
- Functions
- _PickedLine_
- Description
- Index of the last string chosen from a pickfile() or pickstring() dialog.
- Syntax
- Return Value
- (integer) the index value
- Examples
- local s = pickstring("first\nsecond\nthird", "pick one!")
Win.Debug("the picked string was:", s, "which was item number", _PickedLine_, "in the list")
- See Also
- input
- Description
- Shows a dialog with specified title prompting for text input.
- Syntax
- Parameters
- title
- (string) title of the dialog window
- lim
- (integer) maximum number of characters to allow
- prepended to title string after "=" character
- Optional, default is no limit.
- Return Value
- (string) either:
- the text input
- "" (an empty string)
- Cancel was pressed
- OK was pressed but nothing was entered
- UI Elements
- textbox
- Text field for user input.
- OK button or <Enter> key
- If pressed, result is the whatever has been typed in the textbox.
- Cancel button or <ESC> key
- If pressed, result is "" (empty string) & script execution continues.
- File... button
- Opens a file selection dialog, & the full path of the selected file is entered into the textbox.
- Folder... button
- Opens a folder selection dialog, & the selected folder path is entered into the textbox.
- Examples
- local s = input("Name of file:")
- Shows an input dialog with title "Name of file:".
- local s = input("=15Enter up to 15 chars")
- Shows an input dialog with title "Enter up to 15 chars", allowing a maximum user input of 15 characters.
- Notes
- input() is similar to the inputcancel() function, except that inputcancel() causes the running script to quit if Cancel is pressed, while input() does not.
- inputcancel
- Description
- Shows a dialog with specified title prompting for text input. If the Cancel button is pressed, the running script quits.
- Syntax
- inputcancel("[=lim]title")
- Parameters
- title
- (string) title of the prompt window
- lim
- (integer) maximum number of characters to allow
- prepended to title string after "=" character
- Optional, default is no limit.
- Return Value
- (string) either:
- the text input
- "" (an empty string)
- Cancel was pressed
- OK was pressed but nothing was entered
- UI Elements
- textbox
- Text field for user input.
- OK button or <Enter> key
- If pressed, result is the whatever has been typed in the textbox & script execution continues.
- Cancel button or <ESC> key
- If pressed, result is "" (empty string) & script execution halts.
- File... button
- Opens a file selection dialog, & the full path of selected file is entered into dialog's text field.
- Folder... button
- Opens a folder selection dialog, & selected folder path is entered into dialog's text field.
- Examples
- local s = inputcancel("Name of file:")
- Shows an input dialog with title "Name of file:".
- local s = inputcancel("=15Enter up to 15 chars")
- Shows an input dialog with title "Enter up to 15 chars", allowing a maximum user input of 15 characters.
- Notes
- inputcancel() is similar to the input() function, except that input() still continues on to the next statement in the running script if Cancel is pressed.
- inputcolor
- Description
- Displays color dialog and returns results as single number.
- Syntax
- UI Elements
- Color Picker
- Offers various ways to select a colour.
- OK button
- If pressed, function returns value of currently selected colour
- Cancel button
- If pressed, function returns 0 (which is also black).
- Return Value
- (integer) value of selected color
- Examples
- local c = inputcolor
Win.Debug( "hex color: #" ++ Win.Hex(c) )
- Uses Win.Hex() to get the hex value from the result of the inputcolor dialog.
- inputdate
- Description
- Displays a PowerPro Calendar Calculator window allowing for various date-related calculations, then returns the date selected as 8 digits: yyyymmdd
- Syntax
- Return Value
- (string) either:
- the date, as 8 digits: yyyymmdd
- "20010101"
- the Cancel button or <ESC> key was pressed
- PowerPro flag 0 is set to:
- 1
- OK button or <Enter> key pressed
- 0
- Cancel button or <ESC> key pressed
- UI Elements
- PowerPro Calendar Calculator
- Date 1 dropdown
- Calendar dropdown for date selection.
- Click on the day, month, or year portion of the date then use the arrow keys to scroll through the values. (Note that day of the week is not editable in this way.)
- Click on the dropdown arrow to open a month-view calendar UI with controls for moving between dates & the current date highlighted.
- Day Number textbox
- Number of days since start of year.
- The value is editable, & if changed, other fields will be updated accordingly.
- Week Number textbox
- Number of weeks since start of year.
- The value is editable, & if changed, other fields will be updated accordingly. Weeks start on a Sunday, so Date 1 will always be updated to a date that falls on this day.
- Date 2 dropdown
- Calendar dropdown for date selection.
- see Date 1 dropdown for more info
- Days textbox
- Number of days between Date 1 and Date 2.
- The value is editable, & if changed, other fields will be updated accordingly.
- Weekdays textbox
- Number of weekdays between Date 1 and Date 2.
- The value is editable, & if changed, other fields will be updated accordingly.
- Weeks textbox
- Number of weeks between Date 1 and Date 2.
- The value is editable, & if changed, other fields will be updated accordingly.
- Use button or <Enter> key
- If pressed, the return value is set to the date currently showing in Date 2, & PowerPro flag 0 is set to 1.
- Cancel button or <ESC> key
- If pressed, function returns "20010101" & PowerPro flag 0 is set to 0.
- Examples
- Win.Debug( inputdate )
- Shows a calendar dialog & outputs the result to a debug window.
- inputdatetime
- Description
- Displays a PowerPro Calendar Calculator window allowing for various date-related calculations, then returns the date & time selected as 14 digits: yyyymmddhhmmss
- Syntax
- Return Value
- (string) either:
- date & time as 14 digits: yyyymmddhhmmss
- "20010101010101"
- indicates Cancel button or <ESC> key was pressed
- PowerPro flag 0 is set to:
- 1
- OK button or <Enter> key pressed
- 0
- Cancel button or <ESC> key pressed
- UI Elements
- Calendar Calculator
- Date 1 dropdown
- Calendar dropdown for date selection.
- Click on the day, month, or year portion of the date then use the arrow keys to scroll through the values. (Note that day of the week is not editable in this way.)
- Click on the dropdown arrow to open a month-view calendar UI with controls for moving between dates & the current date highlighted.
- Day Number textbox
- Number of days since start of year.
- The value is editable, & if changed, other fields will be updated accordingly.
- Week Number textbox
- Number of weeks since start of year.
- The value is editable, & if changed, other fields will be updated accordingly. Weeks start on a Sunday, so Date 1 will always be updated to a date that falls on this day.
- Date 2 dropdown
- Calendar dropdown for date selection.
- see Date 1 dropdown for more info
- Days textbox
- Number of days between Date 1 and Date 2.
- The value is editable, & if changed, other fields will be updated accordingly.
- Weekdays textbox
- Number of weekdays between Date 1 and Date 2.
- The value is editable, & if changed, other fields will be updated accordingly.
- Weeks textbox
- Number of weeks between Date 1 and Date 2.
- The value is editable, & if changed, other fields will be updated accordingly.
- Time input field
- Input field for time entry.
- Click on a portion of the time (i.e. minutes, hours, etc) then use the arrows at right of the field or the keyboard arrow keys to scroll through the values, or edit them directly via the keyboard.
- Use button or <Enter> key
- If pressed, the return value is set to yyyymmddhhmmss, being the date currently showing in Date 2 & time showing in the Time input field, & PowerPro flag 0 is set to 1.
- Cancel button or <ESC> key
- If pressed, function returns 20010101010101 & PowerPro flag 0 is set to 0.
- Examples
- Win.Debug( inputdatetime )
- Shows a calendar window & outputs the selected date & time to a debug window.
- inputdefault
- Description
- Displays an input dialog with specified title & optional autocomplete, preset with a default value.
- Syntax
- inputdefault(default, title, autokeyword)
- Parameters
- default
- title
- (string) title for input dialog
- To limit input length, start title with =n
e.g.
inputdefault("", "=15Enter up to 15 chars")
- autokeywords
- (string) auto-complete keywords
- Optional, default is that autocomplete is disabled. Autocomplete is enabled when autocomplete keywords are specified here.
- Possible Values
- file
- autocomplete using file and shell folder names
- urlhistory
- autocomplete using history URL
- urlrecent
- autocomplete using URL most recently used
- history
- autocomplete using the history in the dropdown of the edit box
- =vecname
- where vecname=name of the vector containing the strings to use for autocomplete
- Return Value
- (string) the data entered
- UI Elements
- textbox
- Text field for user input.
- Cancel button
- If pressed, result is "" (empty string).
- OK button
- If pressed, result is whatever is currently showing in the textbox.
- File... button
- Opens a file selection dialog, & the full path of selected file is entered into dialog's textbox.
- Folder... button
- Opens a folder selection dialog, & selected folder path is entered into the textbox.
- Examples
- Win.Debug( inputdefault("orange", "Fave colour?") )
- Shows an input dialog with "orange" prefilled in it & "Fave colour?" as the window title, then outputs the value entered to a debug window.
- local sPath = inputdefault("c:\\", "Select a file...", "file urlhistory")
- Shows an input dialog with "c:\" prefilled in the textbox & window title "Select a file...", enabling autocomplete for the textbox for file paths & shell folder names, and history url's.
- local vDays = vec.createfromwords("monday tuesday wednesday thursday friday saturday sunday")
Win.Debug( inputdefault("tuesday", "What day do you think it is?", "=vDays") )
- Creates a 7-element vector named "vDays" which is used for the autocomplete keywords in the subsequent inputdefault() call, which has title "What day do you think it is?", & "tuesday" prefilled in the textbox. Outputs the entered data to a debug window.
- inputdialog
- Description
- The InputDialog function displays an input dialog that can be customised with up to six controls that set the values of up to six variables.
- Controls that may be created:
- textbox
- checkbox
- combo box
- password field
- Syntax
- inputdialog("[~][c1=r1[,...[,c4=r4]]]var1=label1[,...[,var6=label6]]", title)
- Parameters
- ~
- Hides the "File..." and "Folder..." buttons at the bottom of the inputdialog window.
- Optional, but if used, the tilde sign ("~") must come before both the 1st variable & label pair and any character replacement pairs that may apply.
- c1=r1, ..., c4=r4
- (string) original & replacement character pairs, to be used in the variable & label pairs string, repeating without spaces for each character to be changed, where:
- c1, ..., c4
- (string) original characters to be changed
- Possible Values
- r1, ..., r4
- (string) replacement character
- Avoids the special meaning of the original character when it appears in the variable & label pairs string by assigning another character to take on its special meaning instead.
E.g.
inputdialog(",=.sNm=Name.sLocn=Location", "Your details:")
- varn=labeln
- (string) variable & label pairs for up to 6 comma-separated controls to appear in the dialog window, where:
- var1, ..., var6
- (string) name of the variable to receive the submitted value of that control
- label1, ..., label6
- (string) label to appear beside that control in the inputdialog window
- Possible Formats
- var=label
- Displays a textbox.
- Returns the string in the field.
- var==label
- Displays a password edit field which shows asterisks for characters typed.
- Returns the password entered.
- var=label??
- Displays a boolean checkbox field.
- Returns either:
- var=label??item1|item2|...|itemn
- Displays a combo box (a combined textbox & text selection field).
- The items following the question marks are the items for the dropdown list of the combo box, separated by vertical bars.
- Returns the string in the field.
- title
- (string) inputdialog window title
- Return Value
- (boolean)
- 1
- OK button or <Enter> key was pressed
- Each variable is set with its respective control's current value.
- 0
- Cancel button or <ESC> key was pressed
- No variables are set.
- UI Elements
- OK button or <Enter> key
- If pressed, returns 1 & all variables are set to the values their respective controls currently hold.
- Cancel button or <Esc> key
- If pressed, returns 0 & no variables are set.
- File... button
- If pressed, a file selection window is shown & the path of the selected file is put into the textbox which last had the keyboard focus.
- Folder... button
- If pressed, a folder selection window is shown & the path of the selected folder is put into the textbox which last had the keyboard focus.
- Optional Control: combo box
- (string) combined text input & text selection field, returning the entered string
- Format: "var=label??item1|item2|..."
- Optional Controls
- Textboxes, password fields, checkboxes, & combo boxes are possible -- see "varn=labeln" in Parameters, above.
- Examples
- local alpha, beta
Inputdialog("alpha=Enter new stuff,beta=Value here","Two Variables")
Win.Debug("alpha:", alpha)
Win.Debug("beta:", beta)
- Displays a dialog with the caption "Enter Two Variables:", along with two textboxes:
First Textbox
- has label "Enter new stuff"
- is initialized to the variable x1
- is used to reset variable x1 to a new value when OK is pressed.
Second Textbox
- has title "Value here"
- sets variable "beta"
- local sNm1, bOver18, sLocn, sPw
inputdialog("~sNm=name,bOver18=over 18??," ;;+
"sLocn=location??here|there|everywhere,sPw==password","Enter your details:")
messagebox("info ok", ;;+
"name:"++sNm++"\rover 18:"++bOver18 ;;+
++"\rlocation:"++sLocn++"\rpassword:"++sPw, ;;+
"You entered the following:")
- Shows a dialog with 4 controls: a textbox with label "name", a checkbox with label "over 18", a combo box with label "location", & a password field with label "password". Data entered is then displayed in a PowerPro messagebox.
- inputdialog(",=/==*var1*label1/var2*label2", "caption for dialog")
- Uses a slash instead of a comma and a star instead of an equal sign for the variable & label pairs string "var1=label1,var2=label2".
- Notes
- No spaces are allowed after commas in the variable & label pairs string.
- inputfolder
- Description
- Displays a "Browse for Folder" dialog, & returns the selected folder path.
- Syntax
- Return Value
- (string) full path to the selected folder
- UI Elements
- folder selection control
- Folder browse & select control.
- Double-click on a folder to select it & close the inputfolder dialog, or highlight a folder & click OK.
- OK button
- If pressed, result the path of the folder currently selected in the folder selection control, or, if none is selected, the open folder.
- Cancel button
- If pressed, result is "" (empty string).
- New Folder button
- If pressed, creates a new subfolder of the folder currently showing in the folder selection control.
- Examples
- local sPath = inputfolder
- Shows a Browse for Folder dialog & puts the returned folder path string into local variable sPath.
- inputpath
- Description
- Displays a file selection window with the title "PowerPro" & returns the path to the selected file.
- Syntax
- Return Value
- (string) full path to the selected file
- UI Elements
- file selection control
- File selection control for browsing & selecting a file.
- A file can be selected by:
- double-clicking on a file here, which selects it & closes the dialog.
- highlighting a file here & clicking Select button.
- File Name textbox
- Text field for file name.
- Editable & dynamically populated as selection changes in file selection control.
- Files of Type dropdown
- Select button or <Enter> key
- If pressed, result is the path to the file selected in file file selection control.
- If a file has not yet been selected when the Select button is pressed, the file selection dialog immediately reopens.
- Cancel button or <ESC> key
- If pressed, result is "" (an empty string).
- Examples
- Win.Debug( inputpath )
- Shows a file selection dialog, then outputs the path of the selected file to a debug window.
- inputpathmulti
- Description
- Displays a file browse & select dialog, & returns the path to the selected files plus a list of the file names.
- Syntax
- Return Value
- (multi-line string) where:
- 1st line = path to the folder containing the selected files
- remaining lines = names of the files, one line per file name
- UI Elements
- file selection control
- File selection control for browsing & selecting a file or multiple files.
- Files can be selected by:
- double-clicking on a single file, which selects it & closes the dialog.
- highlighting 1 or more files here & clicking the Select button.
- holding down <Shift> while highlighting files to select multiple consecutive files.
- holding down <Ctrl> while highlighting files to select multiple non-consecutive files.
- File Name textbox
- Text field for file name or names.
- Editable & dynamically populated as selection changes in file selection control.
- Files of Type dropdown
- Select button or <Enter> key
- If pressed, result is the path to the file selected in file file selection control.
- If a file has not yet been selected when the Select button is pressed, the file selection dialog immediately reopens.
- Sets pproflag(0) to 1.
- Cancel button or <ESC> key
- If pressed, result is "" (an empty string).
- Sets pproflag(0) to 0.
- Examples
- local multi = inputpathmulti
if (pproflag(0)) do
path = line(multi,1)
for (i=2;1;i=i+1)
file = line(multi,i)
if (not file)
break
; statements to process path ++ "\" ++ file
endfor
endif
- Uses the line() function to loop through the list of file names returned from the inputpathmulti call, prepending the folder path to each value in preparation for some sort of processing.
- inputtext
- Description
- Displays a text input dialog, & returns the entered string.
- Syntax
- Return Value
- (string) the text entered
- UI Elements
- textbox
- Text field for user input.
- OK button or <Enter> key
- If pressed, result is the whatever has been typed in the textbox.
- Cancel button or <ESC> key
- If pressed, result is "" (empty string).
- File... button
- Opens a file selection dialog, & the full path of the selected file is entered into the textbox.
- Folder... button
- Opens a folder selection dialog, & the selected folder path is entered into the textbox.
- Examples
- Win.Debug("You wrote:", inputtext)
- Notes
- The inputtext & input(title) functions are similar, except a title cannot be set with inputtext -- the caption contains just the number of characters entered, in parentheses.
- messagebox
- Description
- Shows a message box with up to 3 buttons & returns a result indicating which button was pressed.
- Syntax
- messagebox (layout, text, title)
- Parameters
- layout
- (string) keywords specifying the buttons and icons for message box
- If layout="" (an empty string), an OK button is shown with no icon.
- Buttons
- To set the buttons, layout can contain any of:
- "abortretryignore"
- "ok"
- "okcancel"
- "retrycancel"
- "yesno"
- "yesnocancel"
- Icons
- To set the icons, layout can contain any of:
- "asterisk"
- same icon as "information"
- "error"
- "exclamation"
- "information"
- "question"
- "stop"
- "warning"
- same icon as "exclamation"
- text
- (string) text to appear in the messagebox
- title
- (string) title for the messagebox
- Optional, defaults to "PowerPro".
- Return Value
- (integer) the button pressed, where:
- Examples
- MessageBox("yesno question" , "continue with script?")
- Displays a Yes/No messagebox with a question mark icon.
- See Also
- Win.Message
- Plugins > Bruce's Plugins > Win > Message
- pickfile
- Description
- Displays a file selection dialog with a list of filenames, then returns the full path of the selected file.
- Syntax
- Parameters
- paths
- (string) a multi-line string containing 1 or more file paths
- title
- (string) title of the dialog window
- Return Value
- (string) either:
- full path of the selected file
- "" (empty string)
- Cancel pressed, or no file selected
- UI Elements
- File selection dialog
- Window contents
- list box
- Contains the names of all files in the specified paths, one per line.
- Only the filename & type are shown, not the full path.
- edit box
- If the user types blank-separated strings in the edit box, the names in the list box are filtered down to only those which contain what is being typed.
- To select a file
- double-click on a filename in the list box
- click on a filename & press Enter
- press Enter to select the top file in the list
- Examples
- do(pickfile(file.listfiles("c:/mymp3", 1),"Play song"))
- Uses File.ListFiles() to get a list of files in "c:\mymp3" & any of its subfolders, displaying them to the user with a pickfile() dialog, then plays the selected file.
- Notes
- The index of the picked string is always assigned to the global variable _PickedLine_. Indexes start at 1, as they do for the line() function.
- See Also
- _PickedLine_
- Index of the last selected line.
- See: Built-in Keywords > Keywords > _PickedLine_
- pickstring
- Description
- Selects a string, or multiple strings, from a list in a dialog.
- Syntax
- pickstring(lines, title, multi)
- Parameters
- lines
- (multi-line string) list of strings to appear in selection dialog
- title
- (string) title for the dialog window
- multi
- (boolean) whether to allow multiple selections
- Optional, default is 0.
- Possible Values
- Return Value
- (string) either:
- the selected string
- a multi-line string with multiple selected strings
- UI Elements
- String selection dialog
- Window contents
- list box
- Contains the specified strings, one per line.
- edit box
- If the user types blank-separated strings in the edit box, the options in the list box are filtered down to only those which contain what is being typed.
- To select a string
- double-click on a string in the list box
- click on a string & press Enter
- press Enter to select the top string in the list
- Examples
- local s = pickstring("alpha\rbeta\rgamma\rdelta", "Greek to me:")
- Displays a selection dialog with options "alpha", "beta", "gamma" & "delta", and dialog title "greek to me". The four strings are supplied literally in this example.
- local s = pickstring(allglobals,"Pick a global variable:")
Win.Debug( s, "=", eval(s) )
- Uses the expression "allglobals" to supply the strings for parameter "lines" in the pickstring() call, outputting the selected string & its value to a debug window.
- Vdesk.SwitchTo( pickstring(alldesknames, "Choose a desktop:") )
- Creates a list of all the desktop names, feeding the selected desktop string to the Vdesk.SwitchTo call to then swap to that desktop.
- local s = pickstring(File.Readall("c:/store/quoteslist.txt"), "Choose a quotation:")
- Reads in the entire file "quoteslist.txt" & builds a list of quotations for the selection dialog from the file's multi-lined contents, storing the selected quote in the local variable "s".
- See Also
- _PickedLine_
- Set to the index of the selected string.
- If multi=1, _PickedLine_ will be set to a space-separated list of indexes of the picked lines.
- For more information, see: Built-in Keywords > Keywords > _PickedLine_
- Indexes start at 1, as they do for the line() function.
- setnextdialogpos
- Description
- Sets the screen position & dimensions of the next dialog box created from:
- input(title)
- inputcancel
- inputdefault
- inputdialog
- pickline
- pickstring
- Syntax
- setnextdialogpos(left, top, width, height, topmost)
- Parameters
- left
- either
- (integer) distance from left edge of screen, in pixels
- "" (empty string)
- top
- either
- (integer) distance from top edge of screen, in pixels
- "" (empty string)
- width
- either
- (integer) width of dialog, in pixels
- "" (empty string)
- height
- either
- (integer) height of dialog, in pixels
- "" (empty string)
- topmost
- (string) whether to show dialog as topmost
- Possible Values
- "top"
- dialog will be shown as topmost
- anything other than "top", including an empty string
- Examples
- setnextdialogpos(100, 200, 400, 100, "top")
Win.Debug( input("Enter something:") )
- Positions & sizes the dialog created by the input() call in the 2nd line according to the details in the 1st line, outputting the returned value in a debug window.
- Input Dialogs & Flags
- In all input dialogs:
- if Cancel is pressed, flag 0 is cleared: pproflag(0)=0
- otherwise flag 0 is set: pproflag(0)=1
- With all input dialog calls, flag 0 is set to:
- 0
- Cancel button or <Esc> key was pressed
- pproflag(0)=0
- 1
- any other button or key was pressed
- pproflag(0)=1
- Errors
- onErrorSetting
- Description
- The current setting for Exec.OnError().
- Syntax
- Return Value
- (string) the setting, as 2 space-separated words in quotes, as per:
"action sethooks"
where:
- action
- (string) the action to take with errors
- Possible Values
- "none"
- "display"
- "file"
- append error info to errors log file
- "both"
- display onscreen info & append error info to log file
- sethooks
- (string) HookErrors setting -- whether to run command list HookErrors whenever an error occurs
- Possible Values
- Examples
- Win.Debug( onErrorSetting )
- _LastError_
- Description
- Global variable that is set to the error message whenever any error occurs.
- Syntax
- Return Value
- (string) the last stored error message
- Examples
- Notes
- To clear _LastError_, call:
_LastError_ = ""
or
Exec.OnError("clear")
- File, Disk
- "|"
- Description
- A single vertical bar, used to represent the currently selected file.
- Used in the commands for:
- a context menu item
- folder buttons
- menu folder
- files dropped on buttons
- Syntax
- Return Value
- Examples
- Examples
- do("notepad.exe", "|")
- Opens the currently selected file in Notepad.
- Notes
- The "|" operator can also be used to position the file path in the command.
- See Also
- The built-in function _file_.
- "||"
- Description
- A double vertical bar, used to represent:
- the currently selected folder.
- the folder path (excluding file name) of the currently selected file.
- Used in the commands for:
- a context menu item
- folder buttons
- menu folder
- files dropped on buttons
- Syntax
- Return Value
- Examples
- do("explorer.exe", "/select", "||", "max")
- Opens the currently selected folder in a maximized Explorer window.
- See Also
- The built-in function _file_.
- _file_
- Description
- The selected file.
- Used in the commands for:
- a context menu item
- folder buttons
- menu folder
- files dropped on buttons
- Syntax
- Return Value
- (string) path to the selected file
- Examples
- do("notepad.exe", _file_)
- Opens the currently selected file in Notepad.
- See Also
- The characters "|" (for a file) and "||" (for a folder) also act available as selected item keywords.
- Context
- Description
- Indicates whether or not the first file is being processed in a group of files to which an Explorer context menu item has been applied.
- Syntax
- Return Value
- (boolean)
- 1
- the first file is currently being processed
- 0
- the first file is not being processed
- Examples
- if (Context)
.printHeaders
- Uses the value of Context to check if processing is at first file, & if so calls a script printHeaders.powerpro
- Notes
- Context=1 while first file is being processed, then is set to 0 by PowerPro for the remainder of the file processing.
- ContextLast
- Description
- Indicates whether or not the last file is being processed in a group of files to which an Explorer context menu item has been applied.
- Syntax
- Return Value
- (boolean)
- 1
- the last file is currently being processed
- 0
- the last file is not being processed
- Examples
- if (ContextLast) do
break
else
; do something
endif
- Uses the value of ContextLast to check when to break out of a file processing loop.
- Notes
- ContextLast=0 while all files except last file are being processed, then is set to 1 by PowerPro.
- diskspace
- Description
- Retrieves either the amount of free space on a drive, the amount available to the current user, or the total drive size.
- Syntax
- diskspace(valtype, drive)
- Parameters
- valtype
- (string) specified what value to retrieve
- Possible Values
- "kfree"
- free kilobytes on specified drive
- "kuser"
- free kilobytes on specified drive available to current user
- "ksize"
- size of drive in kilobytes
- "mfree"
- free megabytes on specified drive
- "muser"
- free megabytes on specified drive available to current user
- "msize"
- size of drive in megabytes
- drive
- (string) the target drive, for example: "c:"
- Return Value
- (integer) the calculated size, in kilobytes or megabytes as determined by parameter valtype
- Examples
- Win.Debug( diskspace("muser", "d:") )
- Outputs the number of free megabytes on drive d: available to the current user
- global lowlim = 100000
if (diskspace("kfree", "c:") < lowlim)
messagebox("warning ok", "Low free mem - drive C", "Low Memory Warning")
- Compares the free memory in kb on drive C to a predetermined low threshold number, & outputs a warning message if it is below that figure.
- filemenu
- Description
- Displays a file as a menu.
- Syntax
- Parameters
- path
- (string) path to the file
- Each line of the file will be an item in the menu.
- Return Value
- (string) the selected item
- Examples
- do(filemenu("c:/docs/urls.txt"))
- Shows a menu made from each line of the file "urls.txt".
If the file consisted of the following:
http://www.foo.com/somepage.htm
http://www.bar.com/
http://www.bee.com/index.htm
and the last item was selected, the string "http://www.bee.com/index.htm" would be passed to the do() command, & it would be loaded in a browser window.
- mounted
- Description
- Checks if the 1st letter of a string represents a removable disk.
- Syntax
- Parameters
- char
- (string) drive letter to check
- Only the first character of char is used.
- Return Value
- (boolean)
- 1
- drive specified by char is a removable disk
- 0
- char is not a removable disk
- Examples
- Win.Debug( mounted("f") )
- Checks if drive F is a removable disk.
- pickfile
- See Built-in Functions > Functions by Category > Dialogs
- readline
- Description
- Retrieves the specified line number from a file.
- Syntax
- readline(filepath, linenum)
- Parameters
- filepath
- (string) full path to the target file
- linenum
- (integer) number of the line to read
- Line numbers start at 1.
- Return Value
- (string) text of the target line
- Flag 0 is:
- cleared if a line is read successfully, so pproflag(0)=0.
- set if end of file is reached before desired line number, so pproflag(0)=1.
- Examples
- local ln = readline("c:/path/path.txt", 3)
- Assigns the 3rd line of file "path.txt" to local variable ln.
- recylceitems
- Description
- Calculates the total number of items in all recycle bins on all drives.
- Syntax
- Return Value
- (integer) total number of items
- Examples
- Win.Debug( recycleitems )
- Outputs the total number of recycle bin items on a system to a debug window.
- recyclesize
- Description
- Calculates the total size in kilobytes of all recycle bins on all drives.
- Syntax
- Return Value
- (integer) total recycle bin size, in kb
- Examples
- Win.Debug( recyclesize )
- Outputs the total recycle bin size to a debug window.
- validpath
- Description
- Checks if a string is a valid path to a file.
- Syntax
- Parameters
- str
- (string) string to check
- The string str may contain wildcards:
- *
- represents 0-many characters
- ?
- Return Value
- (boolean)
- 1
- 0
- str is not a valid file path
- Examples
- Win.Debug( validpath("something") )
- GUI, Desktop
- paper
- Description
- Retrieves the file name of the current wallpaper.
- Syntax
- Return Value
- (string) either:
- file name of the current wallpaper
- "" (empty string)
- Examples
- saver
- Description
- Retrieves the file name of the current screen saver.
- Syntax
- Return Value
- (string) either:
- file name of the current screen saver
- "" (empty string)
- Examples
- saveractive
- Description
- Checks if a screen saver is active.
- Syntax
- Return Value
- Examples
- if (saveractive)
Win.Keys("{en}")
- Checks if screen saver is active, and if so, sends the Enter key.
- Notes
- The "Blank" screen saver is not considered an active screen saver.
- saverenabled
- Description
- Checks if a screen saver is enabled.
- Syntax
- Return Value
- Examples
- if (saverenabled)
Win.Debug("Saver is enabled")
- Checks if screen saver is enabled, and if so, outputs a debug message.
- savertime
- Description
- Amount of system inactivity time needed, in seconds, until screen saver starts.
- Syntax
- Return Value
- (integer) seconds till screen saver starts
- Examples
- xscreen
- Description
- Retrieves the screen width in pixels.
- Current horizontal screen resolution.
- Syntax
- Return Value
- (integer) screen width, in pixels
- Examples
- local wHnd = Win.Handle("active")
if (xscreen>801) do
Win.Maximize(wHnd)
else
Win.Minimize(wHnd)
endif
- Silly example that either maximizes or minimizes the active window based on whether the current screen width is greater than 801 pixels.
- yscreen
- Description
- Retrieves the screen height in pixels.
- Current vertical screen resolution.
- Syntax
- Return Value
- (integer) screen height, in pixels
- Examples
- local wHnd = Win.Handle("active")
if (yscreen>601) do
Win.Maximize(wHnd)
else
Win.Minimize(wHnd)
endif
- Silly example that either maximizes or minimizes the active window based on whether the current screen height is greater than 601 pixels.
- Keyboard
- alt
- Description
- Retrieves the state of the <Alt> key or keys.
- Syntax
- Return Value
- for pre-W2K systems
- (boolean) whether <Alt> key is up or down
- Possible Values
- for W2K & later
- (integer) number indicating state of the two <Alt> keys
- Possible Values
- Examples
- if (alt)
break
- Used inside a loop, checks if alt is pressed & if so breaks out loop.
- ctrl
- Description
- Retrieves the state of the <Ctrl> key or keys.
- Syntax
- Return Value
- for pre-W2K systems
- (boolean) whether <Ctrl> key is up or down
- Possible Values
- for W2K & later
- (integer) number indicating state of the two <Ctrl> keys
- Possible Values
- 0
- 1
- 2
- 3
- both <Ctrl> keys are down
- Examples
- if (ctrl==3)
messagebox("warning ok", "only one Ctrl key should be pressed", ;;+
"Keyboard Error")
- Used inside a loop, checks if alt is pressed & if so breaks out loop.
- keylog
- Description
- Checks if key logging is on.
- Syntax
- Return Value
- (string) character indicating whether key logging is on
- Possible Values
- Examples
- if (keylog)
Win.Debug("Key logging is on")
- keylogfile
- Description
- Retrieves the name of currently open key log file.
- Syntax
- Return Value
- (string) either:
- name of the currently open key log file
- "" (empty string)
- Examples
- lastmousekeytime
- Description
- Time since last mouse or keyboard action, in milliseconds since current Windows session was started.
- Syntax
- Return Value
- (integer) time in milliseconds
- Examples
- Win.Debug( lastmousekeytime )
- shift
- Description
- Retrieves the state of the <Shift> key or keys.
- Syntax
- Return Value
- for pre-W2K systems
- (boolean) whether <Shift> key is up or down
- Possible Values
- for W2K & later
- (integer) number indicating state of the two <Shift> keys
- Possible Values
- 0
- 1
- 2
- 3
- both <Shift> keys are down
- Examples
- if (shift)
break
- Used inside a loop, checks if shift is pressed & if so breaks out loop.
- win
- Description
- Retrieves the state of the <Win> key or keys.
- Syntax
- Return Value
- for pre-W2K systems
- (boolean) whether <Win> key is up or down
- Possible Values
- for W2K & later
- (integer) number indicating state of the two <Win> keys
- Possible Values
- Examples
- if (win)
break
- Used inside a loop, checks if Windows key is pressed & if so breaks out loop.
- Modem, Internet
- browserDomain
- Description
- Retrieves the top level domain name of the site displayed in the current browser window.
- Syntax
- Return Value
- (string) domain of the site
- Examples
- do("d:/apps/firefox.exe", "http://powerpro.webeddie.com/")
Win.Debug( browserDomain )
- Opens "http://powerpro.webeddie.com/" in a Firefox window, then outputs "webeddie.com" to a debug window -- just the domain, without the subdomain.
- if (index(browserDomain, "ppro.org") > 0)
Win.Debug("welcome home!")
- Checks if the current site's domain contains "ppro.org", & if so, displays a debug message.
- browserSubdomain
- Description
- Retrieves the domain name with subdomain of the site displayed in the current browser window.
- Syntax
- Return Value
- (string) subdomain portion of current browser window url
- Examples
- do("d:/apps/firefox.exe", "http://powerpro.webeddie.com/screenshots.html")
Win.Debug( browserSubdomain )
- Opens "http://powerpro.webeddie.com/" in a Firefox window, then outputs "powerpro.webeddie.com" -- the domain & subdomain, without extended path or file details.
- browserURL
- Description
- Retrieves the URL showing in the current browser window.
- Syntax
- Parameters
- client
- (string) browser application to use
- Optional, default is to use the browser set with Exec.Setbrowser().
- Possible Values
- "firefox"
- "iexplore"
- "maxthon"
- "mozilla"
- "netscape"
- Return Value
- (string) URL showing in current browser window
- Examples
- Win.SendKeys(browserURL)
- Sends the URL of the site in the current browser window to the active window.
- Changes
- PP 4.102 and earlier
- browserURL works with IE and Netscape
- PP 4.103 on
- browserURL works for Mozilla Firefox and Internet Explorer by default
- dunidle
- Description
- Retrieves the number of seconds since the last byte was received over dial-up.
- For Win95 & Win98 only.
- Syntax
- Return Value
- (integer) number of seconds connection has been idle
- Examples
- if (dunidle > 120)
.myLogoutScript
- Checks if dial-up connection has been idle longer than 20 minutes & if so calls a user script "myLogoutScript.powerpro".
- dunrate
- Description
- Speed of dial-up connection in bytes per second.
- For Win95 & Win98 only.
- Syntax
- Return Value
- (integer) connection speed (bytes/sec)
- Examples
- if (dunrate > 100)
win.debug("you're flying man!")
- Checks if dial-up connection speed is faster than 100 bytes/sec & outputs a debug message if so.
dialupname- Description
- Retrieves the name of the current dialup connection, or "" (an empty string) if no dial-up connection present.
- Syntax
Return Value- (string) either:
- name of the current dial-up connection
- "" (empty string)
PowerPro Help says dialupname returns 0 if dial-up not connected, but have not been able to generate this.
- Examples
- Win.Debug( dialupname )
- Outputs the current dial-up connection name, or "" if none exists.
- modem
- Description
- Checks if a dial-up connection is present.
- Syntax
- Return Value
- Examples
- if (modem)
do("d:/apps/firefox.exe", "powerpro.webeddie.com")
- Opens the PowerPro homepage in a Firefox window if there is a dial-up connection present.
- Mouse
- mouseleft
- Description
- Checks if the left mouse button is down.
- Syntax
- Return Value
- (boolean)
- 1
- left mouse button is down
- 0
- left mouse button is not down
- Examples
- if (mouseleft)
Win.Debug("Left")
- Checks if left mouse button is down & outputs a debug message if so.
- mousemiddle
- Description
- Checks if the middle mouse button is down.
- Syntax
- Return Value
- (boolean)
- 1
- middle mouse button is down
- 0
- middle mouse button is not down
- Examples
- if (mousemiddle)
Win.Debug("Middle")
- Checks if middle mouse button is down & outputs a debug message if so.
- mouseright
- Description
- Checks if the right mouse button is down.
- Syntax
- Return Value
- (boolean)
- 1
- right mouse button is down
- 0
- right mouse button is not down
- Examples
- if (mouseright)
Win.Debug("Right")
- Checks if right mouse button is down & outputs a debug message if so.
- xcursor
- Description
- Retrieves the horizontal cursor position in pixels, where left edge of screen=0.
- Syntax
- Return Value
- (integer) x-coordinate of cursor
- Examples
- if (xcursor>500)
Win.Mouse("ab 100 100")
- Checks if x-coord of cursor is greater than 500px & if so moves the mouse to absolute screen position (100, 100).
- ycursor
- Description
- Retrieves the vertical cursor position in pixels, where top edge of screen=0.
- Syntax
- Return Value
- (integer) y-coordinate of cursor
- Examples
- if (ycursor<100)
Win.Mouse("ab 200 200")
- Checks if the y-coord of the cursor is less than 100, & if so moves the mouse to absolute screen position (200, 200).
- xmouse
- Description
- Retrieves the horizontal mouse position in pixels, where left edge of screen=0.
- Syntax
- Return Value
- (integer) x-coordinate of mouse
- Examples
- if (xmouse>500)
Win.Mouse("ab 100 100")
- Checks if x-coord of mouse is greater than 500px & if so moves the mouse to absolute screen position (100, 100).
- ymouse
- Description
- Retrieves the vertical mouse position in pixels, where top edge of screen=0.
- Syntax
- Return Value
- (integer) y-coordinate of mouse
- Examples
- if (ymouse<100)
Win.Mouse("ab 200 200")
- Checks if the y-coord of the mouse is less than 100, & if so moves the mouse to absolute screen position (200, 200).
- Multimedia
- cdcurtrack
- Description
- Syntax
- Return Value
- (integer) current CD track number
- Examples
- if (cdcurtrack == 11)
Win.Debug("top song")
- cdlasttrack
- Description
- Number of the previous CD track.
- Syntax
- Return Value
- (integer) previous CD track number
- Examples
- if (cdlasttrack == 1)
Win.Debug("top song")
- mci
- Description
- MCI provides applications with device-independent capabilities for controlling audio and visual peripherals, and recording multimedia resource files.
- Syntax
- mci("cmd deviceId parameters flags")
- Parameters
- cmd
- (string) the MCI command to use
- Note that each command has its own parameters (which also vary according to device) & is not necessarily supported by all multimedia devices.
- See the MCI Commands QuickRef below for more information.
- deviceId
- (string) device id, or drive letter
- Possible Values
- cdaudio
- dat
- digitalvideo
- other
- overlay
- scanner
- sequencer
- vcr
- videodisc
- waveaudio
- a device alias set with:
- mci("set [device] alias [deviceAlias] shareable")
- where:
- [device] is the full device type
- [deviceAlias] is the new alias
- parameters
- (string) any parameters for the MCI command used in cmd
- flags
- (string) wait, notify or test flag
- Optional.
- Possible Values
- notify
- wait
- notify wait
- wait notify
- test
- for digital-video and VCR devices only
- More Info
- MCI Commands QuickRef
- Commands (A-Q)
- break
- Description
- Specifies a key to abort a command that was invoked using the "wait" flag.
- Used By
- This is a MCI system command, interpreted directly by MCI.
- Syntax
- mci("break deviceId virtKey[ flags]")
- Return Value
- More Information
- capability
- Description
- Requests information about a particular capability of a device.
- Used By
- Syntax
- mci("capability deviceId request[ flags]")
- Return Value
- A string, with contents dependent on the request type.
- More Information
- capture
- Description
- Copies the contents of the frame buffer and stores it in the specified file.
- Used By
- Syntax
- mci("capture deviceId captureFlags[ flags]")
- Return Value
- More Information
- close
- Description
- Closes the device or file and any associated resources.
- Used By
- Syntax
- mci("close deviceId[ flags]")
- Return Value
- More Information
- configure
- Description
- Displays a dialog box used to configure the device.
- Used By
- Syntax
- mci("configure deviceId[ flags]")
- Return Value
- More Information
- copy
- Description
- Copies data to the clipboard.
- Used By
- Syntax
- mci("copy deviceId item[ flags]")
- Return Value
- More Information
- cue
- Description
- Prepares for playing or recording.
- Used By
- Digital-video, VCR, and waveform-audio devices.
- Syntax
- mci("cue deviceId inOutTo flags")
- Return Value
- More Information
- cut
- Description
- Removes data from the workspace and copies it to the clipboard.
- Used By
- Syntax
- mci("cut deviceId item[ flags]")
- Return Value
- More Information
- delete
- Description
- Deletes a data segment from a file.
- Used By
- Digital-video and waveform-audio devices.
- Syntax
- mci("delete deviceId position[ flags]")
- Return Value
- More Information
- escape
- Description
- Sends device-specific information to a device.
- Used By
- Syntax
- mci("escape deviceId escapeStr[ flags]")
- Return Value
- More Information
- freeze
- Description
- Freezes video input or video output on a VCR, or disables video acquisition to the frame buffer.
- Used By
- Digital-video, video-overlay, and VCR devices
- Syntax
- mci("freeze deviceId freezeFlags[ flags]")
- Return Value
- More Information
- index
- Description
- Controls a VCR's on-screen display.
- Used By
- Syntax
- mci("index deviceId indexFlags[ flags]")
- Return Value
- More Information
- info
- Description
- Retrieves a hardware description from a device.
- Used By
- Syntax
- mci("info deviceId infoType[ flags]")
- Return Value
- More Information
- list
- Description
- Determines the number and types of video and audio inputs.
- Used By
- Digital-video and VCR devices.
- Syntax
- mci("list deviceId listFlags[ flags]")
- Return Value
- More Information
- load
- Description
- Loads a file in a device-specific format.
- Used By
- Digital-video and video-overlay devices.
- Syntax
- mci("load deviceId filepos[ flags]")
- Return Value
- More Information
- mark
- Description
- Controls recording and erasing of marks on the videotape.
- Used By
- Syntax
- mci("mark deviceId markFlag[ flags]")
- Return Value
- More Information
- monitor
- Description
- Specifies the presentation source.
- Used By
- Syntax
- mci("monitor deviceId monitorFlags[ flags]")
- Return Value
- More Information
- open
- Description
- Used By
- Syntax
- mci("open deviceId openFlags[ flags]")
- Return Value
- More Information
- paste
- Description
- copies the contents of the clipboard into the workspace.
- Used By
- Syntax
- mci("paste deviceId item[ flags]")
- Return Value
- More Information
- pause
- Description
- Pauses playing or recording.
- Used By
- CD audio, digital-video, MIDI sequencer, VCR, videodisc, and waveform-audio devices.
- Syntax
- mci("pause deviceId[ flags]")
- Return Value
- More Information
- play
- Description
- Used By
- CD audio, digital-video, MIDI sequencer, videodisc, VCR, and waveform-audio devices.
- Syntax
- mci("play deviceId playFlags[ flags]")
- Return Value
- More Information
- put
- Description
- Defines the area of the source image and destination window used for display.
- Used By
- Digital-video and video-overlay devices.
- Syntax
- mci("put deviceId regions[ flags]")
- Return Value
- More Information
- quality
- Description
- Defines a custom quality level for either audio, video or still image data compression.
- Used By
- Syntax
- mci("quality deviceId qualityFlags[ flags]")
- Return Value
- More Information
- Commands (R-Z)
- realize
- Description
- Instructs a device to select and realize its palette into the display context of the displayed window.
- Used By
- Syntax
- mci("realize deviceId palette[ flags]")
- Return Value
- More Information
- record
- Description
- Used By
- VCR and waveform-audio devices.
- Syntax
- mci("record deviceId recordFlags[ flags]")
- Return Value
- More Information
- reserve
- Description
- Allocates contiguous disk space for the device instance's workspace.
- Used By
- Syntax
- mci("reserve deviceId reserveFlags[ flags]")
- Return Value
- More Information
- restore
- Description
- Copies a still image from a file to the frame buffer.
- Reverse of the capture command.
- Used By
- Syntax
- mci("restore deviceId restoreFlags[ flags]")
- Return Value
- More Information
- resume
- Description
- Continues playing or recording on a device that has been paused using the pause command.
- Used By
- Digital-video, VCR, and waveform-audio devices.
- Syntax
- mci("resume deviceId[ flags]")
- Return Value
- More Information
- save
- Description
- Used By
- Video-overlay and waveform-audio devices.
- Syntax
- mci("save deviceId filename[ flags]")
- Return Value
- More Information
- seek
- Description
- Moves to the specified position and stops.
- Used By
- CD audio, digital-video, MIDI sequencer, VCR, videodisc, and waveform-audio devices.
- Syntax
- mci("seek deviceId seekFlags[ flags]")
- Return Value
- More Information
- set
- Description
- Establishes control settings for the device.
- Used By
- CD audio, digital-video, MIDI sequencer, VCR, videodisc, video-overlay, and waveform-audio devices.
- Syntax
- mci("set deviceId setting[ flags]")
- Return Value
- More Information
- setaudio
- Description
- Sets values associated with audio playback and capture.
- Used By
- Digital-video and VCR devices.
- Syntax
- mci("setaudio deviceId audio[ flags]")
- Return Value
- More Information
- settimecode
- Description
- Enables or disables timecode recording for a VCR.
- Used By
- Syntax
- mci("settimecode deviceId timeCode[ flags]")
- Return Value
- More Information
- settuner
- Description
- Changes the current tuner or the channel setting of the current tuner.
- Used By
- Syntax
- mci("settuner deviceId tuner[ flags]")
- Return Value
- More Information
- setvideo
- Description
- Sets values associated with video playback and capture.
- Used By
- Digital-video and VCR devices.
- Syntax
- mci("setvideo deviceId video[ flags]")
- Return Value
- More Information
- signal
- Description
- Identifies a specified position in the workspace by sending the application an MM_MCISIGNAL message.
- Used By
- Syntax
- mci("signal deviceId signalFlags[ flags]")
- Return Value
- More Information
- spin
- Description
- Starts spinning a disc or stops the disc from spinning.
- Used By
- Syntax
- mci("spin deviceId upDown[ flags]")
- Return Value
- More Information
- status
- Description
- Requests status information from a device.
- Used By
- Syntax
- mci("status deviceId request[ flags]")
- Return Value
- More Information
- step
- Description
- Steps the play one or more frames forward or reverse. The default action is to step forward one frame.
- Used By
- Digital-video, VCR, and CAV-format videodisc devices.
- Syntax
- mci("step deviceId stepFlags[ flags]")
- Return Value
- More Information
- stop
- Description
- Stops playback or recording.
- Used By
- CD audio, digital-video, MIDI sequencer, videodisc, VCR, and waveform-audio devices.
- Syntax
- mci("stop deviceId stopFlags
- Return Value
- More Information
- sysinfo
- Description
- Retrieves MCI system information.
- Used By
- MCI system command, interpreted directly by MCI.
- Syntax
- mci("sysinfo deviceId request[ flag]")
- Return Value
- More Information
- undo
- Description
- Reverses the action taken by the most recent successful copy, cut, delete, undo, or paste command.
- Used By
- Syntax
- mci("undo deviceId[ flags]")
- Return Value
- More Information
- unfreeze
- Description
- Reenables video acquisition to the frame buffer after it has been disabled by the freeze command.
- Used By
- Digital-video, VCR, and video-overlay devices.
- Syntax
- mci("unfreeze deviceId unfreezeFlag[ flags]")
- Return Value
- More Information
- update
- Description
- Repaints the current frame into the specified device context (DC).
- Used By
- Syntax
- mci("update deviceId hdc[ flags]")
- Return Value
- More Information
- where
- Description
- Retrieves the rectangle specifying the source or destination area.
- Used By
- Digital-video, and video-overlay devices.
- Syntax
- mci("where deviceId requestRect[ flags]")
- Return Value
- More Information
- window
- Description
- Controls the display window.
- Used By
- Digital-video, and video-overlay devices.
- Syntax
- mci("window deviceId windowFlags[ flags]")
- Return Value
- More Information
- Commands by Device
- CD Audio Command Set
- break
- capability
- close
- info
- open
- pause
- play
- resume
- seek
- set
- status
- stop
- sysinfo
- Digital-Video Command Set
- break
- capability
- capture
- close
- configure
- copy
- cue
- cut
- delete
- freeze
- info
- list
- load
- monitor
- open
- paste
- pause
- play
- put
- quality
- realize
- record
- reserve
- restore
- resume
- save
- seek
- set
- setaudio
- setvideo
- signal
- status
- step
- stop
- sysinfo
- undo
- unfreeze
- update
- where
- window
- MIDI Sequencer Command Set
- break
- capability
- close
- info
- open
- pause
- play
- record
- resume
- save
- seek
- set
- status
- stop
- sysinfo
- VCR Command Set
- break
- capability
- cue
- freeze
- index
- info
- list
- mark
- pause
- play
- record
- resume
- seek
- set
- setaudio
- settimecode
- settuner
- setvideo
- status
- step
- stop
- sysinfo
- unfreeze
- Videodisc Command Set
- break
- capability
- close
- escape
- info
- open
- pause
- play
- resume
- seek
- set
- spin
- status
- step
- stop
- sysinfo
- Video-Overlay Command Set
- break
- capability
- close
- freeze
- info
- load
- open
- put
- save
- set
- status
- sysinfo
- unfreeze
- where
- window
- Waveform-Audio Command Set
- break
- capability
- close
- cue
- delete
- info
- open
- pause
- play
- record
- resume
- save
- seek
- set
- status
- stop
- sysinfo
- Parameters
- No explanation of parameters is given here, however, a link is included to each command's information on Microsoft's web site.
- Return Value
- The mci() function may sometimes return a value, depending on the particular MCI command & parameters used.
- Examples
- mci("open d: type cdaudio")
- Initialises CDAudio drive.
- mci("set cd door open")
- Opens the door of the CD drive of alias "cd".
- global v = vec.createFromLines("can eject\ncan play\ncan record\ncan save\ncompound device\ndevice type\nhas audio\nhas video\nuses files")
mci("open cdaudio alias cd shareable")
for (local i=0; i<v.length(); i=i+1)
win.debug(v[i], "=", mci("capability cd "++v[i]) )
endfor
- This script creates a vector containing all the applicable flags for a device of type "CD Audio", then checks each capability against the target device (a CD Audio device aliased "cd" here) & outputs the results to a debug window.
- See Also
- muted
- Description
- Checks whether the sound is muted (off) or not.
- Syntax
- Return Value
- Examples
- if (muted)
; pump up the volume
- volume
- Description
- Retrieves the current master volume setting (0-255).
- Syntax
- Return Value
- (integer) current master volume setting, from 0-255
- Examples
- Number
- random
- Description
- Generates a random integer between 0 and n-1.
- Syntax
- Parameters
- n
- (integer) upper limit for return value
- Return Value
- (integer) the random number generated
- Examples
- for (i=0; i<5; i=i+1)
Win.Debug( random(21) )
endfor
- Outputs 5 random numbers between 0 & 20 (inclusive) to a debug window.
- PowerPro
- disk
- Description
- Retrieves the letter of the disk from which PowerPro was run.
- Syntax
- Return Value
- (string) a single uppercase letter representing the disk
- Examples
- lastbuttontype
- Description
- Stores the type of the last bar button pressed.
- Syntax
- Return Value
- (integer) type of button pressed
- Examples
- if (lastbuttontype == 2)
; do something
- pcfname
- Description
- Retrieves the filename & extension of the current PowerPro configuration file.
- Syntax
- Return Value
- (string) filename including .pcf extension
- Examples
- pprofolder
- Description
- Retrieves the PowerPro configuration folder, including the terminating "\".
- Syntax
- Return Value
- (string) PowerPro config folder path
- Examples
- do("notepad", pprofolder++"ErrorLog.txt")
- When the command is parsed, the 2nd parameter for do() becomes "c:/path/to/PowerPro/ErrorLog.txt"
- Notes
- The PowerPro configuration folder is the folder in which the pproconf.pcf file is stored.
- pproflag
- Description
- Retrieves the value of the specified PowerPro flag.
- Syntax
- Parameters
- n
- (integer) target flag number
- Return Value
- Examples
- if (pproflag(2)) do
.someScript(1)
else
.anotherScript(0)
endif
- Runs one of 2 scripts based on the value of the 2nd PowerPro flag.
- pproversion
- Description
- Retrieves the installed PowerPro version as a 4-digit integer.
- Syntax
- Return Value
- (integer) installed PowerPro version
- Examples
- if (pproversion > 4.0) do
; something
else
; do something else
endif
SendMessage- Description
- Global variable that holds the result, if any, of the last Window.SendMessage() or Window.PostMessage() call.
- Syntax
- Return Value
- (string) result of the last Window.SendMessage() or Window.PostMessage() call
Examples
what sort of result
- StandardConfiguration
- Description
- Retrieves status of "Use standard configuration" checkbox in PPCD > Setup > Advanced Setup > Configuration.
- Syntax
- Return Value
- (boolean)
- 1
- "Use standard configuration" is checked
- 0
- "Use standard configuration" is not checked
- Examples
- if (not StandardConfiguration)
Win.Debug( "Note that this is not the standard config" )
SubBarName- Description
- Retrieves the name of the current subbar.
- Syntax
- Return Value
- (string) current subbar name
- Examples
Notes
Always returns a subbar name, altho not necessarily last one pressed or currently visible subbar..?
- Scripts
- scriptfolder
- Description
- Retrieves the folder path of the currently executing script.
- Syntax
- Return Value
- Examples
- Win.Debug( scriptfolder )
- scriptname
- Description
- Retrieves the name of the currently executing script.
- Syntax
- Return Value
- Examples
- scriptpath
- Description
- Retrieves the default PowerPro script path as set by most recent *Script Path call.
- Syntax
- Return Value
- Examples
- Strings
- case
- Description
- Changes the case of letters in a string according to specified format.
- Syntax
- Parameters
- keyword
- (string) sets case format for str
- Possible Values
- "acronym"
- creates an acronym from the first character of each word in str
- "lower"
- makes all letters lowercase
- "sentence"
- capitalises the first character of each sentence in str & makes all the rest lowercase
- "title"
- capitalises the first character of each word in str
- "upper"
- makes all letters uppercase
- str
- (string) target string to be amended
- Return Value
- (string) the resultant string
- Examples
- case("lower", "AbcDEf")
- case("upper", "AbcDEf")
- case("title", "each WORD capital")
- yields "Each Word Capital"
- case("sentence", "Just the firST")
- local timezone = "Easter Standard Time"
case("acronym", timezone)
- esc
- Description
- Applies escape character processing based on a specified character to a string.
- Syntax
- Parameters
- str
- c
- (string) a single character to be used as the escape character
- Return Value
- (string) the parsed string
- Examples
- local s = esc(?+the quick brown fox said:|n"hey there"+,?+|+)
win.debug(s)
- Uses "|" as the escape character with the string:
the quick brown fox said:|n"hey there"
to produce the multi-lined string:
the quick brown fox said:
"hey there"
- eval
- Description
- Evaluates a string as an expression & returns the results.
- Syntax
- Parameters
- str
- (string) the expression to evaluate
- Examples
- local s = pickstring(allglobals, "pick one")
win.debug(s, "=", eval(s))
- Displays a dialog for selection of a global variable, then outputs the selected variable's name & value to a debug window.
- Notes
- Eval allows you to build expressions as strings and then evaluate them.
- fill
- Description
- Pads a number or string with another string.
- Creates a string of length no less than the first string, with the ending characters set by the second number or string.
- Syntax
- Parameters
- sPadding
- (string) the padding string
- chars
- (string/integer) the string or number to be padded
- Return Value
- (string) the resultant string
- Examples
- fill("***///", "a")
- fill("***///", "hello")
- fill ("0000", 12)
- Notes
- Be careful not to forget the double quotes around the sPadding parameter when using purely numeric strings.
This:
fill("0000", 12)
does not return the same as:
fill(0000, 12)
In the latter, sPadding = 0, not "0000".
- index
- Description
- Finds the 1st instance of a string in another string.
- Not case sensitive.
- Syntax
- Parameters
- haystack
- (string) string to search
- needle
- (string) string being searched for
- Return Value
- (integer) either:
- n
- needle starts at position n in haystack
- 0
- Example
- index( "To be or not to be", "be")
- looking for the index of the first instance of "be"
- yields 4
- join
- Description
- Joins two strings.
- Equivalent to using the concatenation symbol, ++.
- Syntax
- Parameters
- str1, str2
- (string) the 2 strings to join
- Return Value
- (string/integer) the resultant string/integer
- Examples
- join("abc", "defg")
- join(22, 44)
- length
- Description
- Calculates the length of a string.
- Syntax
- Parameters
- Return Value
- (integer) number of characters in the string
- Examples
- line
- Description
- Works with a multi-lined string, returning either the number of lines, or the full contents of one specific line in the string.
- Syntax
- Parameters
- str
- n
- (integer) determines what to return
- Possible Values
- 0
- Returns the number of lines in string str.
- i = line(str, 0)
- 0 < n <= line(str,0)
- If n = 1 or more, the function returns the nth line of string str.
- Lines start at 1.
- s = line(str, n)
- line(str,0) < n
- If n is greater than the number of lines in string str, an empty string is returned.
- Return Value
- Either:
- (integer) the number of lines in the string
- (string) the nth line of the string
- Examples
- Win.Debug(line("this is\ra multi-line\rstring",0))
- Outputs the number of lines in the provided string: 3
- Win.Debug(line("this is\ra multi-line\rstring",2))
- Outputs the 2nd line of the provided string: "a multi-line"
- Win.Debug(line("this is\ra multi-line\rstring",4))
- Outputs an empty string ("") as 4 is greater than the number of lines in the string.
- Notes
- A line break may be represented in a string by any of:
\r
\n
\r\n
\n\r
- max
- Description
- Calculates the maximum of two values.
- Syntax
- Parameters
- val1, val2
- (string/integer) the 2 string or numerical values to compare
- Return Value
- (string/integer) the highest value
- Examples
- Notes
- A string will always be higher than an integer.
- A string starting with a lowercase letter will always be higher than a string starting with an uppercase letter.
- min
- Description
- Calculates the minimum of two values.
- Syntax
- Parameters
- val1, val2
- (string/integer) the 2 string or numerical values to compare
- Return Value
- (string/integer) the lowest value
- Examples
- Win.Debug( min("abc", "ABC") )
- Notes
- An integer value will always be lower than a string.
- A string starting with an uppercase letter will always be lower than a string starting with a lowercase letter.
- remove
- Description
- Removes a variable number of characters from a string.
- Syntax
- Parameters
- str
- num
- (integer) number of characters to remove
- Possible Values
- positive number
- characters are removed from start of str
- negative number
- characters are removed from end of str
- Return Value
- (string) the resultant string
- Examples
- remove("abcd", 2)
- removes 2 characters from the start of the string
- yields "cd"
- remove("abcd", -3)
- removes 3 characters from the end of the string
- yields "a"
- repeat
- Description
- Returns the string formed by repeating the first argument n times.
- Syntax
- Parameters
- str
- n
- (integer) number of repetitions
- Return Value
- (string) the resultant string
- Examples
- local ln = repeat("-- ", 20)
Win.Debug(ln)
- replacechars
- Description
- Replaces either individual characters or a particular word in a string with another character or word.
- There are 2 formats for this function, which differ in the number of parameters (2 or 3). The format used determines whether the function will replace individual characters or a word.
- Syntax
- s = replacechars(str1, str2)
- Replaces individual character[s] in "str1", specified by characters in "str2", by another character, the last one in "str2".
- s = replacechars(str1, from, to)
- Replaces all occurrences of "from" in "str1" with "to".
- Parameters
- str1
- str2
- (string) replacement characters
- Must contain at least two characters for replacement to occur.
- 1st to 2nd-last character in str2:
- characters to replace in str1
- Last character in str2:
- from
- (string) word to be replaced
- to
- (string) replacement word
- Return Value
- (string) the processed string
- Examples
- local s = replacechars("xx.x.abc=*", ".=_" )
- 2 parameter format
- Produces: "xx_x_abc_*". The "_" has replaced all occurrences of "." or "=".
- local s = replacechars("quick brown fox", "fox", "guinea pig")
- 3 parameter format
- Produces: "quick brown guinea pig". "guinea pig" has replaced all occurrences of "fox".
- Notes
- Unlike other string functions, ReplaceChars is case sensitive.
- revindex
- Description
- Finds the index of the last occurrence of a string within another string.
- Syntax
- revindex(haystack, needle)
- Parameters
- haystack
- (string) string being searched
- needle
- (string) string to look for
- Return Value
- (integer) either:
- n
- index of last occurence of needle in haystack
- 0
- Notes
- revindex() is not case sensitive.
- Examples
- revindex( "c:/path/to/filname.txt", "/")
- looking for the index of the last forwardslash
- returns 11
- select
- Description
- Retrieves a variable number of characters from the start, middle, or end of a string.
- This function has 2 formats, with either 2 or 3 operands.
- Syntax
- select(str, num)
- Selects num characters from the start or end of str.
- select(str, start, end)
- Selects the characters from positions start to end inclusive in str.
- Parameters
- str
- (string) the target string
- num
- (integer) number of characters to retrieve
- Possible Values
- positive number
- characters are selected from start of string str
- negative number
- characters are selected from the end of string str
- start
- (integer) index of the first character in selection
- end
- (integer) index of the last character in selection
- Return Value
- (string) selected portion of the initial string
- Examples
- local s = select ("abcde", 3)
- Selects 3 chars from start of string & assigns them to "s".
- Yields "abc".
- local s = select ("abcde", -1)
- Selects 1 char from end of string & assigns it to "s".
- Yields "e".
- local s = select ( "abcde", 2, 4)
- Selects the 2nd through 4th chars & assigns them to "s".
- Yields "bcd".
- strcoll
- Description
- Compares two strings using the local collating sequence.
- Syntax
- Parameters
- str1, str2
- (string) the 2 strings to compare
- Return Value
- Examples
- local a, b, c
a = "something"
b = "something else"
c = "else"
Win.Debug( strcoll(a, b) )
Win.Debug( strcoll(b, a) )
Win.Debug( strcoll(a++c, b) )- Outputs -1, then 1, then 0.
- Notes
- This function is similar to stricoll() except that strcoll() does not ignore the case of letters.
- "the local collating sequence" means... ?
... The correct sort order for the user's system/locality?
- stricoll
- Description
- Compares two strings using local collating sequence, ignoring case of letters.
- Syntax
- Parameters
- Return Value
- Examples
- local a, b
a = "Aunt"
b = "aunt"
Win.Debug( strcoll(a, b) )
Win.Debug( stricoll(a, b) )- Outputs -1, then 0.
Note that:
- the 1st Win.Debug() call contains the strcoll() function, which does not ignore the case so compares their values & finds str2 greater.
- the 2nd Win.Debug() call contains the stricoll() function, which ignores case so declares the strings equal.
- Notes
- This function is similar to strcoll() except that stricoll() ignores letter case.
- Useful for comparing both numbers & strings.
- See Also
- translate
- Description
- Replaces characters in the target string with specified characters, according to the mapping between the characters of the 2nd & 3rd parameters.
- Syntax
- Parameters
- str
- from
- (string) characters to be replaced
- to
- (string) replacement characters
- Return Value
- (string) the translated string
- Examples
- local s = translate("alphabeta", abc", "xyz")
- Yields "xlphxyetx", because:
- "a" is replaced with "x"
- "b" is replaced with "y"
- "c" is replaced with "z"
- local s1, s2
s1=translate(anystring, "abcdefghijklmnopqrstuvwxyz", "nopqrstuvwxyabcdefghijklmz")
s2=translate(s1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "NOPQRSTUVWXYABCDEFGHIJKLMZ")
- Sets s2 to ROT13 encoding of the string in variable anystring.
- Notes
- Similar to replacechars() except that translate() allows multiple characters to be changed.
- See Also
- trim
- Description
- Removes specified characters from the start or end of a string.
- Syntax
- Parameters
- s1
- chars
- (string) the characters to remove
- n
- (integer) place to remove from
- Possible Values
- 1
- 2
- 3
- removes from start and end
- Return Value
- (string) the trimmed string
- Examples
- local s = trim(sTarget,"0123456789", 1)
- Removes all digits from the start of the string in variable "sTarget".
- local s = trim(" foo ", " ", 3)
- Removes blanks from both ends of the string " foo ", returning "foo".
- word
- Description
- Scans a string and returns either:
- the total number of words in the string.
- the word at the specified index.
- Syntax
- Parameters
- str
- (string) space-separated string
- n
- (integer) index of the item to return
- Possible Values
- 0
- returns the total number of words
- n>0
- Return Value
- Returns either:
- (string) the nth word
- (integer) total number of words
- Examples
- local sList, i, han
sList = window("visiblewindow", "*")
for (i=1; i<=word(sList,0); i=i+1)
han = word(sList, i)
win.debug(win.caption(han))
endfor
- Outputs a list of window captions from open windows, using the "word" function in both its formats to work through the list of handles.
- System
- acdc
- Description
- Checks if the system is running on AC (electricity) or DC (battery) power.
- Syntax
- Return Value
- (string) either:
- "A"
- running on electricity (AC)
- "D"
- Examples
- batterypercent
- Description
- Retrieves the percentage of battery power left.
- Syntax
- Return Value
- (integer) percentage of battery power left
- Examples
- Win.Debug("battery left:", batterypercent, "%")
- cpu
- Description
- Retrieves the current CPU usage value.
- For Windows 98 only.
- Syntax
- Return Value
- Examples
- defaultprinter
- Description
- Retrieves the name of the default printer.
- Syntax
- Return Value
- (string) default printer name
- Examples
- if (defaultprinter != "Lab2")
messagebox("error ok", "Default printer missing", "Printer Error")
- Compares the name of the default printer to "Lab2", & shows an error message if not as expected.
Notes
You can view the printers list with:
Menu.Folder("printers")
10-dec-05:
In main help, it says that the default printer can be set by right-clicking on the above menu -- this is not working like that here, instead, right-clicking shows the selected printer's context menu.
20-apr-2006:
Right-clicking the printers menu is throwing an error at the moment.
- env
- Description
- Retrieves the value of a system environment variable.
- Syntax
- Parameters
- varname
- (string) name of the target environment variable
- Return Value
- (string) value of the target environment variable
- Examples
- Win.Debug( env("path") )
- Outputs to a debug window the contents of the system environment variable named "Path".
- gdi
- Description
- Retrieves the current GDI resources value.
- Windows 95/98 only.
- Syntax
- Return Value
- (integer) current GDI resources in use
- Examples
- pmem
- Description
- Retrieves the current percentage of free memory.
- Syntax
- Return Value
- (number) current percent free memory
- Examples
- processcount
- Description
- Retrieves a count of the active processes currently running.
- Syntax
- Return Value
- (number) number of active processes
- Examples
- Win.Debug( processcount )
- threadcount
- Description
- Retrieves a count of the current active threads.
- Syntax
- Return Value
- (number) number of active threads
- Examples
- uptime
- Description
- Retrieves the number of seconds Windows has been running.
- Syntax
- Return Value
- (number) number of seconds
- Examples
- Win.Debug( "Windows has been running for", uptime/60, "minutes." )
- user
- Description
- Retrieves the current User resources value.
- Windows 95/98 only.
- Syntax
- Return Value
- (number) user resources currently in use
- Examples
- username
- Description
- Retrieves the name of the currently signed-on user.
- Syntax
- Return Value
- (string) name of the current Windows user
- Examples
- local u = username
messagebox("info ok", "Hello, "++u++"!", "Welcome")
- Shows a message dialog welcoming the current logged on user.
- Time
- formattime
- Description
- Returns the input time, converted to the specified format.
- parameters
- "hhmmss" is the time using 24 hour clock
- "format string" can be any combination of:
- Syntax
- formattime(sFormat,sTime)
- Parameters
- sFormat
- (string) Output format to give the time, specified as a string made up of any combination of the following case-sensitive values. Accepts literal characters, also.
- Possible Values
- h
- Hours with no leading zero for single-digit hours
- 12-hour clock
- hh
- Hours with leading zero for single-digit hours
- 12-hour clock
- H
- Hours with no leading zero for single-digit hours
- 24-hour clock
- HH
- Hours with leading zero for single-digit hours
- 24-hour clock
- m
- Minutes with no leading zero for single-digit minutes
- mm
- Minutes with leading zero for single-digit minutes
- s
- Seconds with no leading zero for single-digit seconds
- ss
- Seconds with leading zero for single-digit seconds
- t
- One character time marker string, such as A or P
- tt
- Multicharacter time marker string, such as AM or PM (depending on your regional settings)
- sTime
- (string) the time to format, specified as a 24-hour clock time string: "hhmmss"
- Return Value
- (string) the formatted time
- Examples
- local t = formattime("h:mm:ss tt","140102")
- Puts "2:01:02 PM" into local variable t.
- time
- Description
- Retrieves the current time as 6 digit string in 24-hour clock time: "hhmmss"
- Syntax
- Return Value
- (string) the time, formatted as "hhmmss"
- Examples
- Win.Debug( time )
- Outputs the current time.
- Win.Debug( formattime("h:mm tt", time) )
- Outputs the current time, formatted as specified.
- timesec
- Description
- Retrieves the number of seconds since midnight January 1, 1970.
- Syntax
- Return Value
- (number) number of seconds
- Examples
- timezone
- Description
- Retrieves the name of the current timezone.
- Syntax
- Return Value
- (string) name of the timezone
- Examples
- Win.Debug( timezone )
- Outputs the name of the current timezone (e.g. "AUS Eastern Standard Time").
- xTime
- Description
- Retrieves the current time in Control Panel Regional Time format.
- Syntax
- Return Value
- (string) the current time in Regional format
- Examples
- Timers
- lastidletime
- Description
- Retrieves the length of the last idle period in which an alarm occurred.
- Syntax
- Return Value
- (number) length of time in seconds
- Examples
- Win.Debug( lastidletime )
- perfcount
- Description
- Returns the Windows performance counter.
- Syntax
- Return Value
- (number) the current setting of the Windows performance counter, as a 64-bit integer
- Examples
- Notes
- perfcount uses 64-bit integers, so the int64 plugin must be used to work with them.
See: PPSR > Plugins > Int64 - The functions perfcount & perffreq can be used to do very accurate timing.
- See Also
- perffreq
- Description
- The frequency, in counts per second, that perfcount is incremented.
- Syntax
- Return Value
- (number) 64-bit integer representing the increment frequency
- Examples
- Notes
- The functions perfcount & perffreq can be used to do very accurate timing.
- perffreq uses 64-bit integers, so the int64 plugin must be used to work with them.
- PPSR > Plugins > The Plugins > Int64
- See Also
- timer
- Description
- Retrieves the current value of the specified PowerPro timer.
- Syntax
- Parameters
- t
- (mixed) timer identifier
- Can be a:
- (string) letter (in quotes)
- (number) index of the timer (where a=1, b=2, ...)
- Return Value
- (number) current value of timer t
- Examples
- Win.Debug( timer("a") )
Win.Debug( timer(1) )
- These 2 lines will output the same thing to a debug window, as they are both checking the value of the same timer (timer "a" == timer 1).
- timerunning
- Description
- Checks if the specified timer is running
- Syntax
- Parameters
- t
- (mixed) timer identifier
- Can be a:
- (string) letter (in quotes)
- (number) index of the timer (where a=1, b=2, ...)
- Return Value
- Examples
- Win.Debug( timerrunning("a") )
- Checks if timer A is running, and outputs 1 (yes) or 0 (no) accordingly.
- Variables
- allglobals
- Description
- Retrieves the names of all global variables, as a multi-line string with one variable name per line.
- Syntax
- Return Value
- (string) multi-line string containing the names of all global variables
- Examples
- global alpha, beta, gamma
Win.Debug( allglobals )
- If there were no other global variables set, this example would output: "alpha\rbeta\rgamma\r"
- allstatics
- Description
- Retrieves the names of all static variables, as a multi-line string with one variable name per line.
- Syntax
- Return Value
- (string) multi-line string containing the names of all static variables
- Examples
- static alpha, beta, gamma
Win.Debug( allstatics )
- If there were no other static variables set, this example would output: "alpha\rbeta\rgamma\r"
- arg
- Description
- Returns nth argument in the call to the script.
Only used inside a script called with arguments;
- Retrieves the value of the specified argument passed in the script call.
- Syntax
- Parameters
- n
- (number) index of the target argument
- Possible Values
- 0
- arg(0) retrieves the total number of arguments passed
- n>0
- retrieves the value of arg(n)
- Return Value
- (mixed) the argument's value
- Examples
- With the following call:
.myScript("name", 33)
arg(1) = "name"
arg(2) = 33
arg(0) = 2 (the number of arguments)
- args
- Description
- Shortcut function used to assign arguments from a script call to up to 23 local variables.
- Syntax
- args a, b, c, ...
- args a b c ...
- Parameters
- a, b, c, ...
- (string) the local variable names, separated by commas or spaces
- Examples
- args alpha, beta, gamma
- This command is exactly equivalent to:
local alpha = arg(1)
local beta = arg(2)
local gamma= arg(3)
- Notes
- The first variable is always assigned arg(1).
- assign
- Description
- [s=] assign(var1,var2) - Assigns second string to variable name given by first string. eg assign("var1", "xx") assigns "xx" to var1. Then assign(var1, "000") would assign "000" to variable xx. Result of operation is the assigned value (ie second value).
- Syntax
- Parameters
- varname
- (string) name of the variable to receive the value
- val
- (mixed) value to be assigned to the var "varname"
- Return Value
- (mixed) returns the value assigned
- Examples
- local s = assign("test", 42)
Win.Debug( test )
Win.Debug( s )
- Assigns the variable "test" a value of 42.
- Also returns 42 to the local variable "s".
- VDesks
- alldesknames
- Description
- Retrieves the names of all desktops, as a multi-line string with one name per line.
- Syntax
- Return Value
- (string) multi-line string with one desktop name per line
- Examples
- deskempty
- Description
- Checks if the current virtual desktop is empty.
- Syntax
- Return Value
- Examples
- deskname
- Description
- Retrieves the name of the current virtual desktop.
- Syntax
- Return Value
- (string) name of the current vdesk
- Examples
- desknum
- Description
- Retrieves the number of the current virtual desktop.
- Syntax
- Return Value
- (string) number of the current vdesk
- Examples
- vdeskempty
- Description
- Checks if the specified vdesk exists, and whether or not it is empty.
- Syntax
- Parameters
- vdeskname
- (string) name of the target desktop to check
- Possible Values
- n
- single digit n for the nth desktop
- (string)
- desktop name
- not case-sensitive
- ""
- empty string for current desktop
- 0
- for list of locked windows
- Return Value
- Examples
- Win.Debug( vdeskempty( "Work" ) )
- Checks if the desktop named "Work" is empty/exists.
- Win.Debug( vdeskempty( 1 ) )
- Checks if the first desktop is empty/exists.
- Win.Debug( vdeskempty( x2 ) )
- Checks if the desktop whose name is stored in variable "x2" is empty/exists.
- vdeskhaswindow
- Description
- Checks if the specified vdesk exists, and if so, if it contains a window matching the given captionlist.
- Syntax
- vdeskhaswindow(vdesk, cl)
- Parameters
- vdesk
- (mixed) target vdesk
- Possible Values
- n
- single digit n for the nth desktop
- (string)
- desktop name
- not case-sensitive
- ""
- empty string for current desktop
- 0
- for list of locked windows
- cl
- Return Value
- (number)
- 0
- vdesk does not contain a window matching cl
- 1
- vdesk contains a window matching cl
- 2
- Examples
- Win.Debug( vdeskhaswindow("myDesk", "*metapad") )
- Checks if the desktop named "myDesk" contains a Metapad window.
- Windows, Tasks
- activewindow
- Description
- Checks if the supplied caption list matches the currently active window.
- Syntax
- Parameters
- Return Value
- b
- (boolean) whether cl matches active window
- Possible Values
- 1
- cl matches currently active window
- 0
- cl does not match currently active window
- Examples
- if (activewindow("*notepad*"))
Win.Keys(clip)
- Checks if notepad is the active window, & if so, types in the first line of the clipboard.
- anywindow
- Description
- Checks if the supplied caption list matches any window, visible or hidden.
- Syntax
- Parameters
- Return Value
- b
- (boolean) whether cl matches a window
- Possible Values
- 1
- 0
- cl does not match any window
- Examples
- if (anywindow("*freemind*"))
Win.Show("*freemind*")
- Checks if a FreeMind window is open, & if so, brings it to the front.
- caption
- Description
- Retrieves the caption [title] of the current foreground window.
- Syntax
- Return Value
- Examples
- Win.Debug("active window is ", caption)
- captionunder
- Description
- Retrieves the caption [title] of window under the mouse.
- Syntax
- Return Value
- Examples
- Win.Debug("caption of window under mouse is: ", captionunder)
- currentdir
- Description
- Retrieves the path to working folder of current foreground window.
- Syntax
- Return Value
- s
- (string) the working folder path
- Examples
- Win.Debug(caption++"'s working folder: ", currentdir)
- Outputs the caption & working directory of the current foreground window.
- exefilename
- Description
- Retrieves the name of the current foreground window's parent exe file, without path or extension.
- Syntax
- Return Value
- s
- (string) the name of the exe file
- Examples
- Win.Debug("caption, "belongs to exe file:", exefilename)
- exefullpath
- Description
- Retrieves the full path to current foreground window's parent exe file.
- Syntax
- Return Value
- s
- (string) the program path
- Examples
- Win.Debug(exefilename, "resides at", exefullpath)
- Outputs something like:
"CurrentPgm resides at C:\full\path\to\CurrentPgm.exe"
depending on the foreground window at time of execution.
- Notes
- The full path string returned includes drive, path, filename & extension.
- lastactivehandle
- Description
- Retrieves the handle of the last window selected by an active button.
- Syntax
- Return Value
- n
- (integer) the window handle
- Examples
- Win.Debug("last program clicked:", win.exename(lastactivehandle))
- Notes
- An active button is a button on a bar configured to show active window buttons. Configuring is done in the Command List Properties dialog from the PPCD.
- lastautorunhandle
- Description
- Retrieves the handle of the last window used by an autorun item.
- Syntax
- Return Value
- n
- (integer) the window handle
- Examples
- local nm = win.exename(lastautorunhandle)
if (nm=="" || nm==NULL) do
Win.Debug("no windows have been used by the autorun list yet")
else
Win.Debug("last window used by autorun list was", nm)
endif
- visiblewindow
- Description
- Checks if the supplied caption list matches any visible window.
- Syntax
- Return Value
- b
- (boolean) whether cl matches a visible window
- Possible Values
- 1
- 0
- cl does not match any visible window
- Examples
- if (not visiblewindow("*metapad*")) do
do(?"c:\program files\metapad\metapad.exe")
else
Win.Keys("{to *metapad*}foobar")
endif
- Checks if a visible Metapad window exists, & if not, starts Metapad.
- window
- Description
- This function can act in 2 ways:
- Retrieves certain window information for the condition and caption list supplied.
- Checks if a certain condition is true or false for windows identified by the caption list provided.
- Syntax
- window(condition, target)
- Parameters
- condition
- (string) condition to check
- Possible values
- "anywindow"
- Returns the handle, or a list of handles, of windows that match cl.
- Equivalent to Win.HandleList(cl, 1)
- h = window("anywindow", "*metapad")
- "bottom"
- Returns bottom window coordinate of first window matching cl.
- Equivalent to Win.Bottom(cl).
- n = window("anywindow", "*metapad")
- "caption"
- Returns the caption (title) of the first window matching cl.
- Equivalent to Win.Caption(cl).
- s = window("caption", "*metapad")
- "exefullpath"
- Returns the full path to the exe of the first window matching cl.
- Equivalent to Win.ExePath(cl).
- s = window("exefullpath", "*metapad")
- "exename"
- Returns the path (minus extension but including filename) to the exe of the first window matching cl.
- Note this is not equivalent to Win.ExeName(cl), which only returns the exe's filename, not the path.
- s = window("exename", "*metapad")
- "firstwindow"
- Returns the handle of the first window that matches cl.
- Equivalent to Win.Handle(cl).
- h = window("firstwindow", "*metapad")
- "height"
- Returns the height of the first window that matches cl.
- Equivalent to Win.Height(cl).
- n = window("height", "*metapad")
- "left"
- Returns the left coordinate of the first window that matches cl.
- Equivalent to Win.Left(cl).
- n = window("left", "*metapad")
- "maximized"
- Returns the maximised state of the first window that matches cl.
- Equivalent to Win.Maxxed(cl).
- b = window("maximized", "*metapad")
- "minimized"
- Returns the minimised state of the first window that matches cl.
- Equivalent to Win.Minned(cl).
- b = window("minimized", "*metapad")
- "right"
- Returns the right coordinate of the first window that matches cl.
- Equivalent to Win.Right(cl).
- n = window("right", "*metapad")
- "top"
- Returns the top coordinate of the first window that matches cl.
- Equivalent to Win.Top(cl).
- n = window("top", "*metapad")
- "topmost"
- Returns the topmost state of the first window that matches cl.
- Equivalent to Win.Topmost(cl).
- b = window("topmost", "*metapad")
- "visible"
- Returns the visible state of the first window that matches cl.
- Equivalent to Win.Visible(cl).
- b = window("visible", "*metapad")
- "visiblewindow"
- Returns a blank-separated string of window handles of visible windows matching caption list.
- Equivalent to Win.HandleList(cl, 0)
- s = window("visiblewindow", "*metapad")
- "vdesk"
- Returns a blank-separated list of handles of the windows on vdeskname.
- s = window("vdesk", vdeskname)
- "width"
- Returns the width of the first window that matches cl.
- Equivalent to Win.Width(cl).
- n = window("width", "*metapad")
- target
- Possible values
- a captionlist
- a vdeskname
- or a keyword:
- "active"
- select the foreground window
- "taskbar"
- "under"
- select the window under the mouse
- Return Value
- (string/integer/boolean) return value depends on the condition parameter
- For conditions that return a window handle, if no windows match the criteria, 0 (zero) is returned.
- Examples
- if (window("topmost", "xplorer*"))
Win.Debug("the xplorer2 window is on top")
- checks if window with caption "xplorer*" is topmost
& shows debug message if not
- s = window("vdesk", "VirtualDesk2")
- returns a list of handles of all the windows on vdesk named "VirtualDesk2"
- Alpha-Order
- A - D
- _file_
- _PickedLine_
- acdc
- activewindow
- alldesknames
- allglobals
- allstatics
- alt
- anywindow
- arg
- assign
- batterypercent
- browserDomain
- browserSubdomain
- browserURL
- caption
- captionunder
- case
- cdcurtrack
- cdlasttrack
- clip
- cliptrackon
- Context
- ContextList
- cpu
- ctrl
- currentdir
- defaultprinter
- date
- dayofweek
- dayofyear
- deskempty
- deskname
- desknum
- dialupname
- disk
- diskspace
- do
- dunidle
- dunrate
- E - K
- env
- esc
- eval
- exefilename
- exefullpath
- e.g. to get the folder from which powerpro is launched:
file.folder(window("exefullpath","=powerpro"))
- David Troesch, PP list, 1/9/05
- expr
- filemenu
- fill
- formatdate
- formattime
- gdi
- if
- ifelse
- index
- input
- inputcancel
- inputcolor
- inputdate
- inputdatetime
- inputdefault
- inputdialog
- inputfolder
- inputpath
- inputpathmulti
- inputtext
- join
- keylog
- keylogfile
- L - R
- lastactivehandle
- lastautorunhandle
- lastclipname
- lastclippath
- lastidletime
- length
- line
- longdate
- max
- [r=] mci(string)
- messagebox
- min
- modem
- mounted
- mouseleft
- mousemiddle
- mouseright
- muted
- not
- paper
- pcfname
- n64 = perfcount
- n64 = perffreq
- pickfile
- pickstring
- pmem
- pproflag
- pprofolder
- pproversion
- processcount
- random
- readline
- recylceItems
- recycleSize
- remove
- repeat
- replacechars
- revindex
- S - Z
- saver
- saveractive
- saverenabled
- savertime
- scriptfolder
- scriptname
- scriptpath
- select
- SendMessage
- shift
- shortdate
- StandardConfiguration
- strcoll
- stricoll
- SubBarName
- threadcount
- time
- timesec
- timer
- timerunning
- timezone
- uptime
- unixdate
- user
- username
- validpath
- vdeskempty
- vdeskhaswindow
- visiblewindow
- volume
- win
- window
- word
- xmouse
- xscreen
- Screen width in pixels
- Current horizontal resolution
- xTime
- ymouse
- Description
- Screen height in pixels.
- Current vertical resolution.
- Syntax
- Examples
- ; get half the screen width
iScrHalf = xscreen/2
- Notes
- yscreen
- Standalone
- assign
- do
- esc
- Description
- Applies escape character processing to a string, based on specified character
- Syntax
- Parameters
- Examples
- Event.Create(10, 30, esc("Event.DestroyThis\r",?"\")++".MyScript", anywindow("=notepad"))
- esc("This is my string with \n",?"\")
- eval
- inputdialog
- mci
- messagebox
forgotten what i mean be standalone..? all built-n functions are standalone..?!