This plugin requires Girder version 3.2.9 or later.
MOUSE_Relative( int BUTTONS, int X, int Y, int WHEEL )
Moves the mouse pointer (relative to the last location) and updates the wheel position and button state based on the supplied parameters
MOUSE_Absolute( int BUTTONS, unsigned int X, unsigned int Y, int WHEEL )
Moves the mouse pointer (in absolute screen coordinates) and updates the wheel position and button state based on the supplied parameters. Absolute co-ordinates should be scaled to the screen dimensions. Use MOUSE_PixelsToAbs() on the X and Y value to translate to the correct number system. See the example below.
MOUSE_RelativeAlt( int BUTTONS, int X, int Y, int WHEEL )
Moves the mouse pointer (relative to the last location) and updates the wheel position and button state based on the supplied parameters using an alternative procedure
MOUSE_AbsoluteAlt( int BUTTONS, unsigned int X, unsigned int Y, int WHEEL )
Moves the mouse pointer (in absolute screen coordinates) and updates the wheel position and button state based on the supplied parameters using an alternative procedure. Absolute co-ordinates should be scaled to the screen dimensions. Use MOUSE_PixelsToAbs() on the X and Y value to translate to the correct number system. See the example below.
NOTE: For the MOUSE_* functions above, the value of BUTTONS can be any meaningful combination of the following values -
2 - left button down
4 - left button up
8 - right button down
16 - right button up
32 - middle button down
64 - middle button upDO NOT use a button up and button down (for the same button) in a single call.
NOTE: For the MOUSE_* functions above, the value of WHEEL specifies the amount of wheel movement. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user.
int X, int Y = MOUSE_GetPosition( )
Returns the current X and Y coordinates of the mouse pointer (in absolute pixel screen coordinates)
int Z = MOUSE_PixelsToAbs(int Pixels, int RelativeTo)
Returns a value that can be passed to the MOUSE_Absolute() or MOUSE_AbsoluteAlt() routine for the X and Y co-ordinate.
EXAMPLE:
-- this LUA code retrieves the current mouse location (in pixels) and sets the mouse location +10 in each direction
-- this is the same as MOUSE_Relative(0, 10, 10, 0)-- assumes the screen width 1280
sw = 1280
-- assumes the screen height 1024
sh = 1024x,y = MOUSE_GetPosition()
MOUSE_Absolute(0, MOUSE_PixelsToAbs(x+10, sw), MOUSE_PixelsToAbs(y+10, sh), 0)
int DELTATICKS, int CURRENTTICKS = TIME_GetTicks( [ int TICKS ] )
Returns the number of milliseconds that have elapsed since the system was started (CURRENTTICKS) and the difference (DELTATICKS) between CURRENTTICKS and the passed in optional parameter (TICKS)
NOTE: If the optional parameter (TICKS) is omitted, 0 is used in the difference calculation and DELTATICKS == CURRENTTICKS.
NOTE: CURRENTTICKS will wrap around to zero if the system is run continuously for ~49.7 days.
TIME_Sleep( int MILLISEC )
Stops execution of this script for the supplied number of milliseconds
NOTE: The range of MILLISEC is 0 <= MILLISEC <= 1000 milliseconds (1000 milliseconds == 1 second).
WINDOWS_SetDesktopBitmap ( string FILENAME )
Sets the ini file or registry entry and sends a broadcast message to set the desktop bitmap.
int RETVAL = WINDOWS_MessageBox ( string TEXT [, string CAPTION [, int TYPE]] )
Displays a message box with the provided parameters. CAPTION and TYPE are optional and will have default values (CAPTION = "LUAMessageBox" and TYPE = 0).
TYPE can be any combination of the following. Choose at most one from each of the next three tables.
NOTE: You do NOT have to choose one from each table!
Button choices:
Value Meaning 0 The message box contains one push button: OK ( This is the default) 1 The message box contains two push buttons: OK and Cancel 2 The message box contains three push buttons: Abort, Retry, and Ignore 3 The message box contains three push buttons: Yes, No, and Cancel 4 The message box contains two push buttons: Yes and No 5 The message box contains two push buttons: Retry and Cancel Icon choices:
Value Meaning 16 A stop sign icon appears in the message box 32 A question-mark icon appears in the message box 48 An exclamation-point icon appears in the message box 64 An icon consisting of a lowercase letter i in a circle appears in the message box Default button choices:
Value Meaning 0 The first button is the default button 256 The second button is the default button 512 The third button is the default button 768 The fourth button is the default button For example, the TYPE value of 291 will cause a message box that contains the yes/no/cancel buttons (3), the question-mark icon (32) and the default button of no, the second button (256) to be displayed. (256+32+3 = 291)
The RETVAL value returned will be one of the following:
Value Meaning 1 OK button was selected 2 Cancel button was selected 3 Abort button was selected 4 Retry button was selected 5 Ignore button was selected 6 Yes button was selected 7 No button was selected FOLDERWATCHER = WINDOWS_CreateFolderWatcher(string EventString, string FolderName, int WatchFlags, int Recursive)
Builds and returns a watcher object (FOLDERWATCHER) which causes the event string EventString to be sent to Girder when the right conditions are met. These conditions include the FolderName to watch, a Recursive flag (non-0 means include sub-folders) and one or more of the WatchFlags defined in the following table.
Value Meaning: Notify when ... 1 a file name changes 2 a folder name changes 4 a file (or folder) attribute changes 8 a file size changes 16 the last write date or time changes 256 a security attribute changes The FOLDERWATCHER object that is returned has a print() method that can be used to see what this particular object contains for debugging purposes. The output from the print() function will go to the Logger plugin window (if that plugin is installed and enabled)
NOTE: The returned FOLDERWATCHER object will be destroyed (no more events generated) if the variable containing it goes out of scope (is destroyed). If you want a FOLDERWATCHER object to survive the life of a subroutine,do not leave it in a local variable!
EXAMPLE:
-- Create a folder watcher and save it in the global variable fw
fw = WINDOWS_CreateFolderWatcher("EventString", "c:\\", 1, 0)-- print a folder watcher
fw:print()-- Destroy a folder watcher
fw = nil
int INDEX = LUA_Find( INPUT, table SEARCH )
Finds INPUT in the table SEARCH and returns the INDEX (if found) or nil.
RETURNVALUE = LUA_Find( INPUT, table SEARCH, table RETURN )
Finds INPUT in the table SEARCH and returns the RETURNVALUE associated with the index from the table RETURN (if found) or nil.
LUA_Parse( string INPUT, table OUTPUT [, string COMPARISON] )
Breaks the INPUT string at every occurrence of COMPARISON and places the resulting strings in OUTPUT.
NOTE: The optional parameter COMPARISON defaults to the space character.
LUA_EnableReflexiveDebugInterface()
Opens and turns on all the built-in debug functions of LUA debug library. Please heed the warning from the LUA On-line Reference:
"You should exert great care when using this library. The functions provided here should be used exclusively for debugging and similar tasks (e.g., profiling). Please resist the temptation to use them as a usual programming tool. They are slow and violate some (otherwise) secure aspects of the language (e.g., privacy of local variables). As a general rule, if your program does not need this library, do not open it."
WARNING: Editing the registry through this interface can cause EXTREMELY harmful effects on your PC. Please be careful.
REGISTRYOBJ = REGISTRY_CreateObject()
Creates a new registry object and returns it.
NOTE: The returned REGISTRYOBJ object will be destroyed if the variable containing it goes out of scope (is destroyed). If you want a REGISTRYOBJ object to survive the life of a subroutine,do not leave it in a local variable!
The REGISTRYOBJ object has 9 methods: CreateKey, OpenKey, CloseKey, ListKeys, DeleteKey, Read, Write, Delete, List
NOTE: In the following, ROOTNAME must be one of the following strings - HKLM, HKCU, HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER
string ERROR = REGISTRYOBJ.OpenKey(string ROOTNAME, string KEYNAME)
Attempts to open the key, KEYNAME, in the ROOTNAME registry branch. If successful, ERROR will be nil. For any errors, ERROR will be a formatted error string.
The key will be opened in read only mode.
string ERROR = REGISTRYOBJ.CreateKey(string ROOTNAME, string KEYNAME)
Attempts to create the key, KEYNAME, in the ROOTNAME registry branch. If successful, ERROR will be nil. For any errors, ERROR will be a formatted error string.
Any existing key will be opened.
The key will be created/opened in read/write mode.
int ERROR = REGISTRYOBJ.CloseKey()
Attempts to close the registry key and free resources. If successful, ERROR will be nil. For any errors, ERROR will be a formatted error string. Closing an unopened registry object is NOT an error.
KEYS, int ERROR = REGISTRYOBJ.ListKeys()
Attempts to enumerate all the keys in the currently opened registry key. If successful, ERROR will be 0 and KEYS will be a table filled (1 to KEYS.n) with the key names. If no keys exist, ERROR will be 0 and KEYS.n will be 0. For any errors, ERROR will be non-0 and KEYS will be a formatted error string.
string ERROR = REGISTRYOBJ.DeleteKey(string KEYNAME)
Attempts to delete the KEYNAME key in the currently opened registry key. If successful, ERROR will be nil. For any errors, ERROR will be a formatted error string.
VALUE, int ERROR = REGISTRYOBJ.Read(string VALUENAME)
Attempts to read from the VALUENAME and place the results in VALUE. If successful, ERROR will be 0 and VALUE will contain the value read. If VALUENAME does not exist, ERROR will be 2 and VALUE will be "Key value not found". For any other errors, ERROR will be the returned Win32 error value (or -1) and VALUE will be a formatted error string.
string ERROR = REGISTRYOBJ.Write(string VALUENAME, string VALUE) or
string ERROR = REGISTRYOBJ.Write(string VALUENAME, int VALUE)
Attempts to write VALUE to the VALUENAME. If successful, ERROR will be nil. For any errors, ERROR will be a formatted error string.
VALUES, int ERROR = REGISTRYOBJ.List()
Attempts to enumerate all the values in the currently opened registry key. If successful, ERROR will be 0 and VALUES will be a table filled (1 to VALUES.n) with the value names. If no values exist, ERROR will be 0 and VALUES.n will be 0. For any errors, ERROR will be non-0 and VALUES will be a formatted error string.
string ERROR = REGISTRYOBJ.Delete(string VALUENAME)
Attempts to delete the VALUENAME value in the currently opened registry key. If successful, ERROR will be nil. For any errors, ERROR will be a formatted error string.
TIMEROBJ = TIMER_CreateObject()
Creates a new timer object and returns it.
NOTE: The returned TIMEROBJ object will be destroyed and all resources released if the variable containing it goes out of scope (is destroyed). If you want a TIMEROBJ object to survive the life of a subroutine, do not leave it in a local variable!
The TIMEROBJ object has 4 methods: Create, Destroy, Arm, Cancel
string ERROR = TIMEROBJ.Create(string START, string TRIGGER, string CANCEL, int RECURRING)
Attempts to assign resources for this timer object. The variables START, TRIGGER and CANCEL should be fully formed LUA statements. The START routine will be called as soon as the timer object is armed. The TRIGGER routine will be called when the timeout expires. The CANCEL routine will be called if the timer object is canceled. If the variable RECURRING is non-0, the timer will be re-armed after every call to the TRIGGER routine until canceled or destroyed.
If successful, ERROR will be nil. For any errors, ERROR will be a formatted error string.
TIMEROBJ.Destroy()
Releases all resources for this timer object.
string ERROR = TIMEROBJ.Arm(int MILLISECONDS)
Causes the START routine to be called and schedules the TRIGGER to be called in MILLISECONDS amount of time.
If successful, ERROR will be nil. For any errors, ERROR will be a formatted error string.
TIMEROBJ.Cancel()
Stops the TRIGGER routine from being called and causes the CANCEL routine to be called.
NOTE: A thread of execution is spawned for every timer object that has the Create method called. The Destroy method releases the thread of execution. Destroying the timer object variable (by going out of scope or having the last reference set to nil) will also release the thread of execution.
Please report problems or ask questions on the Girder Community Forums.