About this plugin
This plugin have a miscellanea collection of useful actions that cannot be missing on your publications. The plugin have some common and more or less advanced Strings actions, Publication actions, System actions, Files actions, Monitor actions, Dialogs actions, Graphics actions and more! Useful everytime and everyday.
The plugin has dozens of string related actions; extend and enhance native NeoBook actions like "SetVar", "ClearVariables" and "SaveVariables"; allow you to deal with files and directories; contain useful system power related actions; can make screen or desktop captures and many, many more. Really this plugin can be considerer a very good swiss army knife.
Thirparty
This plugin are imposible without the aid of this people:
Thanks a lot!
Find if a text begin with another. This action store in the result variable True if the provide text begin with another, or False if not.
Find if a text end with another. This action store in the result variable True if the provide text end with another, or False if not.
Quoted a string using the provide quote char. This quote char is a simple quote, for example ("), and this action enclose the string with the quote char, and also dupe all quote chars found into the strings. The quoted string is stored in the result variable.
Dequoted a previously quoted string, removing the quote char at the beginning and the end of the string and the quote chars repetitions on the string. The unquoted string is stored in the result variable.
This action reverse a string byte by byte. For example the string "ABC" is reversed as "CBA".
Get a portion of a string counting from any part of the string to any part of the string.
Providing some values separated by "|" char, this action return a random value choosed from the provided values.
This action take a Boolean value and store in the result value the "True string" if the value is True, and the "False" string if the value is "False". Note that this action only considerer "True" and "Checked" for True values, so, in any other case the action store the "False string" in the result variable.
This action append some string to a source string only if the source string is not end with the append value. For example, if you try to append "A" to the string "AA", this action return "AA". If you try to append "B" to the string "AA" this action return the string "AAB".
This action prepend some string to a source string only if the source string is not begin with the prepend value. For example, if you try to prepend "A" to the string "AA", this action return "AA". If you try to prepend "B" to the string "AA" this action return the string "BAA".
Extract only the allowed chars from an string. Provide the source string, and the allowed chars, for example, "abc", to extract from the string just the "abc" chars and no others. The result variable store the extracted allowed chars.
Extract only the alpha characters from an string. The result variable store the extracted alphas characters.
Extract only the number from an string. For example, suposing this string: "ab82101a92s", the result variable store the number: "8210192".
Extract only the alphanumeric characters from an string. This eliminate any other non alphanumeric chars from the string. The result variable store the extracted alphanumeric characters.
Search a string from a source string or file and return the line number of the search string is found. Providing a source string or a file path, this action find for the search query and return the first line number in wich the search query is found in the result variable, or "False" if the query string is not found.
Search a string from a source string or file and return the lines numbers of the search string is found. Providing a source string or a file path, this action find for the search query and return all lines numbers in wich the search query is found. The result variable store an zero indexed Array with an element for every line number, and the result variable count store the number of items stored on the result variable.
Search a string from a source string beginning from the end and return the position (if found) from the beginning. The result variable store the position (from the beginning) of the matched string if foun, or zero if the string is not found.
This action enhance the native SetVar NeoBook action in various ways. The variable names must be comma separated and the values are separated by "|" (pipe char) or other string specified by the values separator variable.
Here is how this action work:
npSetVar "A" "1" ""
Act just like SetVar NeoBook native action: assign the value "1" to the variable "A".
npSetVar "A,B" "1" ""
Assign the value "1" to the variables "A" and "B".
npSetVar "A,B" "1|2" ""
Assign the value "1" to the variable "A", and the value "2" to the variable "B".
npSetVar "A" "1|2" ""
Assign an Array with the elements "1" and "2" to the variable "A".
npSetVar "A,B" "1|2|3" ""
Assign an Array with the elements "1", "2" and "3" to the "A" and "B" variables.
This action can execute another NeoBook (or NeoBook plugin) action based on their prototype. For example, you can provide an string like: GoSub "MySub" in order to execute the NeoBook action "GoSub" with the "MySub" parameter.
This action act equal that npExecAction, but take a file as parameters, executing an action for every file lines. In other words, you can provide a file containing one NeoBook action per line in order to be executed sequentially.
Clear one or more than one (even all) NeoBook publication variables, even previously defined variables. You can pass to this action a string containing one or more variable names separated by commas or the "|" (pipe) character. No matter about spaces. Caution: if you pass an emtpy string all publication variables must be cleared!
.Clear all variables npClearVariables "" .Clear a, b, c and d variables npClearVariables "a,b,c,d" .This also work npClearVariables "a, b, c,d " .And this work too npClearVariables "a, b | c,d "
This action allow you to use "prefixed" identifiers in order to clear it. For example:
.Clear variables prefixed by "prefix_" npClearVariables "prefix_*" .Clear variables prefixed by "prefix_*" and "other_*" npClearVariables "prefix_*, other_*"
However, note that NeoBook allow "*" in the variables identifiers. So, if you habitually use "*" in variables identifiers take precaution when use this action to clear prefixed variables.
Save one or more variables into a file. This action work like the NeoBook native "SaveVariables", but allow you to save one or more variables, not ever all. Just provided the variables identifiers you want to save comma separated or "|" (pipe character) separated. If you not provide any identifier the action act just like "ClearVariables" action.
Note that with this action is possible to use prefixed identifiers. Just end the prefix with an "*". For example:
.Save prefix_* variables npSaveVariables "prefix_*" .Save variables prefixed by "prefix_*" and "other_*" npSaveVariables "prefix_*, other_*" .Save variables prefixed by "_*" and "ME" variable npSaveVariables "ME,_*"
Hide the main publication window itself and from the Windows taskbar. See also npShowPublication.
Show the main publication window itself and on the Windows taskbar. See also npHidePublication.
Hide the publication button from the Windows taskbar. See also npShowOnTaskbar.
Show the publication button from the Windows taskbar. See also npHideFromTaskbar.
Get a list with all publication subroutines. The List variable store an array with the available subroutines. The List count variable store the total number of items in the array. So, is easy to iterate the subroutines with a code like this:
npSubroutineList "[SubroutineList]" "[SubroutineListCount]" Loop "0" "[SubroutineListCount] - 1" "[LoopPos]" AlertBox "Subroutine" "[SubroutineList[LoopPos]]" EndLoop
If you want to find if a subroutine exists or not, considerer to use the npSubroutineExists action instead.
Find if the specified subroutine exists or not. The result variable store "True" if the subroutine exists, or "False" if not. Take a look also at the npSubroutineList action.
Use this action to get the full path of your publication parent, that is, the program who launch your publication. The Is Parent variable store "True" if the parent is the real parent (*), and the Path variable store the full path of the parent executable file. The result variable store "True" if everything is OK, or "False" when not. In this last case you can get more information on [LastError] variable.
* Since this action is based on the parent process ID, and Windows reuse this ID's, this action can return the full path not for the real publication parent, but for the process who have the parent process ID. This action is recomended to use just when the publication start, in order to have more possibilities to get the real publication parent.
Here is a sample of this action:
npPublicationParent "[IsParent]" "[ParentPath]" "[Result]" If "[Result]" "=" "True" If "[IsParent]" "=" "True" AlertBox "Info" "The parent path is: [ParentPath]" Else AlertBox "Info" "The parent process has changed" EndIf Else AlertBox "Error" "[LastError]" EndIf
Align to right a publication main menu item or items. Specify the menu item index (start by zero) to start the alignment. You can specify "0" to align all menu items, "1" to align items from "1", etc. The result variable contain "True" if everything is OK, or "False" if not. In this last case the [LastError] variable contain information about the error.
Align to left a previously right aligned publication main menu item or items. Specify the menu item index (start by zero) to start the alignment. You can specify "0" to align all menu items, "1" to align items from "1", etc. The result variable contain "True" if everything is OK, or "False" if not. In this last case the [LastError] variable contain information about the error.
Open a CHM help file within the help TOC (Table of Contents). The result variable contain "True" if everything is OK, or "False" if not. In this last case the [LastError] variable contain information about the error.
Open a CHM help file within the help index. Optionally you can provide a word to be showed on the help index. The result variable contain "True" if everything is OK, or "False" if not. In this last case the [LastError] variable contain information about the error.
Open a CHM help file within the help search. The result variable contain "True" if everything is OK, or "False" if not. In this last case the [LastError] variable contain information about the error.
Open a CHM help file within the a specific theme. Theme variable can contain a theme ID or a theme URL. If the variable contain an integer the plugin try to open the help file within the provided theme ID, in other case the plugin try to open the file within provided theme URL. The result variable contain "True" if everything is OK, or "False" if not. In this last case the [LastError] variable contain information about the error.
Close a previously openned CHM help file. The result variable contain "True" if everything is OK, or "False" if not. In this last case the [LastError] variable contain information about the error.
This action show an standard Windows font dialog with an (optional) initial font selected. After the dialog as been executed the action store in the result variable the user selected font.
In fact this action is intended mainly to be use in conjuction with "SetObjectFont" NeoBook native action. The action result variable contain an Array of elements that corresponde with the needed params for "SetObjectFont" action. If the user cancel the font dialog the result variable contain "False".
An example of use of this action can be:
npFontDialog "Verdana|16|8,0,0|Bold+Underline+Strikeout" "[F]" If "[F]" "<>" "False" SetObjectFont "MyTextObject" "[F0]" "[F1]" "[F2]" "[F3]" "[F4]" EndIf
Show the standard Windows dialog for select colors. The action allow you to personalize the dialog in various ways.
You can set an (optional) initial color to be show in the dialog when its show. Also you can put an (optional) variable name for Custom Colors, to store in it the Custom colors saved by the users: when use the dialog again you can use this same variable in order to set the dialog Custom Colors.
Is possible to set one or more (optionals) available dialog options. Here we explain every of this option:
The action put in the result variable the color selected by the user in a NeoBook reusable format (RGB), so you can use this color value in other NeoBook native actions like "SetObjectFill". If the color dialog is cancel by the user the result variable contain "False".
Show the standard Windows dialog for select folders. The action allow you to personalize the dialog in various ways.
You can set an (optional) dialog title, and also a root directory. If you set a root directory the user can only select folders under the root directory. Also you can specify some dialog options, one or more at a time, and here is the description for everyone:
The action put in the result variable the directory or file path selected by the user. If the folder dialog is cancel by the user the result variable contain "False".
Show the standard Windows dialog to allow the user to choose one or more files. All arguments are optionals, even you need to get the dialog result into the result variable. You can indicate optionally a file name, to be show when open the dialog; specify a default extension (like "bmp"); specifiy an standard filter, like "BMP files|*.bmp|All files|*.*"; specify a filter index, for example, in the last filter you can select "All files" by default setting the filter index argument to "1"; specify a initial directory for the dialog; specify a title for the dialog; and finally, you can choose one or more of this dialog options:
The result variable contain the file choose by the user or "False" if user cancel the dialog. If "ofAllowMultiSelect" option is choosed, then the result variable is an Array containing the files selected by the user.
Show the standard Windows dialog to allow the user to select a place for a file. All arguments are optionals, even you need to get the dialog result into the result variable. You can indicate optionally a file name, to be show when open the dialog; specify a default extension (like "bmp"); specifiy an standard filter, like "BMP files|*.bmp|All files|*.*"; specify a filter index, for example, in the last filter you can select "All files" by default setting the filter index argument to "1"; specify a initial directory for the dialog; specify a title for the dialog; and finally, you can choose one or more of this dialog options:
The result variable contain the file place choose by the user or "False" if user cancel the dialog.
Please, see the npOpenFileDialog action. All arguments are the same, except that this dialogs show an image preview when needed.
Please, see the npSaveFileDialog action. All arguments are the same, except that this dialogs show an image preview when needed.
Show the standard Windows shell about dialog. Note that the icon is extracted from the publication executable. The result variable store the short path form or "False" if an error occur. See [LastError] for information about possible errors.
Shuts down all processes running in the logon session. Then it logs the user off. The result variable contain "True" if everything is OK, or "False" if not. In this last case the [LastError] variable contain information about the error.
The force flag can be one of this values, by default the plugin dont force the task.
Shuts down the system and turns off the power. The system must support the power-off feature. (See npCanPowerOff) The result variable contain "True" if everything is OK, or "False" if not. In this last case the [LastError] variable contain information about the error.
The force flag can be one of this values, by default the plugin dont force the task.
Shuts down the system and then restarts the system. The result variable contain "True" if everything is OK, or "False" if not. In this last case the [LastError] variable contain information about the error.
The force flag can be one of this values, by default the plugin dont force the task.
Shuts down the system and then restarts it, as well as any applications that have been registered for restart. The result variable contain "True" if everything is OK, or "False" if not. In this last case the [LastError] variable contain information about the error.
The force flag can be one of this values, by default the plugin dont force the task.
Shuts down the system to a point at which it is safe to turn off the power. All file buffers have been flushed to disk, and all running processes have stopped. The result variable contain "True" if everything is OK, or "False" if not. In this last case the [LastError] variable contain information about the error.
The force flag can be one of this values, by default the plugin dont force the task.
Suspends the system by shutting power down. The system enters in a suspend (sleep) state. (See npCanSuspend) The result variable contain "True" if everything is OK, or "False" if not. In this last case the [LastError] variable contain information about the error.
Suspends the system by shutting power down. The system enters in a hibernate state. (See npCanHibernate) The result variable contain "True" if everything is OK, or "False" if not. In this last case the [LastError] variable contain information about the error.
Find if the system can be suspend or not. The result variable contain "True" if system can be suspend, or "False" if not.
Find if the system can be power off or not. The result variable contain "True" if system can be power off, or "False" if not.
Find if the system can be hibernate or not. The result variable contain "True" if system can be hibernate, or "False" if not.
Retrieve the Windows System Error message from a System Error Code number. For information about System Error Codes follow this link. The result variable store the error message or "False", if some error occur. In this last case the [LastError] variable contain information about the error.
Disable Windows to enter on sleep mode and power off the display. This action is useful when you need to do some task without want that Windows enter on sleep mode, for example, if your application act like a video player. Call to npEnableSleep is recommended that after you do the tasks. The result variable store "True" if everything is OK, or "False" if not.
Enable Windows to enter on sleep mode and power off the display. Use this action after execute almost one time npDisableSleep. The result variable store "True" if everything is OK, or "False" if not.
Retrieve information about the system memory status. The result variable store an array with the following elements:
The result variable also can contain "False" if an error ocurr. In this case the [LastError] variable contain information about the error.
Use this action to make a Windows Shell Link or shortcut to a folder or a file. If the file is an executable program you can set some arguments to the shortcut. If this action has been executed store "True" in the result variable, or "False" if not: in this last case the [LastError] contain information about the error. See also npGetShortcut.
This action retrieve information from a Windows Shell Link or shorcut file. Providing a ".LNK" file path, the action store in the result variable a NeoBook array with this elements:
(1) This member be one of the following values: SW_SHOWNORMAL, SW_SHOWMAXIMIZED, SW_SHOWMINNOACTIVE or SW_UNKNOW.
Note that some of this array members may cannot be set, because the shorcut dont provide the appropiate information. The result variable also can store "False" if an error ocurr. In this case the [LastError] variable contain information about the error.
See also npAddShortcut.
This action can kill all the instances of a program, based on the executable file name, including the ".exe" extension, for example, to kill all Windows NotePad instances, use the "notepad.exe" as the executable action param. The result variable store "True" if everything is OK, or "False" when not. In this case the [LastError] variable contain information about the error.
Warning: Killing a program can result in loss data, for example, if some text is on the NotePad and you kill them, the text is lossed, because the program don't ask the user if want to save the changes or not. So use this action carefully.
Try to refresh the Windows Desktop, like when a new file association is made or the F5 key is pressed. Note this action try some ways in order to do the task, but in fact is not a way to refresh the desktop in a just unique and clear way. So this action cannot guarantee finally the desktop are refresh.
Get the state of the CTRL, SHIFT and ALT keys, saving in the appropiate variable True if the key is hold down, or False when not. The result variable store "True" if everything is OK, or "False" in case of error. In this last case you can get more information on [LastError] variable.
Get the state of the Caps. lock, Bloq. Num. lock and Scroll lock keys saving in the specified variables "True" if the key are locked, or "False" when not. The result variable store "True" if everything is OK, or "False" in case of error. In this last case you can get more information on [LastError] variable.
Set the state of the Caps. lock, Bloq. Num. lock and Scroll lock keys. Specify "True" to set the keys "On" or "False" to set the keys "Off". The result variable store "True" if everything is OK, or "False" in case of error. In this last case you can get more information on [LastError] variable.
Send the appropriate Wake On Lan signal to the specified MAC address and computer port in order to wake the computer. Note this action need that the operating system and the hardware of the specified computer are ready to perform the Wake On Lan operation. The result variable store "True" if everything is OK, or "False" in case of error. In this last case you can get more information on [LastError] variable.
Get the number of network devices and MAC addresses for the specified machine. Let the machine empty to retrieve the MAC addresses for the host machine. The result variable store the number of computer network devices or "False", if cannot retrieve anyone. The addresses variable store a zero indexed Array with all the MAC addresses. The addresses count variable store the number of MAC address (or elements in the Array) availables.
.Get the MAC addresses for this machine npMacAddresses "" "[MacAddresses]" "[MacAddressesCount]" "[Result]" If "[Result]" "<>" "False" AlertBox "Info" "We have [Result] network devices" .Iterate over all MAC addresses found Loop "0" "[MacAddressesCount]-1" "[I]" ListBoxAddItem "MacAddressesListBox" "0" "[MacAddresses[I]]" EndLoop Else AlertBox "Info" "We have no network devices" EndIf
Find if the current publication is running with administrative privileges. The result variable store "True" if the user have administrative privileges or "False" if not.
Find if the installed Windows operating system is a 64 bits version or not. The result variable store "True" if our publication is executed in a Windows 64 system, or "False" when not, that is, when is executed in a Windows 32 system.
Blocks keyboard and mouse input events from reaching applications. Requires administrative privileges. See the npBlockInputEx action if you do not want to require such privileges. Set "Block it" to "True" to block the input or to "False" to unblock it. The result variable store "True" if everything is OK, or "False" in case of error. In this last case you can get more information on [LastError] variable.
Blocks keyboard and mouse input events from reaching applications. Do not requires administrative privileges. Probably the best way to block the user input is to use the npBlockInput action, but, since this action requires administrative privileges, this other action is intended to offer another possible solution, even when it's not all perfect. Set "Block it" to "True" to block the input or to "False" to unblock it. The result variable store "True" if everything is OK, or "False" if the block is yet performed and you try again, or if the block is not yet performed and you try to unblock it.
Get a bitmap shot of the currently active window and save it to the specified file path. The result variable contain "True" if everything is OK, or "False" if not.
Get a bitmap shot of a window based on their handle and save it to the specified file path. The result variable contain "True" if everything is OK, or "False" if not.
Get a bitmap shot of the entirely screen and save it to the specified file path. The result variable contain "True" if everything is OK, or "False" if not.
Get a bitmap shot of an arbitrary selected screen area. Use this action to allows the user to choose an arbitrary screen area portion to be saved as a bitmap. Choose the "selecting" lines color (red by default) and the "selected" lines color (lime by default). Specify the bitmap file path and if you want to capture the bitmap automatically when the mouse are released.
The Pen Size variable determine the size in pixels of the screen area selection lines. The Pen Style variable determine these lines style and can be one of this values: psSolid, psDash, psDot, psDashDot, psDashDotDot. The result variable store "True" if everything is OK, or "False" if not. In this last case see the [LastError] variable for more information.
If Autocapture is "False", then the user need to press the ENTER key or the CTRL + LEFT MOUSE combination in order to get the selected screen area bitmap. If Autocapture is "True", when the selected screen area is saved automatically when the user release the left mouse button. The user can cancel the screen shot using the ESCAPE key, and, if this is the case, the result variable store "Cancel" for your information.
Set the state of the display to low power. The result variable contain "True" if everything is OK, or "False" if not.
Set the state of the display powering on. The result variable contain "True" if everything is OK, or "False" if not.
This action allow you to determine the type of a system drive unit. The result variable store the drive type, or "False" if some error occurr. In this last case see the [LastError] variable for more information. The possible drive types are listed below:
Retrieve the Product ID of a drive, usually a USB drive. This action can retrieve the Product ID of a drive if available. The drive letter can be "A", "B", "C", etc. Note that not all drives provide their Product ID. The result variable store the Product ID of the drive or an empty string when not available. Also can store "False" in case of error. In this case the [LastError] variable store more information about the possible error.
Retrieve the Vendor ID of a drive, usually a USB drive. This action can retrieve the Vendor ID of a drive if available. The drive letter can be "A", "B", "C", etc. Note that not all drives provide their Vendor ID. The result variable store the Vendor ID of the drive or an empty string when not available. Also can store "False" in case of error. In this case the [LastError] variable store more information about the possible error.
Retrieve the serial number of a drive, usually a USB drive. This action can retrieve the serial number of a drive if available. The drive letter can be "A", "B", "C", etc. Note that not all drives provide their serial number. The result variable store the serial number of the drive or an empty string when not available. Also can store "False" in case of error. In this case the [LastError] variable store more information about the possible error.
Wipe a file writing random data the times you want and then deleting it from the file system. The result variable store "True" if everything is OK, or "False" on error. In this last case the [LastError] variable contain information about the error.
Retrieve the size (in bytes) of an existing file. The result variable store the bytes of the file, or "False" on error. In this last case the [LastError] variable contain information about the error. You can combine this action result with the npFormatBytesSize action.
Perform a file operation on the system. With this action you can copy, move, delete or rename one or more files or folders at a time, specifiying lot of options in order to control the file operation task.
First select from the list the file operation that you want to do. Then specify one or more of source items, that can be files or folders separated by "|" (pipe) character. Then specify one or more of target items, that can be files or folders separated by "|" (pipe) character. Note that this last param can be empty if you want to delete files or folders, for example.
Now select the optional dialog title and the result variable, that can contain three diferent values: "True" if everything is OK, "Cancel", if the user cancel the task, or "False" if some error occur. In this last case see the [LastError] variable for more information.
After this, you can choose one or more "operation flags" from the list. This "flags" is described below and determine the file operation behaviour:
Get a unique temporal file path, with or without an specific extension. Extension variable can be, for example, "bmp". Dot are not needed, but if you put one the action strip for you. The result variable store the temporal file path. Note this action dont create any file, just find for you a unique temporal file path that you can use when needed.
Get certain type or all available system drives units. The Drives variable store an Array with matched system drives units paths, like "C:\". The Drives count variable store the number of items in the Drives variable Array. See [LastError] for information about possible errors.
The Drive type param must be one of the following values: DRIVE_ALL, DRIVE_REMOVABLE, DRIVE_FIXED, DRIVE_REMOTE, DRIVE_CDROM, DRIVE_RAMDISK, DRIVE_UNKNOWN.
Converts the specified path to its long form. The result variable store the long path form or "False" if an error occur. See [LastError] for information about possible errors.
Retrieves the short path form of the specified path. The result variable store the short path form or "False" if an error occur. See [LastError] for information about possible errors.
Get the Windows localized type name of a file, folder or drive. The result variable store the Windows type name, for example, "Application", for an executable file, "Aplicación" in spanish, etc.
Find the file system used by a file, directory or drive. The result variable can store one of the following values: FAT, NTFS or CDFS.
This action retrieve the created, modified and last accessed dates of a file. The result variable store an array (zero indexed) with three elements:
The result variable also can store "False" if some error ocurr. In this last case the [LastError] can contain information about the error. With this action you can get the date formated, using theh Date format variable. This variable can contain one or more of this identifiers in order to format the date:
Set the created, modified and last accessed date of a file. Provide the file path you want to touch and encoded datetimes values for the accessed, last access and last write arguments. You can get these datetime values by using the plugin action npEncodeDateTime. If you want to change only one value of the file, just leave the others in blank (empty strings). The result variable store "True" if everything is OK, or "False" on error. In this last case the [LastError] variable contain information about the error.
Get the associated icon of a file, or the icon itself if the file is an executable file. You need to provide an existing source file, and the target file, wich is the ".ico" file that you wanted use to save the extracted icon. The result variable store "True" if everything is OK, or "False" on error. In this last case the [LastError] variable contain information about the error.
Convert an ICO file to a BMP file. This action can convert an ICO file to a BMP file. Even when the size is retrieved from the ICO, on my tests this action only can convert 32x32 ICO files, and others that contain other ICO sizes, can be converted to 32x32 BMP files in any cases, and with no transparency.
The result variable store "True" if everything is OK, or "False" on error. In this last case the [LastError] variable contain information about the error.
This action allow you to put on the Windows clipboard one or more files. You need to provide one or more absolute file paths, separated by the pipe char "|". Every application wich support the appropiate Windows API can later paste from clipboard the appropiate files, for example, you can use this action and then paste the file (using the CTRL + V hotkey) over the Windows Explorer. See also npFilesFromClipboard.
The result variable store "True" if everything is OK, or "False" on error. In this last case the [LastError] variable contain information about the error.
You can use this action in order to find if any file (file path) is on the clipboard. For example, when you copy files to the clipboard from the Windows Explorer, using this action you can retrieve the files from the clipboard. Also when you use npFilesToClipboard, you can retrieve the files copied to the clipboard with this action.
The list variable store an array with one or more elements, and every element is the absolute path to a file. The list count variable store the number of elements on the list variable, so is easy to iterate over the files saved on the clipboard, using a code like this:
npFilesFromClipboard "[Paths]" "[PathsCount]" If "[PathsCount]" ">=" "1" Loop "0" "[PathsCount] - 1" "[LoopPos]" AlertBox "Path" "[Paths[LoopPos]]" EndLoop EndIf
Get the appropiate formated string representation for bytes, KB, MB and GB. Fill the "Bytes" argument and then the result variable store the appropiate format string. The result variable also can store "False" if an error occur. In this last case you can get more information on [LastError] variable.
Get the free space in bytes for the specified drive unit letter and store it in the result variable. The result variable also can store "False" if an error occur. In this last case you can get more information on [LastError] variable.
Get the used space in bytes for the specified drive unit letter and store it in the result variable. The result variable also can store "False" if an error occur. In this last case you can get more information on [LastError] variable.
Get the total space in bytes for the specified drive unit letter and store it in the result variable. The result variable also can store "False" if an error occur. In this last case you can get more information on [LastError] variable.
Get the size in bytes of the specified directory. If the Recursive is a NeoBook boolean true value the action search also the size of the directory subfolders. The result variable store the size in bytes of the specified directory or "False" if an error occur. In this last case you can get more information on [LastError] variable.
Get the unique identifier for the specified file or directory path. This action is based upon the Windows API function GetFileInformationByHandle and can retrieve a unique identifier for a file or directory path. Specify the file or directory path and the optional identifiers separator. The result variable store the file or directory identifier joining the volume serial number, the low file index and the high file index, in this order. The result variable store "False" if an error occur. In this last case you can get more information on [LastError] variable.
Get the size in bytes of the specified directory. If the Recursive is a NeoBook boolean true value the action search also the size of the directory subfolders. The result variable store the size in bytes of the specified directory or "False" if an error occur. In this last case you can get more information on [LastError] variable.
Find the parent directory of a file or a folder. For example, the parent directory of this file: "C:\Windows\MyFile.exe" is "C:\Windows\". The parent directory of the folder "C:\Windows\System32\" is "C:\Windows\". Note this action return the parent folder event if the file or folder path not exists. The result variable store the parent directory of the specified file or folder.
Find if a directory is empty or not. The result variable store "True" if the directory is empty, or "False" if the directory is not empty (contain files or subfolders).
Retrieve the total of files (using file masks) of a directory optionally including also the subdirectories. The result variable store the number of files, or "False" if an error occur. In this last case you can get more information on [LastError] variable.
Find if a host is alive or not. Provide the host name, for example, "google.com", and the timeout (in milliseconds) you want to wait for a host response. The result variable store the time in milliseconds for the host response, or "False" if an error occur. In this last case you can get more information on [LastError] variable.
Encode a string to be use safely on an URL. The result variable store the encoded string. See also npUrlDecode.
Decode a previosly encoded string. The result variable store the decoded string. See also npUrlEncode.
Encode an string to their Base 64 representation. The result variable store the Base 64 encoded string or "False" if an error occur. In this last case you can get more information on [LastError] variable.
Decode a previosly Base 64 encoded string. The result variable store the Base 64 decoded string or "False" if an error occur. In this last case you can get more information on [LastError] variable.
Encode the provide file into their Base 64 representation. The result variable store the file Base 64 string or "False" if an error occur. In this last case you can get more information on [LastError] variable.
Decode a Base 64 string and save it to the specified file. Note you are responsible of the file extension. The result variable store "True" if everything is ok, or "False" if an error occur. In this last case you can get more information on [LastError] variable.
Set the user agent for the current Internet session. You can use this action to establish the user agent when you navigate a webpage using the NeoBook WebBrowser control, and, probably also take effect in other internet related actions. The result variable store "True" if everything is ok, or "False" if an error occur. In this last case you can get more information on [LastError] variable.
Set the proxy settings for the current Internet session. You can use this action to establish the user agent when you navigate a webpage using the NeoBook WebBrowser control, and, probably also take effect in other internet related actions. The result variable store "True" if everything is ok, or "False" if an error occur. In this last case you can get more information on [LastError] variable.
Hide the application caption (or title bar) of an application based on their main window handle. The result variable store "True" if everything is ok, or "False" if an error occur. In this last case you can get more information on [LastError] variable.
If you wanted to hide your publication caption, just use this action with the [WinHandle] NeoBook global variable.
Show the application caption (or title bar) of an application based on their main window handle. The result variable store "True" if everything is ok, or "False" if an error occur. In this last case you can get more information on [LastError] variable.
If you wanted to show your publication caption, just use this action with the [WinHandle] NeoBook global variable.
Use this action to retrieve a window position, commonly an application position. For example, you can use this action like this, in order to retrieve your own publication position:
npGetWindowPos "[WinHandle]" "[XPos]" "[YPos]" "[Result]"
The X Pos variable store the X position of the window, relative to the screen. The Y Pos variable store the Y position of the window. The result variable store "True" if everything is ok, or "False" if an error occur. In this last case you can get more information on [LastError] variable.
Use this action to set the position of a window, commonly an application position. For example, you can use this action like this, in order to set your own publication position:
npSetWindowPos "[WinHandle]" "10" "10" "[Result]"
The result variable store "True" if everything is ok, or "False" if an error occur. In this last case you can get more information on [LastError] variable.
Use this action to retrieve a window size, commonly an application size. For example, you can use this action like this, in order to retrieve your own publication size:
npGetWindowSize "[WinHandle]" "[Width]" "[Height]" "[Result]"
The Width variable store the width of the window, relative to the screen. The Height variable store the height of the window. The result variable store "True" if everything is ok, or "False" if an error occur. In this last case you can get more information on [LastError] variable.
Use this action to set the size of a window, commonly an application size. For example, you can use this action like this, in order to set your own publication size:
npSetWindowSize "[WinHandle]" "300" "200" "[Result]"
The result variable store "True" if everything is ok, or "False" if an error occur. In this last case you can get more information on [LastError] variable.
Use this action to set the caption buttons state of a window, commonly an application caption buttons state. For example, you can use this action like this, in order to set your own publication minimize button disabled:
npWindowButtons "[WinHandle]" "False" "True" "True" "[Result]"
Note that, if you disable both minimize and maximize buttons, this buttons dissapear from the window caption, not only appear disabled. The result variable store "True" if everything is ok, or "False" if an error occur. In this last case you can get more information on [LastError] variable.
Use this action to set the "on top" state of a window. Specify the window handle and set the window on top argument to "True" to set the window "on top". Set the argument to "False" to remove the "on top" state from the specified window. The result variable store "True" if everything is ok, or "False" if an error occur. In this last case you can get more information on [LastError] variable.
Minimize an application window based on their handle. The result variable store "True" if everything is ok, or "False" if an error occur. In this last case you can get more information on [LastError] variable.
Restore a previously minimized application window based on their handle. The result variable store "True" if everything is ok, or "False" if an error occur. In this last case you can get more information on [LastError] variable.
This action allow you to make N times left, right or middle mouse clicks on every point of the screen coordinates in wich the cursor is. You can specify the number of clicks to make, and the mouse button you want to simulate: "mbLeft", "mbRight" or "mbMiddle". Note if you choose more than one click, for example, 2, the plugin automatically delay the appropiate "doubleclicktime" system value between clicks.
The result variable store "True" if everything is OK, or "False" if an error occur. In this last case you can get more information on [LastError] variable.
This action retrieve the cursor position using screen coordinates, in contrast with "GetCursorPos" native NeoBook action, wich retrieve the cursor position using the publication coordinates. The X variable store the X cursor position on the screen, and the Y variable store the Y cursor position on the screen.
This action allow you to set the cursor position using screen coordinates, instead of native "SetMousePos" NeoBook action, wich use the publication coordinates. You can specity the X and Y new mouse cursor position. The result variable store "True" if everything is OK, or "False" if an error occur. In this last case you can get more information on [LastError] variable.
Set the mouse position to any screen coordinates point in a human-like way with the specified speed. "1" is the maximum speed. "2" is lower, "3" is lowest, etc. The result variable store "True" if everything is OK, or "False" if an error occur. In this last case you can get more information on [LastError] variable.
Get the plugin name from the specified NeoBook Plugin File (NBP). The result variable store the plugin name or "False" if an error occur. In this last case you can get more information on [LastError] variable.
Get the plugin hint (description) from the specified NeoBook Plugin File (NBP). The result variable store the plugin hint or "False" if an error occur. In this last case you can get more information on [LastError] variable.
Get the plugin author from the specified NeoBook Plugin File (NBP). The result variable store the plugin author or "False" if an error occur. In this last case you can get more information on [LastError] variable.
Get the plugin actions from the specified NeoBook Plugin File (NBP). The result variable store the plugin actions or "False" if an error occur. In this last case you can get more information on [LastError] variable.
The Actions variable store an NeoBook Array of Array with all plugin actions. So every array element is a zero indexed array with four elements:
With the help of the Actions Count variable is easy to iterate over the Actions array, just with something like this code:
npNbpActions "[PubDir]a.nbp" "[Actions]" "[ActionsCount]" "[Result]" Loop "0" "[ActionsCount] - 1" "[I]" .[[I]Actions0] is the action name .[[I]Actions1] is the action hint .[[I]Actions2] is the action category .[[I]Actions3] is the action params count ListBoxAddItem "ListBox1" "0" "[[I]Actions0]" EndLoop
Convert a color in NeoBook format into their RGB representation. This action expect a NeoBook color like "0,0,0". The result variable store their RGB representation, in this case "000000".
Convert a color in string RGB format to their NeoBook format representation. This action expect a six or seven characters as the RGB argument, for example, "000000" or "#000000". The result variable store the color in NeoBook format.
Retrieve the color under the mouse cursor in a NeoBook format. The result variable store the pixel color in which the cursor is in NeoBook format, for example "0,0,0".
Encode the specified year, month, day, hour, minute, second and millisecond values into a Date Time value in order to be use with others plugin actions, like npDaysBetween. The result variable store the date as string is the provided arguments are valid.
If the provide arguments are not valid or if not conform a valid date time, the result variable store "False" and the [LastError] store information about the error.
If you only want to validate a year, month and day in order to assert that conform a valid date, you can use npIsValidDate directly. If you only want to validate an hour, minute, second and millisecond in order to assert that conform a valid time, you can use npIsValidTime directly.
Decode the specified previously encoded date value into the specified year, month, day, hour, minute, second and millisecond variables. The result variable store "True" if everything is OK, or "False" on error. In this last case the [LastError] variable contain information about the error.
Find if the provided year, month and day configuring a valid date. The result variable store "True" if:
The result variable can store "False" if the date is not valid or if some error occur. In this last case you can get more information on [LastError] variable.
Find if the provided hour, minute and second configuring a valid time. The result variable store "True" if:
The result variable can store "False" if the time is not valid or if some error occur. In this last case you can get more information on [LastError] variable.
Increment the specified encoded date (see npEncodeDateTime) with the specified amount of days, weeks, months or years. The amount variable can be also a negative value, in order to decrement the specified date. The result variable store an encoded date value after incremented or decremented. The result variable can store "False" if the date is not valid or if some error occur. In this last case you can get more information on [LastError] variable.
Indicates the relationship between two datetime encoded values (see npEncodeDateTime). The result variable can store one of the below constants:
The result variable also can store "False" if an error ocurr. In this last case you can get more information on [LastError] variable.
Get the number of weeks of the specified year. Year is a year between 1 and 9999 (inclusive). This action defines the first week of the year according to the ISO 8601 standard. That is, the first week of the year is the one that includes the first Thursday of the year (the first week that has 4 or more days in the year). This means that WeeksInAYear always returns either 52 or 53.
The result variable store the number of weeks the specified year, or "False" if an error ocurr. In this last case you can get more information on [LastError] variable.
Get the number of week of the specified datetime year. This action uses the ISO 8601 standard definition of a week. That is, a week is considered to start on a Monday and end on a Sunday. This action returns a value from 1 through 53. You can encode a datetime value to use on this action with the npEncodeDateTime action. So, if you want to retrieve the week of the current date time you can use a code like this:
.Encode the datetime value to match the current datetime .[Year]" "[MonthNum]" "[DayNum]" "[DateTime]" .Use the encoded datetime to get the week of the year npWeekOfTheYear "[DateTime]" "[Result]"
The result variable store the number of week of the provided datetime, or "False" if an error ocurr. In this last case you can get more information on [LastError] variable.
Get the day of week index for the specified encoded Date. You can encode a datetime value to use on this action with the npEncodeDateTime action. So, if you write a code like this:
SetVar "[DaysNames]" "Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday" StrParse "[DaysNames]" "," "[DaysNames]" "[TotalDays]" npEncodeDateTime "2012" "3" "8" "0" "0" "0" "0" "[EncodedDate]" npDayOfTheWeek "[EncodedDate]" "[DayOfTheWeek]" AlertBox "Info" "The day name is: [DaysNames[DayOfTheWeek]]"
The result variable store the number of the week day, which then is used to get the appropiate day name from the DaysNames variable. The result variable can also store "False" if an error ocurr. In this last case you can get more information on [LastError] variable.
Retrieve the number of whole years between two specified Datetime values. You can use the npEncodeDateTime in order to encode the Datetime values.
Because years are not all the same length (e.g. leap years), this action returns an approximation based on an assumption of 365.25 days per year. Fractional years are not counted. Thus, for example, this action reports the difference between January 1 and December 31 as 0 on non-leap years and 1 on leap years.
The result variable store the number of whole years between the specified Datetime values, or "False" if an error ocurr. In this last case you can get more information on [LastError] variable.
Retrieve the number of whole months between two specified Datetime values. You can use the npEncodeDateTime in order to encode the Datetime values.
Because months are not all the same length, this action returns an approximation based on an assumption of 30.4375 days per month. Fractional months are not counted. Thus, for example, this action reports the difference between February 1 and March 1 as 0.
The result variable store the number of whole years between the specified Datetime values, or "False" if an error ocurr. In this last case you can get more information on [LastError] variable.
Get the number of weeks between the start and end provided datetime values. You can encode a datetime value to use on this action with the npEncodeDateTime action. So, you can write a code like this:
npEncodeDateTime "2020" "1" "1" "0" "0" "0" "0" "[StartDate]" npEncodeDateTime "2021" "1" "1" "0" "0" "0" "0" "[EndDate]" npWeeksBetween "[StartDate]" "[EndDate]" "[Result]"
The result variable store the number of weeks between the specified datetime values, or "False" if an error ocurr. In this last case you can get more information on [LastError] variable.
Retrieve the number of whole days between two specified Date values. You can use the npEncodeDateTime in order to encode the Date values.
This action counts only whole days. Thus, the action reports the difference between Dec 31, 1999 11:59 PM and Jan 1, 2000 11:58 PM as 0 because the difference is one minute short of an entire day.
The result variable store the number of whole days between the specified Date values, or "False" if an error ocurr. In this last case you can get more information on [LastError] variable.
Retrieve the number of whole week days between two specified Date values. You can use the npEncodeDateTime in order to encode the Date values.
The result variable store a NeoBook zero indexed array with seven elements, one per week days:
The result variable also can store "False" if an error ocurr. In this last case you can get more information on [LastError] variable.
Retrieve the number of whole hours between two specified Datetime values. You can use the npEncodeDateTime in order to encode the Datetime values.
This action counts only whole hours. Thus, this action reports the difference between 9:00 A.M. and 9:59:59 A.M. as 0 because the difference is one second short of an entire hour.
The result variable store the number of whole hours between the specified Datetime values, or "False" if an error ocurr. In this last case you can get more information on [LastError] variable.
Retrieve the number of whole minutes between two specified Datetime values. You can use the npEncodeDateTime in order to encode the Datetime values.
This action counts only entire minutes. Thus, this action reports the difference between 9:00:00 A.M. and 9:00:59:999 A.M. as 0, because the difference is one millisecond short of an entire minute.
The result variable store the number of whole minutes between the specified Datetime values, or "False" if an error ocurr. In this last case you can get more information on [LastError] variable.
Retrieve the number of whole seconds between two specified Datetime values. You can use the npEncodeDateTime in order to encode the Datetime values.
This action counts only entire seconds. Thus, this action reports the difference between 9:00:00 A.M. and 9:00:00:999 A.M. as 0, because the difference is one millisecond short of an entire second.
The result variable store the number of whole seconds between the specified Datetime values, or "False" if an error ocurr. In this last case you can get more information on [LastError] variable.
Retrieve the number of whole milliseconds between two specified Datetime values. You can use the npEncodeDateTime in order to encode the Datetime values.
The result variable store the number of whole milliseconds between the specified Datetime values, or "False" if an error ocurr. In this last case you can get more information on [LastError] variable.
Retrieve the number of days in the specified year and month. The result variable store the number of days in the specified year and month, or "False" if an error ocurr. In this last case you can get more information on [LastError] variable.
Checks if the specified datetime is in the range of the provided start and end datetimes. Use the npEncodeDateTime action to encoded the date to be compared, the start and the end dates. If the Inclusive argument is "True", then the limits are included; if it is "False", the limits are excluded. The result variable store "True" if the date to be compared is between the start and end dates or "False" if not. Note that the result variable can also store "False" in case of errors. In this last case you can get more information on [LastError] variable.
Get the device identificators for the system printers. The Printers Count variable store the number of printers found, beginning from zero. The result variable store an array with the printers identifiers. For example, take a look at this code:
npGetPrintersList "[PrintersCount]" "[Printers]" If "[Printers]" "<>" "False" Loop "0" "[PrintersCount]" "[I]" ListBoxAddItem "PrintersListBox" "0" "[Printers[I]]" EndLoop EndIf
The result variable can also store "False" if an error ocurr. In this last case you can get more information on [LastError] variable.
Get the default system printer device identifier. The result variable store the default system printer device identifier.
Set the default system printer using the specified device identifier. Remember to use one of the printer identifiers you can found calling the npGetPrintersList action. The result store "True" if everything is OK, or "False" if an error ocurr. In this last case you can get more information on [LastError] variable.
This action look if a process is running on the system based in the process name. The result variable store "True" if the process is running, or "False" when not. Also the result variable can store "False" if an error ocurr. In this last case you can get more information on [LastError] variable.
This action retrieve the list of running processes. The action store in the list variable all the running processes and also information for every process. The list count variable store the number of running processes and can be used to iterate over the list variable. The result variable store "True" if everyhing is OK or "False" when not. Also the result variable can store "False" if an error ocurr. In this last case you can get more information on [LastError] variable.
Here is an example of use of this action:
.Retrieve all running process npRunningProcesses "[Processes]" "[ProcessesCount]" "[Result]" .Iterate over the [Processes] variable using [ProcessesCount] Loop "1" "[ProcessesCount]" "[I]" .Here we can access all the running processes information ListBoxAddItem "ListBox1" "0" "ID: [Processes[I].ID] - Name: [Processes[I].Name]" EndLoop
Here is the list of properties which the list variable store about every process:
As you can see you can access every process property using the list variable, followed by the index, a dot and finally the property name. For example, suposing you use "[Processes]" for the list variable you can access the information of the first (number 1) process information in this manner:
Register a file extension to be opened with the specified program executable. Take also a look at npUnregisterFileExtension and npIsFileExtensionRegistered. The result store "True" if everything is OK, or "False" if an error ocurr. In this last case you can get more information on [LastError] variable.
Unregister a previously registered file extension to no longer be opened by the specified program executable. Note you need to specify in this action the same arguments used previously in npRegisterFileExtension. In this last case you can get more information on [LastError] variable.
Find if the specified file extension has previously registered with the specified program executable. Note you need to specify in this action the same arguments used previously in npRegisterFileExtension. In this last case you can get more information on [LastError] variable.
Get the associated executable path and command string for the specified file extension. File extension need to be dotted, for example, ".txt" (without quotes). The executable store the executable path associated with the specified file extension. Note that this executable can be a DLL or other executable string recognized by Windows. The command string variable contain the complete call the system does for the specified file extension.
The result variable store "True" if everything is OK or "False" if an error ocurr. In this last case you can get more information on [LastError] variable.
Generate a random number from the provided numbers range. The result variables store the generated random number or "False" if an error occur. In this last case you can get more information on [LastError] variable.
All the NeoPlugins deal with errors in the same way that NeoBook does: when the plugin found an action error the [LastError] variable store information about the error, so you can take care about this variable when execute an action.
But all the NeoPlugins also incorporate an advanced way to deal with possible action errors. You can define a subroutine named OnNeoPluginActionError in order to be executed when some action error are found and you can use this variables inside:
Note that this error handling subroutine are shared for all the NeoPlugins, so you no need to specify a subroutine for every plugin you use in your publication because the same subroutine are recognized and automagically used by every NeoPlugin. Below you can view a sample of this subroutine code:
:OnNeoPluginActionError AlertBox "NeoPlugin Error" "Error [LastError] in plugin: [PluginName]" Return
Also note that the use of this NeoPlugins error handling subroutine is completelly optional. You can continue using the [LastError] variable as usual and even use the both methods at the same time.