Dragon NaturallySpeaking Version 9 System Administration Guide Copyright © 2006 Nuance Communications, Inc. All rights reserved. Note: For the latest System Administration information, see http://support.nuance.
Contents Dragon NaturallySpeaking System Administration Guide ........................................................... 10 Overview ........................................................................................................................................ 10 Installation and Upgrade .......................................................................................................11 Recommended System Requirements for Dragon NaturallySpeaking ............................................
Setting Up the Program Neighborhood on Citrix clients ......................................................................... 66 Starting Dragon NaturallySpeaking from a Citrix client ......................................................................... 67 The Convert XML to DAT tool ................................................................................................. 69 Using the Convert XML to DAT tool......................................................................................
String Data Type.............................................................................................................................. 98 String*n Data Type .......................................................................................................................... 99 UserDialog Data Type ....................................................................................................................... 99 Variant Data Type ...........................................................
ComboBox Dialog Item Definition..................................................................................................... Command$ Function ...................................................................................................................... condexpr definition ........................................................................................................................ Const Definition ....................................................................................
Eval Function................................................................................................................................. Exit Instruction .............................................................................................................................. Exp Function ................................................................................................................................. Expr definition ..................................................................
Little-endian definition .................................................................................................................... Loc Function.................................................................................................................................. Lock Instruction ............................................................................................................................. LOF Function .......................................................................
RmDir Instruction .......................................................................................................................... Rnd Function ................................................................................................................................. Round Function.............................................................................................................................. RSet Instruction.......................................................................
Write Instruction............................................................................................................................ 261 Year Function ................................................................................................................................ 262 Objects Overview........................................................................................................................... 262 Format Predefined Date ....................................................
Dragon NaturallySpeaking System Administration Guide Overview Note: For the latest System Administration information, see http://support.nuance.
• • Using Dragon NaturallySpeaking with Citrix o Using Dragon NaturallySpeaking in a Citrix environment o Installing and publishing Dragon NaturallySpeaking on the Citrix server o Creating Policies for Dragon NaturallySpeaking on the Citrix server o Making Published Applications Work together o Setting Up the Program Neighborhood on Citrix clients o Starting Dragon NaturallySpeaking from a Citrix client Using the Convert XML to DAT tool Installation and Upgrade Recommended System Requirement
Notes: Coexistence with Dragon NaturallySpeaking SDK Client Edition Version 8 is not supported. Upgrading from a previous version You can upgrade from Dragon NaturallySpeaking Versions 7 and 8. During an upgrade, the V9 upgrade procedure will ask you to: Remove the previous Dragon NaturallySpeaking installation. If you choose not to remove the previous installation, you cannot continue to upgrade. Removing Version 7 or 8 will not remove your V7 or 8 speech files and vocabularies.
For Windows 2000 and Windows XP Professional systems with limited user accounts (users with restricted privileges), if the administrator wants to create a Dragon NaturallySpeaking user for a limited user, the administrator must log on as the limited user. If an administrator creates a Dragon NaturallySpeaking user for a limited user account from an administrator account, the limited user account will not be able to access that user.
Modifying settings for all users For the Professional, you can modify the following settings during an installation: "Modify the application's settings for all users" displays the Options dialog box at the end of the installation. The Options dialog box lets you change Dragon NaturallySpeaking’s standard behavior, including specifying hot keys, customizing how text is formatted, initial microphone settings, and setting the how often your user files are backed up.
• SDK Server Edition (DSS): Dragon SDK Server Edition 9.msi Installation notes: Unless otherwise noted • All command line options are case insensitive and may be combined • No options require special values based on the values of other options. In the examples below, user-supplied information is displayed between angle brackets. Do not use angle brackets (<,>) as part of the command line. Do not use quotation marks except when specifying a full path name with the -path command.
p - Terminal properties. v - Verbose output. x - Extra debugging information. Only available on Windows Server 2003. + - Append to existing file. ! - Flush each line to the log. "*" - Wildcard, log all information except for the v and x options. To include the v and x options, specify "/L*vx". PROPERTY=VALUE Overrides default public property value. For example, setting "XYZ=ABC" will replace the default property value of XYZ to ABC.
The specified file contains settings that will be merged into the nsdefaults.ini file at installation time. Note that this file must be in an ".ini" file format. In other words, any settings you want to merge must also have the section notated as well as the value and data. If only values and data are set in this file (without the section name encased in brackets), the settings will not be merged. For a default installation, the nsdefaults.ini is located in: C:\Documents and Settings\All Users\Application
QUICKSTART=0 (or 1) Set the default state of "Enable QuickStart Mode" checkbox to enable QuickStart and to create shortcut for "Dragon NaturallySpeaking" in the Windows Startup folder. A value of 0/1 will turn checkbox off/on accordingly. REINSTALL=Feature1,Feature2,... (or ALL) The value of the REINSTALL property is a list of features delimited by commas that are to be reinstalled. To reinstall all features use REINSTALL=ALL on the command line.
For more information on REINSTALLMODE and the reinstall option codes, see: http://msdn.microsoft.com/library/default.asp?url=/library/ en-us/msi/setup/reinstallmode.asp ROAMINGUSERINI="c:\xyz.ini Specifies a "roaming user ini file", which contains settings to be merged into nssystem.ini at installation time. These are the same settings as displayed in the Roaming User section of the Administrative Settings dialog box. Long path names need to have their quote strings "escaped" (\").
Note the following when specifying features on the command line: • If a feature doesn't exist in a particular edition or language, overriding it's default property has no effect. • Some features (For example, the Speech feature) have subfeatures. Setting these features on the command line will automatically turn on the properties of all subfeatures, unless those subfeatures have an additional override also specified.
ENG (UK English) IND (Indian English) SEA (SouthEast Asian English) ENU (US English) General (US English General) Teens (US English Teens) Legal (US English Legal) Cardiology (US English Medical Cardiology) Emergency (US English Medical Emergency) Gastroenterology (US English Medical Gastroenterology) GeneralPractice (US English Medical GeneralPractice) Medical (US English Medical No Specialty) MentalHealth (US English Medical MentalHealth) Neurology (US English Medical Neurology) ObGyn (US English Medical
Data\Nuance\Dragon SDK Client Edition\Roaming User\. Roaming User Restrict Local User Access=1 (or 0) Roaming User Copy Dragon Log=0 (or 1) Permits non-roaming user to be opened when the roaming user feature is active. Defaults to "1" which restricts access to roaming user only and prevents dictating with a non-roaming (local) user by accident. Copies the Dragon.
Roaming User Copy Dragon Log=1 Roaming User Limited Network Traffic=1 Roaming User Local Cache Directory=D:\roam InstallShield (setup.exe) options Like the Microsoft Installer Service (msiexec.exe), the InstallShield Setup program (setup.exe) can accept a number of command line options and can pass options through setup.exe to the included .msi file. All setup.exe command-line options must be prefaced with a forward slash (/) only.
directory. Option Description /a Administrative installation option. This instructs setup.exe to perform an administrative installation instead of a normal installation. This option is required when trying to extract the .msi files. /v Passed arguments to Windows Installer. See above for details. This option is required when trying to extract the .msi files. Specifies the language to use for installing Dragon NaturallySpeaking .
/v Passes command line and public properties options to the Windows Installer (msiexec.exe) installation. In order to run both setup.exe and msiexec.exe silently, you will need to combine the /s and the /v options. Use the following command line: setup.exe /s /v/qn. Using these options, no dialogs of any kind will be displayed during installation or uninstallation. All messages are suppressed or, if a log file is also specified, sent to the MSI log file in the user-specified temp directory.
You must upgrade to the same edition or higher and to the same language. For example, if you started with Version 8 German/English and you upgrade to Version 9 English only, your Version 8 German users will not be upgraded. Upgrading to Version 9 German/English will upgrade both your German and English users. After upgrading, you can install other Version 9 languages. User files to upgrade Lists the location and name of all the users that the wizard will upgrade.
At the same time that the User Upgrade Wizard modifies your user files to work with Dragon NaturallySpeaking version 8, it can move a copy of the upgraded user to another location while keeping the old files untouched. This allows you to return to the old user files in case you need them again, and it makes the files compatible with operating systems, like Windows XP, that store all user data in the Documents and Settings folder.
If a different base vocabulary is available for upgrading the user, you can use this list to select it. New Location If you want to choose a new location for the user, you can use this list to select it. Upgrading Users with Custom Vocabularies If you have custom vocabularies, upgrading your V8 users will maintain the customized vocabularies associated with those users but will modify the vocabulary name.
Step 4: Export the customized vocabulary You can share vocabularies among different users by first exporting a vocabulary from one user and then importing it to a new user. Use the following procedure to export a vocabulary. To export a vocabulary: 1. Create a folder in which to save the exported vocabulary files. 2. Open the upgraded V8 user that uses the customized vocabulary. 3. On the NaturallySpeaking menu of the DragonBar, click or say "Manage Vocabularies." 4.
C:\Program Files\ScanSoft\NaturallySpeaking \Custom \Data \Help \Program \Results \Training \Tutorial (optional installation) \Users Note: The \Custom directory is present only if you use nsadmin to create custom words, commands, or vocabularies. The Dragon NaturallySpeaking V7.3 directory structure is the same as V8. V8 Windows 2000/XP Pro/XP Home directory structure The V8 directory structure before upgrading to V9: C:\Program Files\ScanSoft\NaturallySpeaking \Help \Program \Tutorial (optional) C:\Docum
C:\Windows\Speech VText.dll Vdict.dll WrapSAPI.dll XTel.Dll Xcommand.dll Xlisten.dll Xvoice.dll spchtel.dll speech.cnt speech.dll vcauto.tlb vcmd.exe vcmshl.dll vtxtauto.tlb Dragon NaturallySpeaking installed these files for Microsoft SAPI4 support. If you do not have other speech applications that require SAPI4, you can safely remove these files manually.
Dragon NaturallySpeaking the program returns to the QuickStart mode and remains in memory with a reduced footprint (approximately 10 MB). /SetDefaultOptions Displays the Options dialog box at the end of the installation. The Options dialog box lets you change Dragon NaturallySpeaking’s standard behavior, including specifying hot keys, customizing how text is formatted, initial microphone settings, and setting the how often your user files are backed up.
use for dictation. For more information For more information, see: Setting up the Roaming User Feature Creating and opening a Roaming User Using multiple dictation sources with a single user Synchronizing Master and Local Roaming Users Running the Acoustic and Language Model Optimizer for roaming users Setting up the Roaming User feature You must set up the Roaming User feature on each computer where you want users to dictate with a Roaming User.
After closing any open users: 1. Click Administrative Settings on the DragonBar Tools menu. This displays the Administrative Settings dialog box. 2. On the Roaming tab, select Enable. Step 4: Specify the location of the Master Roaming User On each computer where you plan to have users dictating as a Roaming Users, you must tell that installation of Dragon NaturallySpeaking where the Master Roaming user is located, and if necessary, create that location. After selecting Enable on the Roaming tab: 1.
multiple network storage locations for your Master Roaming User files. The are the names of the individual Master Roaming Users. Changing the default location 1. Use the Browse for Folder dialog box to open a location where you want to store the master roaming user. This is the location on the computer where changes made during a dictation session, such as corrections or new acoustic data are stored before they are synchronized with the master roaming user. 2.
Check. Check this option if your users are users are using different machines or use a single machine, like a laptop, in many different locations. When a user changes machines or locations, the audio setup data can vary depending on differences in the microphone and sound card, as well as differences in ambient sound levels of each Roaming User location.
since it will be less efficient since it will not have the .DRA files to process. Note: If you set the "Disk space reserved for network archive" option, the .DRA files will not be copied once the maximum size is reached. Disk space reserved for network archive Use this option to specify the maximum size of the directory containing the acoustic data available to the Acoustic Optimizer. By default the archive size is 500MB.
of Dragon NaturallySpeaking where the Master Roaming user is located. The Roaming User feature supports the following types of locations: Mapped Drives and UNC Paths Mapped drives connect to a shared network folder that has a drive letter assigned to it. UNC paths connect to a shared network folder using the Universal Naming Convention (UNC) to locate a user. The UNC is a way to identify a shared file on a computer or network without having to know the storage device it is on. The UNC path format is: \\ser
To connect to an HTTP server, you must suppy the following information: The network location: You use the Roaming User Network Location dialog box to define the network location of the master roaming users. You must supply the URL address of your HTTP server where your roaming user master files are located. For more information, see Roaming User Network Location.
Could not list the contents of a directory created on the network location Check permissions on the Master Roaming directory. The user must have read, write, and modify privileges Check that privileges are inherited in the subdirectories. Contents of newly created directory TempDir were incorrect Could not copy a file from the network location Caused by an incomlete directory listing. Try again. If the problem persists, check the condition of your network.
If you allow users to select both non-roaming local and Roaming Users, make sure they select the correct location from the "Location of user files" field. 3. Click New and begin training the user as you would any other user. When you are finished training the user, the program copies the user files into the master Roaming User location specified in the "Location of user files" field.
location from the "Location of user files" field. Notes: o When the Roaming User feature is enabled, you can only open Roaming Users. The "Location of user files" field only display the Roaming User location you defined in the Administrative Settings dialog box. To let the users open both local (non-roaming) and Roaming Users, select the "Allow non-Roaming Users to be opened" option on the Administrative Settings dialog box.
2. Click the Source button and then click New. This displays the the New Dictation Source dialog box. 3. Select a new input device for your dictation from the list on the New Dictation Source dialog box. For example, you can choose from among different microphone or recorder types. 4. Click OK. You return to the Open User dialog box. 5. Select the user you just created and click Open.
new words or vocabularies to be available to your Dragon NaturallySpeaking users. This section describes: • Using the Data Distribution Tool • Adding Custom Words • Adding and Deleting Custom Vocabularies • Adding Custom Commands You can also run nsadmin from the command line. For more information, see Nsadmin command line. Note: The Dragon NaturallySpeaking Data Distribution Tool only runs on Dragon NaturallySpeaking Professional and higher editions.
Data Distribution Tool : Add and removing custom words You can use the Data Distribution Tool to make new words available to all user profiles on a particular installation. To distribute a set of custom words (for example, a list of new drug names) to a particular installation, you must first either: • Create a text (.txt) file and enter each word or phrase you want to add to the vocabulary on a separate line. Make sure words are spelled correctly.
Data Distribution Tool : Adding and removing vocabularies You can use Data Distribution Tool to make a customized vocabulary available to all user profiles on a particular Dragon NaturallySpeaking installation. For example, say you have extensively customized a vocabulary using the Voctool. Using the Data Distribution Tool , you can copy the user's vocabulary to be used as a base vocabulary on any Dragon NaturallySpeaking installation.
One of the exported files has a .top file extension, the other files have .to* file extensions, where * is an integer. To add an exported vocabulary to NaturallySpeaking with the Data Distribution Tool , provide the path to the file with the .top file extension as an argument on the nsadmin command line. For information on exporting a Dragon NaturallySpeaking vocabulary, see open_voc_dialog.htm Deleting a vocabulary To delete a base vocabulary: 1.
1. Select "Add or remove shared commands " from the Data Distribution Tool and click Next. 2. Select the languages of the user profiles that will have the custom words added and click Next. 3. Use the Import button to select the .DAT files containing the custom commands you want to add. You can modify the list by using the Remove and Remove All buttons. Click Next to continue. 4. The Data Distribution Tool displays a log of all operations it performed. 5.
• Adding Custom Commands You can also run nsadmin interactively. For more information, see Using the Data Distribution Tool. Note: The nsadmin command line utility only runs on Dragon NaturallySpeaking Professional and higher editions. Using nsadmin You run the nsadmin utility on each computer containing Dragon NaturallySpeaking where you want the new words, vocabularies, or commands to be available.
/overwrite yes | no | ask Specifies overwrite rules if a file exists with the same name as the file you are attempting to add. The default value is "ask." /? Display the command syntax Notes: • Command line arguments that contain spaces must be enclosed in quotation marks. • If you are running nsadmin from other than the DNS Tools, you must specify the full path to the nsadmin.exe program on the command line. • You may want to write a batch file or script that executes nsadmin.
UNC address of the location in the nsadmin program. 3. On each client computer, use the following command to add the custom words contained in the .txt file. \nsadmin /words G:\NsAdmin\NewWords.txt The NewWords.txt file will be copied to the following directory on each machine where it is run: \Documents and Settings\All Users\Application Data\Nuance\Dragon NaturallySpeaking9\Custom\enx\NewWords.
For example, "US English" or "UK English" for an English install. The language or dialect you enter must be present in the version of NaturallySpeaking installed on the computer. The represents the size of the vocabulary you are importing. • The value you specify for the parameter should describe the content of the vocabulary, such as "Astronomy" or "Marketing." • Use a value greater than 9000 for the topic ID parameter. Example \nsadmin /vocabulary G:\NsAdmin\myvoc "US En
nsadmin: Adding Custom Commands You can use nsadmin to make a set of custom commands available to all user profiles on a particular DNS installation. Note the following when adding a custom commands: • For a default installation, custom commands for existing DNS users are located in: \Documents and Settings\All Users\Application Data\Nuance\Dragon NaturallySpeaking\Custom\ • Once you have imported the custom commands to NaturallySpeaking installation, you must close your users, then re-open an
\nsadmin /commands G:\NsAdmin\NewCommands.dat /overwrite=yes If the NewCommands.dat file already exists in the \Documents and Settings\All Users\Application Data\Nuance\Dragon NaturallySpeaking9\Custom\enx directory, the new file will overwrite the existing file without prompting you. Vocabulary Tool Dragon Vocabulary Tool (Voctool) You use the Dragon Vocabulary Tool to customize a vocabulary by adding new words and by optimizing the language model.
Add new words from documents and adapt to writing style This option instructs the Dragon Vocabulary Tool to examine documents you specify in the Choose Documents screen that appears when you click Next. In general, you should select documents that reflect the preferred writing style and vocabulary of the person who will use the modified user files for dictation.
Click this button to remove selected document names from the document list. You can hold down the CTRL key and click individual document names to select multiple documents one at a time, or you can hold down the SHIFT key and click the first and last document names to select a range of documents. View Document Click this button to open a selected document in the application in which the document was created. For example, if the document has a .doc extension, it will open in Microsoft Word.
Word Lists The names of files containing word lists that you can have the Vocabulary Tool analyse. The buttons to the right of this list allow you to add to and delete file names. Add Word List Click this button to open the Add Word List Files dialog box, which you can use to select file names to display in the documents list.
Select this option to have the Vocabulary Tool skip the Preview New Words screen. The Vocabulary Tool will add all the unknown words and/or the known words with unique capitalization to the vocabulary without the option of modifying the list. Note Use the Find known words with unknown capitalization option only with word lists that you are sure you want to add to the vocabulary. Otherwise you might add words to the vocabulary unintentionally.
Frequency indicates how many times the word appears in the analyzed documents. This information appears only if you selected the "Add new words from documents and adapt to writing style" option on the Introduction screen of the wizard. Check All Click this button to check all the words in the Word list. Clear All Click this button to clear all the words in the Word list. Edit Click this button to open the Edit Word dialog box for a word you have selected.
Clear All Click this button to deselect all the words in the Word list. Train Click this button to open the Train dialog box where you can train Dragon NaturallySpeaking to recognize your pronunciation of the words you selected. If you have selected more than one word to train, the Train dialog box shows them to you in the order that they appear in the list. Note Only the person who will be dictating with the user you are modifying can perform the training.
• For Dragon NaturallySpeaking Solution Series, user slot, the recommendation is Yes. • For Dragon NaturallySpeaking Preferred, user slot, the recommendation is Yes. You cannot build a language model in the middle slot of Dragon NaturallySpeaking Preferred. Dragon Vocabulary Tool: Summary Screen The Summary screen for the Vocabulary Tool displays information about the newly built language model.
Using Dragon NaturallySpeaking with Citrix Using Dragon NaturallySpeaking in a Citrix environment (overview) Dragon NaturallySpeaking includes support for deploying and running Dragon NaturallySpeaking in a Citrix environment.
2. Publish Dragon NaturallySpeaking: o If you installed Dragon NaturallySpeaking, you must publish it as an Application: When publishing Dragon NaturallySpeaking from the Presentation Server Console, use natspeak.exe as the Dragon NaturallySpeaking executable. By default the Dragon NaturallySpeaking applications are installed to: \Program Files\Nuance\NaturallySpeaking9\Program For example: o 63 If you installed the Dragon SDK Client Edition, you must publish the SDK as a Desktop from the Citrix Pre
When publishing the Citrix Client Update from the Presentation Server Console, use vddnspatch.exe as the Citrix Client Update executable. For example: Note: You must install this Client Update directly on each client computer. For more information, see Setting Up the Program Neighborhood on Citrix clients and Starting Dragon NaturallySpeaking from a Citrix client.
Create the AudioOut policy 1. From the Management Console, select Policies and click the Create Policy… button (or Actions>Policy>Create Policy from the menu) to create a second policy named AudioOut. 2. Select the AudioOut policy and then click the Properties button to set the properties to enable the Sound Quality and set the client audio quality to “High sound quality; lowest performance”. For example: 3.
1. All applications must be started in Seamless mode. 2. Don’t change Application Set settings when a published application is running. 3. When using the Smooth Roaming feature with published applications on multiple computers, the user must either: o Close all published applications before moving to a new location. o Start the same published applications in the same order on all the machines that are used.
Before starting Dragon NaturallySpeaking as a published application, you must enable sound on the client for the application set for Dragon NaturallySpeaking on each Citrix client. 1. From the Citrix Program Neighborhood, select the Application Set that contains Dragon NaturallySpeaking and the Citrix Client Update. 2. From this Application Set click the Settings button . This displays the Settings dialog for the selected application set. 3.
This starts the Citrix Client Update installer wizard. 5. When prompted, click Next and then Patch. Clicking Patch starts the installation. 6. Click Finish when the installation completes. After installing the Citrix Client Update, you can start Dragon NaturallySpeaking to create your users. Notes • In order to run the Citrix Client Update, each client machine must be joined to the network domain of the Citrix server.
Please double-check that the Audio settings on your client are set to high. For more information, see Setting up Citrix Clients. • If you are using a Phillips SpeechMike, set up your system so that sound playback is through a different device and not the SpeechMike. To do this, select Sound and Audio Devices from the Windows control panel and use the Audio tab to set your Sound playback and Sound recording devices. • There must be sound system installed on the client.
Convert XML to DAT (mycmdsxml2dat.exe) syntax Convert XML to DAT (mycmdsxml2dat.exe) uses the following syntax: mycmdsxml2dat.exe [options] Required parameters : Description The full path to the local copy of the current user's .DAT file The full path to the .XML file Optional parameters : -v Validates the specified .xml file over the Internet with a Nuance DTD (Document Type Definition) file.
Description A short description of what the command does (optional). Group A list containing the categories in which you can place the command. You use these groups to locate the command in the Command Browser. By default, the groups Dragon and User-defined are available. To create your own group, select User-defined and type over it with a group name of your choosing. Availability Where the command will be available. Global: The command will be available in every application.
Object: Select the object type from the list of available objects. The "(General)" object groups all of the procedures, which are not part of any specific object. Proc: The Proc list shows all the procedures for the current object. Use it to select the procedure type from the list of available procedures. A procedure that is not bold inserts the proper procedure definition for that procedure. Save Click Save to save the advanced scripting command.
Click the Browse Object tool to open the ActiveX Automation Members dialog box. Use this dialog box to build your script with ActiveX variables. If you would like more information about a specific variable, select it in the Methods/Properties box and click the question mark button to the left of the Help String box. When you are finished, close the ActiveX Automation Members dialog box and click Save on the MyCommands Advanced Scripting dialog box.
Item Description Immediate Evaluates expressions, assigns variables, or calls subroutines. Watch Displays the variables, expressions, and functions in the current script. Stack Displays the lines of code that called the current statement. These three tabs appear when you run your script. The Advanced Scripting menu You open the Advanced Scripting menu by pointing to the Script area of the MyCommands Advanced Scripting dialog box and right-clicking or by pressing Shift+F10.
Clear All Breaks Clears all break points. Quick Watch Shows the value of the expression under the insertion point in the immediate window. Browse Shows the methods of the expression under of the cursor. (see The Object Browser) Show Next Statement Shows the next statement to be executed. References Opens the References dialog box, which shows the current script/module's references.
The Watch Window The Stack Window The Immediate window The Immediate window of the MyCommands Advanced Scripting dialog box allows you to evaluate an expression, assign a variable, or call a subroutine. Type "?expr" to show the value of "expr".
Type "var = expr" to change the value of "var". Type "Set var = expr" to change the reference of "var". Type "subname args" to call a subroutine or built-in instruction. Type "Trace" to toggle trace mode. Trace mode prints each statement in the Immediate window when a script is running. The Watch window The Watch window allows you to list the variables, functions, and expressions that are calculated and displayed, and see their current value.
You have to enter the name of a variable, function, or expression in the Watch window. Then, the Watch window will update the value of that variable, function, or expression. The value of each line in the window is updated each time the execution pauses.
You can change the expression to the left of arrow ( ). Press Enter to update all the values immediately. Press Ctrl-Y to delete the line. The Stack window The Stack window lists the lines that called the current statement.
The first line is the current statement. The second line is the statement that called the first line, etc. Click on a line to bring that script into a sheet and highlight the line in the Script editing window. Object and Proc lists The Object list shows all the objects for the current module. The Proc list shows all the procedures for the current object. The "(General)" object groups all of the procedures, which are not part of any specific object.
Click on the Break bar to toggle a break point for that line. The Edit area Use the Edit area to view or edit the current script. You can only edit scripts that are not currently loaded. Changes to a line are automatically capitalized and highlighted when a different line is selected. Break points can be toggled on/off. A dot at the front of the line indicates a break point.
The Status bar The Status bar displays status information. In this example, the status is paused. The Object Browser The Object Browser shows information about all the special data types that are available. on the MyCommands Advanced Scripting dialog box toolbar to display the Click the Browse Object tool ActiveX Automation Members window.
Item Description Library list Lists all the type libraries. DataType list Lists all the special data types. Methods/Properties list Lists all the methods and/or properties for the current data type. Info area Displays the method/property name, result or value and the dispatch id. (A Methods/Properties item must be selected for this to be visible.) Help area Displays a description of the method or property.
library must be checked. Each checked reference is searched in order from top to bottom. If the desired library does not appear in the Available References list, click Browse to locate it on your computer. To open the References dialog box, point to the Script area of the MyCommands Advanced Scripting dialog box and right-click or press Shift+F10. On the shortcut menu that appears, click References. Item Description Available References list Lists all the registered type libraries.
In the code, a UserDialog is described by a Begin Dialog...End Dialog block. To graphically edit a UserDialog, place the current selection in a UserDialog block and click on the Edit UserDialog tool. The top row of icons in the UserDialog window has the following components, which you can use to edit the contents of a dialog box: Item Description Edit Item Properties Edits the selected item's properties. Hot key: Enter Delete Deletes the selected item.
Add GroupBox Adds a GroupBox item. Add Text Adds a Text item. Add TextBox Adds a TextBox item. Add CheckBox Adds a CheckBox item. Add OptionButton Adds an OptionButton item. Add ComboBox Adds a ComboBox item. Add ListBox Adds a ListBox item. Add DropListBox Adds a DropListBox item. Add Picture Adds a Picture item. Add OKButton Adds an OKButton item. Add CancelButton Adds a CancelButton item. Add PushButton Adds a PushButton item.
objexpr.method[([expr][, ...] [param := expr][,...])] Return the value of method for objexpr. objexpr.property[([expr][, ...] [param := expr][,...])] Return the value of property for objexpr. objexpr[([expr][, ...] [param := expr][,...])] Return the default value for the objexpr. objexpr.property[([expr][, ...])] = expr Assign the value of property for objexpr. objexpr[([expr][, ...])] = expr Assign the default value for the objexpr. Set objexpr.property[([expr][, ...
n1 Xor n2 n1 Eqv n2 Bitwise exclusive-or the integer value of n1 with the integer value n2. Bitwise equivalence the integer value of n1 with the integer value n2 (same as Not (n1 Xor n2)). n1 Imp n2 Bitwise implicate the integer value of n1 with the integer value n2 (same as (Not n1) Or n2). Example Sub Main N1 = 10 N2 = 3 S1$ = "asdfg" S2$ = "hjkl" Debug.Print -N1 '-10 Debug.Print N1 ^ N2 ' 1000 Debug.Print Not N1 '-11 Debug.Print N1 * N2 ' 30 Debug.Print N1 / N2 ' 3.3333333333333 Debug.Print N1 \ N2 ' 3
Flow Control: Call, CallByName, Do...Loop, End, Exit, For...Next, For Each...Next, GoTo, If...ElseIf...Else...End If, MacroRun, MacroRunThis, Select Case...End Select, Stop, While...Wend. Error Handling: Err, Error, On Error, Resume. Conversion: Array, CBool, CByte, CCur, CDate, CDec, CDbl, CInt, CLng, CSng, CStr, CVar, CVDate, CVErr, Val. Variable Info: IsArray, IsDate, IsEmpty, IsError, IsMissing, IsNull, IsNumeric, IsObject, LBound, TypeName, UBound, VarType.
Constant Group Empty, False, Nothing, Null, True, Win16, Win32. Conversion Group Array, CBool, CByte, CCur, CDate, CDec, CDbl, CInt, CLng, CSng, CStr, CVar, CVDate, CVErr, Val. Data Type Group Any, Boolean, Byte, Currency, Date, Decimal, Double, Integer, Long, Object, PortInt, Single, String, String*n, Variant, obj type, user enum, user type. DDE Group DDEExecute, DDEInitiate, DDEPoke, DDERequest, DDETerminate, DDETerminateAll.
File Group ChDir, ChDrive, Close, CurDir, Dir, EOF, FileAttr, FileCopy, FileDateTime, FileLen, FreeFile, Get, GetAttr, Input, Input, Kill, Line Input, Loc, Lock, LOF, MkDir, Name, Open, Print, Put, Reset, RmDir, Seek, Seek, SetAttr, Unlock, Write. Flow Control Group Call, CallByName, Do...Loop, End, Exit, For...Next, For Each...Next, GoTo, If...ElseIf...Else...End If, MacroRun, MacroRunThis, Select Case...End Select, Stop, While...Wend.
String Group Asc, AscB, AscW, Chr, ChrB, ChrW, Format, Hex, InStr, InStrB, InStrRev, LCase, Left, LeftB, Len, LenB, LTrim, Mid, MidB, Oct, Replace, Right, RightB, RTrim, Space, String, Str, StrComp, StrConv, StrReverse, Trim, UCase. Time/Date Group Date, DateAdd, DateDiff, DatePart, DateSerial, DateValue, Day, Hour, Minute, Month, MonthName, Now, Second, Time, Timer, TimeSerial, TimeValue, Weekday, WeekdayName, Year. User Dialog Group Begin Dialog...
C:\ABCTemp\vbs\Dim_Definition00000109.htm Dim Obj As classname Set Obj = New classname Can optionally contain Attributes one of which must be VB_Name. See Also: Attribute Definition/Statement, Code Module, Object Module, Uses. Example 'MyCommands macro '#Uses "File.CLS" Sub Main Dim File As New File File.Attach "C:\AUTOEXEC.BAT" Debug.Print File.ReadLine End Sub 'File.CLS class file VERSION 1.
Code Module Group Declaration Description A Code module implements a code library. Has a set of Public procedures accessible from other macros and modules. The public symbols are accessed directly. Can optionally contain Attributes See Also: Attribute Definition/Statement, Class Module, Object Module, Uses. Example 'MyCommands macro '#Uses "Module1.BAS" Sub Main End Sub Debug.Print Value '"Hello" 'Module1.
Public Consts, Types, arrays, fixed length strings are not allowed. An object module is similar to a class module except that one instance is automatically created. That instance has the same name as the object module's name. To create additional instances use: C:\ABCTemp\vbs\Dim_Definition00000109.htm Dim Obj As objectname Set Obj = New objectname It can optionally contain Attributes one of which must be VB_Name. See Also: Attribute Definition/Statement, Class Module, Code Module, Uses.
Description A True or False value. Byte Data Type Group Data Type Description An 8 bit unsigned integer value. Currency Data Type Group Data Type Description A 64 bit fixed point real. (A twos complement binary value scaled by 10000.) Date Data Type Group Data Type Description A 64 bit real value. The whole part represents the date, while the fractional part is the time of day. (December 30, 1899 = 0.) Use #date# as a literal date value in an expression.
Win32 only. A 96 bit scaled real value. Decimal is not a valid variable type, but Variant variables can contain decimal values (see CDec). A decimal number is of the form: s*m*10^-p where s - sign (+1 or -1) m - mantissa, unsigned binary value of 96 bits (0 to 79,228,162,514,264,337,593,543,950,335) p - scaling power (0 to +28) Double Data Type Group Data Type Description A 64 bit real value. Integer Data Type Group Data Type Description A 16 bit integer value.
Description An object reference value. (see Objects) PortInt Data Type Group Data Type Description A portable integer value. For Win16: A 16 bit integer value. For Win32: A 32 bit integer value. Single Data Type Group Data Type Description A 32 bit real value. String Data Type Group Data Type Description An arbitrary length string value.
vbVerticalTab - same as Chr(11) String*n Data Type Group Data Type Description A fixed length (n) string value. UserDialog Data Type Group Data Type Description A usertype defined by Begin Dialog UserDialog. Variant Data Type Group Data Type Description An empty, numeric, currency, date, string, object, error code, null or array value. Usertype definition User defined types are defined with Type.
Constant Description A variantvar that does not have any value. False Keyword Group Constant Description A condexpr is false when its value is zero. A function that returns False returns the value 0. Nothing Keyword Group Constant Description An objexpr that does not refer to any object. Null Keyword Group Constant Description A variant expression that is null. A null value propagates through an expression causing the entire expression to be Null.
True Keyword Group Constant Description A conditional expression is True when its value is non-zero. A function that returns True returns the value -1. Win16 Keyword Group Constant Description True if running in 16 bits. False if running in 32 bits. Win32 Keyword Group Constant Description True if running in 32 bits. False if running in 16 bits. Friend Keyword Group Declaration Description Friend Functions, Propertys and Subs in a module are available in all other macros/modules that access it.
Main Sub Syntax Sub Main() ... End Sub -orPrivate Sub Main() ... End Sub Group Declaration Description Form 1: Each macro must define Sub Main. A macro is a "program". Running a macro starts the Sub Main and continues to execute until the subroutine finishes. Form 2: A code module may define a Private Sub Main. This Sub Main is the code module initialization subroutine. If Main is not defined then no special initialization occurs. See Also: Code Module.
Private Sub Object_Terminate() ... End Sub Group Declaration Description Object module termination subroutine. Each time an instance is destroyed for a Object module the Object_Terminate sub is called. If Object_Terminate is not defined then no special termination occurs. See Also: Object Module, Object_Initialize. Set Instruction Syntax Set objvar = objexpr -orSet objvar = New objtype Group Assignment Description Form 1: Set objvar's object reference to the object reference of objexpr.
Private Consts, Declares, Functions, Propertys, Subs and Types are only available in the current macro/module. Public Keyword Group Declaration Description Public Consts, Declares, Functions, Propertys, Subs and Types in a module are available in all other macros/modules that access it. AboutWinWrapBasic Instruction Syntax AboutWinWrapBasic [Timeout] Group Miscellaneous Description Show the WinWrap Basic about box.
Description Return the absolute value. Parameter Description Num Return the absolute value of this numeric value. If this value is Null then Null is returned. Example Sub Main Debug.Print Abs(9) ' 9 Debug.Print Abs(0) ' 0 Debug.Print Abs(-9) ' 9 End Sub AppActivate Instruction Syntax AppActivate Title$ -orAppActivate TaskID Group Miscellaneous Description Form 1: Activate the application top-level window titled Title$.
A positional parameter may be skipped by omitting the expression. Only optional parameters may be skipped. Positional parameter assignment is done with expr. Each parameter is assigned in turn. By name parameter assignment may follow. By name parameter assignment is done with param:=expr. All following parameters must be assigned by name. Array Function Syntax Array([expr[, ...]]) Group Conversion Description Return a variant value array containing the exprs. Example Sub Main X = Array(0,1,4,9) Debug.
Group String Description Return the ASCII value. Note: A similar function, AscB, returns the first byte in S$. Another similar function, AscW, returns the Unicode number. Parameter Description S$ Return the ASCII value of the first char in this string value. See Also: Chr$( ). Example Sub Main Debug.
Attribute definition A file attribute is zero or more of the following values added together. Attribute Value vbNormal 0 Normal file. vbReadOnly 1 Read-only file. vbHidden 2 Hidden file. vbSystem 4 System file. vbVolume 8 Volume label. vbDirectory 16 MS-DOS directory. vbArchive 32 File has changes since last backup. Attribute Definition/Statement Syntax Attribute attributename = value Attribute varname.attributename = value Attribute procname.
VB_VarUserMemID - Declares Public varname as the default property for a class module or object module. VB_VarHelpID - Declares the variable's help context displayed by the object browser. VB_VarDescription - Declares the variable's help text displayed by the object browser. Form 3: User defined procedure attribute [Sub | Function | Property [Get|Let|Set] procname ... Attribute procname.VB_UserMemId = 0 Attribute procname.VB_HelpID = int Attribute procname.VB_Description = "text" ...
[User Dialog Item]... End Dialog Group User Dialog Description Define a UserDialog type to be used later in a Dim As UserDialog statement. Parameter Description X This numeric value is the distance from the left edge of the screen to the left edge of the dialog box. It is measured in 1/8ths of the average character width for the dialog's font. If this is omitted then the dialog will be centered. Y This numeric value is the distance from the top edge of the screen to the top edge of the dialog box.
Call Instruction Syntax Call name[(arglist)] -orname [arglist] Group Flow Control Description Evaluate the arglist and call subroutine (or function) name with those values. Sub (or function) name must be previously defined by either a Sub, Function or Property definition. If name is a function then the result is discarded. If Call is omitted then name must be a subroutine and the arglist is not enclosed in parens. See Also: Declare, Sub. Example Sub Show(Title$,Value) Debug.
vbSet 8 Set the property's reference Example Sub Main On Error Resume Next CallByName Err, "Raise", vbMethod, 1 Debug.Print CallByName(Err, "Number", vbGet) ' 1 End Sub CallersLine Function Syntax CallersLine[(Depth)] Group Miscellaneous Description Return the caller's line as a text string. The text format is: "[macroname|subname#linenum] linetext". Parameter Description Depth This integer value indicates how deep into the stack to get the caller's line. If Depth = -1 then return the current line.
Define a cancel button item. Pressing the Cancel button from a Dialog instruction causes a run-time error. (Dialog( ) function call returns 0.) Parameter Description X This numeric value is the distance from the left edge of the screen to the left edge of the dialog box. It is measured in 1/8ths of the average character width for the dialog's font. Y This numeric value is the distance from the top edge of the screen to the top edge of the dialog box.
CByte Function Syntax CByte(Num|$) Group Conversion Description Convert to a byte value. Parameter Description Num|$ Convert a number or string value to a byte value. Example Sub Main Debug.Print CByte(1.6) ' 2 End Sub CCur Function Syntax CCur(Num|$) Group Conversion Description Convert to a currency value. Parameter Description Num|$ Convert a number or string value to a currency value. Example Sub Main Debug.
CDate(Num|$) -orCVDate(Num|$) Group Conversion Description Convert to a date value. Parameter Description Num|$ Convert a number or string value to a date value. Example Sub Main Debug.Print CDate(2) ' 1/1/00 End Sub CDbl Function Syntax CDbl(Num|$) Group Conversion Description Convert to a double precision real. Parameter Description Num|$ Convert a number or string value to a double precision real. Example Sub Main Debug.
Description Win32 only. Convert to a decimal (96 bit scaled real). Parameter Description Num|$ Convert a number or string value to a 96 bit scaled real. Example Sub Main Debug.Print CDec("1E16")+0.1 ' 10000000000000000.1 End Sub charlist definition A group of one or more characters enclosed by [ ] as part of Like operator's right string expression. This list contains single characters and/or character ranges which describe the characters in the list.
ChDrive Instruction Syntax ChDrive Drive$ Group File Description Change the current drive to Drive$. Parameter Description Drive$ This string value is the drive letter. See Also: ChDir, CurDir$( ). Example Sub Main ChDrive "B" Debug.Print CurDir$() '"B:\" End Sub CheckBox Dialog Item Definition Syntax CheckBox X, Y, DX, DY, Title$, .Field[, Options] Group User Dialog Description Define a checkbox item. Parameter Description X This number value is the distance from the left edge of the dialog box.
1 2 Check box is either checked, unchecked or grayed, and it switches between checked and unchecked when clicked. Check box is either checked, unchecked or grayed, and it cycles through all three states as the button is clicked. See Also: Begin Dialog, Dim As UserDialog. Example Sub Main Begin Dialog UserDialog 200,120 Text 10,10,180,15,"Please push the OK button" CheckBox 10,25,180,15,"&Check box",.Check OKButton 80,90,40,20 End Dialog Dim dlg As UserDialog dlg.
Chr$ Function Syntax Chr[$](Num) Group String Description Return a one char string for the ASCII value. Note: A similar function, ChrB, returns a single byte ASCII string. Another similar function, ChrW, returns a single char Unicode string. Parameter Description Num Return one char string for this ASCII numeric value. See Also: Asc( ). Example Sub Main Debug.Print Chr$(48) '"0" End Sub Chr$ Function Syntax Chr[$](Num) Group String Description Return a one char string for the ASCII value.
Chr$ Function Syntax Chr[$](Num) Group String Description Return a one char string for the ASCII value. Note: A similar function, ChrB, returns a single byte ASCII string. Another similar function, ChrW, returns a single char Unicode string. Parameter Description Num Return one char string for this ASCII numeric value. See Also: Asc( ). Example Sub Main Debug.Print Chr$(48) '"0" End Sub CInt Function Syntax CInt(Num|$) Group Conversion Description Convert to a 16 bit integer.
Class_Initialize Sub Syntax Private Sub Class_Initialize() ... End Sub Group Declaration Description Class module initialization subroutine. Each time a new instance is created for a class module, the Class_Initialize sub is called. If Class_Initialize is not defined, then no special initialization occurs. See Also: Code Module, Class_Terminate. Class_Terminate Sub Syntax Private Sub Class_Terminate() ... End Sub Group Declaration Description Class module termination subroutine.
Public Consts, Types, arrays, fixed length strings are not allowed. A class module is similar to a object module except that no instance is automatically created. To create an instance use: C:\ABCTemp\vbs\Dim_Definition00000109.htm Dim Obj As classname Set Obj = New classname Can optionally contain Attributes one of which must be VB_Name. See Also: Attribute Definition/Statement, Code Module, Object Module, Uses. Example 'MyCommands macro '#Uses "File.CLS" Sub Main Dim File As New File File.Attach "C:\AUT
Clipboard Instruction/Function Syntax Clipboard Text$ -orClipboard[$][( )] Group Miscellaneous Description Form 1: Set the clipboard to Text$. This is similar to the Edit|Copy menu command. Form 2: Return the text in the clipboard. Parameter Description Text$ Put this string value into the clipboard. Example Sub Main Debug.Print Clipboard$() Clipboard "Hello" Debug.Print Clipboard$() '"Hello" End Sub CLng Function Syntax CLng(Num|$) Group Conversion Description Convert to a 32 bit long integer.
Close Instruction Syntax Close [[#]StreamNum][, ...] Group File Description Close StreamNums. Parameter Description StreamNum Streams 1 through 255 are private to each macro. Streams 256 through 511 are shared by all macros. If this is omitted then all open streams for the current macro/module are closed. See Also: Open, Reset. Example Sub Main ' read the first line of XXX and print it Open "XXX" For Input As #1 Line Input #1,L$ Debug.
StrArray$( ) This one-dimensional array of strings establishes the list of choices. All the non-null elements of the array are used. Field$ The value of the combo box is accessed via this field. This is the text in the edit box. Options This numeric value controls the type of combo box. Choose one value from following table. (If this numeric value omitted then zero is used.) Option Description 0 List is not sorted. 2 List is sorted. See Also: Begin Dialog, Dim As UserDialog.
condexpr definition An expression that returns a numeric result. If the result is zero then the conditional is False. If the result is non-zero then the conditional is True. 0 'false -1 'true X > 20 'true if X is greater than 20 S$ = "hello" 'true if S$ equals "hello" Const Definition Syntax [ | Private | Public ] _ Const name[type] [As Type] = expr[, ...] Group Declaration Description Define name as the value of expr. The expr can refer to other constants or built-in functions.
Description Return the cosine. Parameter Description Num Return the cosine of this numeric value. This is the number of radians. There are 2*Pi radians in a full circle. Example Sub Main Debug.Print Cos(1) ' 0.54030230586814 End Sub CreateObject Function Syntax CreateObject(Class$) Group Object Description Create a new object of type Class$. Use Set to assign the returned object to an object variable. Parameter Description Class$ This string value is the application's registered class name.
Description Convert to a single precision real. If Num|$ is too big (or too small) to fit then an overflow error occurs. Parameter Description Num|$ Convert a number or string value to a single precision real. Example Sub Main Debug.Print CSng(Sqr(2)) ' 1.4142135381699 End Sub CStr Function Syntax CStr(Num|$) Group Conversion Description Convert to a string. Parameter Description Num|$ Convert a number or string value to a string value. Example Sub Main Debug.Print CStr(Sqr(2)) '"1.
See Also: ChDir, ChDrive. Example Sub Main Debug.Print CurDir$() End Sub CVar Function Syntax CVar(Num|$) Group Conversion Description Convert to a variant value. Parameter Description Num|$ Convert a number or string value (or object reference) to a variant value. Example Sub Main Debug.Print CVar(Sqr(2)) ' 1.4142135623731 End Sub CVErr Function Syntax CVErr(Num|$) Group Conversion Description Convert to a variant that contains an error code. An error code can't be used in expressions.
Debug.Print CVErr(1) ' Error 1 End Sub Date Function Syntax Date[$] Group Time/Date Description Return today's date as a date value. See Also: Now, Time, Timer. Example Sub Main Debug.Print Date ' example: 1/1/1995 End Sub DateAdd Function Syntax DateAdd(interval, number, dateexpr) Group Time/Date Description Return a date value a number of intervals from another date. Parameter Description interval This string value indicates which kind of interval to add. number Add this many intervals.
ww h n s Week Hour Minute Second See Also: DateDiff, DatePart. Example Sub Main Debug.Print DateAdd("yyyy",1,#1/1/2000#) '1/1/2001 End Sub DateDiff Function Syntax DateDiff(interval, dateexpr1, dateexpr2) Group Time/Date Description Return the number of intervals between two dates. Parameter Description interval This string value indicates which kind of interval to subtract. dateexpr1 Calculate the from this date value to dateexpr2. If this value is Null then Null is returned.
dateexpr definition An expression that returns a date result. Use #literal-date# to express a date value. #1/1/2000# ' Jan 1, 2000 Now+7 ' seven days from now DateSerial(Year(Now)+1,Month(Now),Day(Now)) ' one year from now DatePart Function Syntax DatePart(interval, dateexpr) Group Time/Date Description Return the number from the date corresponding to the interval. Parameter Description interval This string value indicates which kind of interval to extract. dateexpr Get the interval from this date value.
Group Time/Date Description Return a date value. Parameter Description Year This numeric value is the year (0 to 9999). (0 to 99 are interpreted by the operating system.) Month This numeric value is the month (1 to 12). Day This numeric value is the day (1 to 31). See Also: DateValue, TimeSerial, TimeValue. Example Sub Main Debug.Print DateSerial(2000,7,4) '7/4/2000 End Sub DateValue Function Syntax DateValue(Date$) Group Time/Date Description Return the day part of the date encoded as a string.
Group Time/Date Description Return the day of the month (1 to 31). Parameter Description dateexpr Return the day of the month for this date value. If this value is Null then Null is returned. See Also: Date( ), Month( ), Weekday( ), Year( ). Example Sub Main Debug.Print Day(#1/1/1900#) ' 1 Debug.Print Day(#1/2/1900#) ' 2 End Sub DDEExecute Instruction Syntax DDEExecute ChanNum, Command$[, Timeout] Group DDE Description Send the DDE Execute Command$ string via DDE ChanNum.
DDEInitiate Function Syntax DDEInitiate(App$, Topic$) Group DDE Description Initiate a DDE conversation with App$ using Topic$. If the conversation is successfully started then the return value is a channel number that can be used with other DDE instructions and functions. Parameter Description App$ Locate this server application. Topic$ This is the server application's topic. The interpretation of this value is defined by the server application.
DDEPoke ChanNum,"Group","XXX" DDETerminate ChanNum End Sub DDERequest$ Function Syntax DDERequest[$](ChanNum, Item$[, Timeout]) Group DDE Description Request information for Item$. If the request is not satisfied then the return value will be a null string. Parameter Description ChanNum This is the channel number returned by the DDEInitiate function. Up to 10 channels may be used at one time. Item$ This is the server application's item.
Example Sub Main ChanNum = DDEInitiate("PROGMAN","PROGMAN") DDEExecute ChanNum,"[CreateGroup(XXX)]" DDETerminate ChanNum End Sub DDETerminateAll Instruction Syntax DDETerminateAll Group DDE Description Terminate all open DDE channels. Example Sub Main ChanNum = DDEInitiate("PROGMAN","PROGMAN") DDEExecute ChanNum,"[CreateGroup(XXX)]" DDETerminateAll End Sub Debug Object Syntax Debug.Clear -orDebug.Print [expr[; ...][;]] Group Miscellaneous Description Form 1: Clear the output window.
Sub Main X=4 Debug.Print "X/2=";X/2 ' 2 Debug.Print "Start..."; ' don't print a new line Debug.Print "Finish" ' print a new line End Sub Declare Definition Syntax [ | Private | Public ] _ Declare Sub name Lib "dll name" _ [Alias "module name"] [([param[, ...]])] -or[ | Private | Public ] _ Declare Function name[type] Lib "dll name" _ [Alias "module name"] [([param[, ...]])] [As type[()]] Group Declaration Description Interface to a DLL defined subroutine or function.
Example Declare Function GetForegroundWindow& Lib "user32" () Declare Function GetWindowTextLengthA& Lib "user32"(ByVal hwnd&) Declare Sub GetWindowTextA Lib "user32"(ByVal hwnd&, ByVal lpsz$, ByVal cbMax&) Function ActiveWindowTitle$() ActiveWindowTitle$ = vbCr ActiveWindow = GetForegroundWindow() TitleLen = GetWindowTextLengthA(ActiveWindow) If TitleLen > 0 Then TitleLen = TitleLen + 1 Title$ = Space$(TitleLen) GetWindowTextA ActiveWindow,Title$,TitleLen ActiveWindowTitle$ = Title$ End If End Function C:
letter-letter alphabetically before the second letter. Variable names that begin with a letter in this range default to declared type. If a variable name begins with a letter not specific in any letterrange then the variable is a Variant. The letterranges are not allowed to overlap. See Also: Option. Example DefInt A,C-W,Y' integer DefBool B ' boolean DefStr X ' string ' all others are variant C:\ABCTemp\vbs\Sub_Definition.htm Sub Main B = 1 ' B is an boolean Debug.
dialogfunc definition A dialog function executes while a UserDialog is visible. DialogFunc Prototype Syntax Function dialogfunc(DlgItem$, Action%, SuppValue%) _ As Boolean Select Case Action% Case 1 ' Dialog box initialization ... Case 2 ' Value changing or button pressed ... Case 3 ' TextBox or ComboBox text changed ... Case 4 ' Focus changed ... Case 5 ' Idle ... Case 6 ' Function key ...
shift/control/alt key state. Regular function keys range from 1 to 24. Shift function keys have &H100 added. Control function keys have &H200 added. Alt function keys have &H400 added. (Alt-F4 closes the dialog and is never passed to the Dialog Function.) See Also: Begin Dialog. Example Sub Main Begin Dialog UserDialog 200,120,.DialogFunc Text 10,10,180,15,"Please push the OK button" TextBox 10,40,180,15,.Text OKButton 30,90,60,20 PushButton 110,90,60,20,"&Hello" End Dialog Dim dlg As UserDialog Debug.
Description Display the dialog associated with dialogvar. The initial values of the dialog fields are provided by dialogvar. If the OK button or any push button is pressed then the fields in dialog are copied to the dialogvar. The Dialog( ) function returns a value indicating which button was pressed. (See the result table below.) Parameter Description dlgvar This variable that holds the values of the fields in a dialog. Use field to access individual fields in a dialog variable.
Description Dimension var array(s) using the dims to establish the minimum and maximum index value for each dimension. If the dims are omitted then a scalar (single value) variable is defined. A dynamic array is declared using ( ) without any dims. It must be ReDimensioned before it can be used. See Also: Begin Dialog, Dialog, Option Base, Private, Public, ReDim, Static, WithEvents. Example Sub DoIt(Size) Dim C0,C1(),C2(2,3) ReDim C1(Size) ' dynamic array C0 = 1 C1(0) = 2 C2(0,0) = 3 Debug.
DlgControlId Function Syntax DlgControlId(DlgItem|$) Group Dialog Function Description Return the field's window id. This instruction/function must be called directly or indirectly from a dialogfunc. Parameter Description DlgItem|$ If this is a numeric value then it is the dialog item number. The first item is 0, second is 1, etc. If this is a string value then it is the dialog item's field name. Example Sub Main Begin Dialog UserDialog 200,120,.
DlgCount Function Syntax DlgCount() Group Dialog Function Description Return the number of dialog items in the dialog. This instruction/function must be called directly or indirectly from a dialogfunc. Example Sub Main Begin Dialog UserDialog 200,120,.DialogFunc Text 10,10,180,15,"Please push the OK button" TextBox 10,40,180,15,.Text OKButton 30,90,60,20 End Dialog Dim dlg As UserDialog Dialog dlg End Sub C:\ABCTemp\vbs\Function_Definition.htm Function DialogFunc%(DlgItem$, Action%, SuppValue%) Debug.
Example Sub Main Begin Dialog UserDialog 210,120,.DialogFunc Text 10,10,190,15,"Please push the Close button" OKButton 30,90,60,20 CheckBox 120,90,60,20,"&Close",.CheckBox1 End Dialog Dim dlg As UserDialog Debug.Print Dialog(dlg) End Sub C:\ABCTemp\vbs\Function_Definition.htm Function DialogFunc%(DlgItem$, Action%, SuppValue%) Debug.
Sub Main Begin Dialog UserDialog 210,120,.DialogFunc Text 10,10,190,15,"Please push the OKButton" OKButton 30,90,60,20 PushButton 110,90,60,20,"&Disable" End Dialog Dim dlg As UserDialog Debug.Print Dialog(dlg) End Sub C:\ABCTemp\vbs\Function_Definition.htm Function DialogFunc%(DlgItem$, Action%, SuppValue%) Debug.
Begin Dialog UserDialog 200,120,.DialogFunc Text 10,10,180,15,"Please push the OK button" TextBox 10,40,180,15,.Text OKButton 30,90,60,20 PushButton 110,90,60,20,"&Hello" End Dialog Dim dlg As UserDialog Debug.Print Dialog(dlg) End Sub C:\ABCTemp\vbs\Function_Definition.htm Function DialogFunc%(DlgItem$, Action%, SuppValue%) Debug.
C:\ABCTemp\vbs\Sub_Definition.htm Sub Main ReDim lists$(0) lists$(0) = "List 0" Begin Dialog UserDialog 200,119,.DialogFunc Text 10,7,180,14,"Please push the OK button" ListBox 10,21,180,63,lists(),.list OKButton 30,91,40,21 PushButton 110,91,60,21,"&Change" End Dialog Dim dlg As UserDialog dlg.list = 2 Dialog dlg ' show dialog (wait for ok) Debug.Print dlg.list End Sub C:\ABCTemp\vbs\Function_Definition.
OKButton 30,90,60,20 End Dialog Dim dlg As UserDialog Dialog dlg End Sub C:\ABCTemp\vbs\Function_Definition.htm Function DialogFunc%(DlgItem$, Action%, SuppValue%) Debug.Print "Action=";Action% Select Case Action% Case 1 ' Dialog box initialization Beep For I = 0 To DlgCount()-1 Debug.Print I;DlgName(I) Next I End Select End Function DlgNumber Function Syntax DlgNumber(DlgItem$) Group Dialog Function Description Return the number of the DlgItem$. The first item is 0, second is 1, etc.
End Select End Function DlgSetPicture Instruction Syntax DlgSetPicture DlgItem|$, FileName, Type Group Dialog Function Description Instruction: Set the file name for DlgItem|$. This instruction/function must be called directly or indirectly from a dialogfunc. Parameter Description DlgItem|$ If this is a numeric value then it is the dialog item number. The first item is 0, second is 1, etc. If this is a string value then it is the dialog item's field name.
End Select End Function DlgText Instruction/Function Syntax DlgText DlgItem|$, Text -orDlgText[$](DlgItem|$) Group Dialog Function Description Instruction: Set the text for DlgItem|$. Function: Return the text from DlgItem|$. This instruction/function must be called directly or indirectly from a dialogfunc. Parameter Description DlgItem|$ If this is a numeric value then it is the dialog item number. The first item is 0, second is 1, etc. If this is a string value then it is the dialog item's field name.
DlgType Function Syntax DlgType[$](DlgItem|$) Group Dialog Function Description Return a string value indicating the type of the DlgItem|$. One of: "CancelButton", "CheckBox", "ComboBox", "DropListBox", "GroupBox", "ListBox", "MultiListBox", "OKButton", "OptionButton", "OptionGroup", "PushButton", "Text", "TextBox". This instruction/function must be called directly or indirectly from a dialogfunc. Parameter Description DlgItem|$ If this is a numeric value then it is the dialog item number.
Group Dialog Function Description Instruction: Set the numeric value DlgItem|$. Function: Return the numeric value for DlgItem|$. (A MultiListBox user dialog item returns an array.) This instruction/function must be called directly or indirectly from a dialogfunc. The DlgItem|$ should refer to a CheckBox, ComboBox, DropListBox, ListBox, MultiListBox, or OptionGroup. Parameter Description DlgItem|$ If this is a numeric value then it is the dialog item number. The first item is 0, second is 1, etc.
dlgvar definition A dialog variable holds values for fields in the dialog. Dialog variables are declared using Dim dlgvar As UserDialog. DlgVisible Instruction/Function Syntax DlgVisible DlgItem|$[, Visible] -orDlgVisible(DlgItem|$) Group Dialog Function Description Instruction: Show or hide DlgItem|$. Function: Return True if DlgItem|$ is visible. This instruction/function must be called directly or indirectly from a dialogfunc.
DlgText DlgItem$,"&Hide" DlgVisible "Text",True DialogFunc% = True 'do not exit the dialog End Select End Select End Function Do Statement Syntax Do statements Loop -orDo {Until|While} condexpr statements Loop -orDo statements Loop {Until|While} condexpr Group Flow Control Description Form 1: Do statements forever. The loop can be exited by using Exit or Goto. Form 2: Check for loop termination before executing the loop the first time. Form 3: Execute the loop once and then check for loop termination.
DoEvents Instruction Syntax DoEvents Group Miscellaneous Description This instruction allows other applications to process events. Example Sub Main DoEvents ' let other apps work End Sub DropListBox Dialog Item Definition Syntax DropListBox X, Y, DX, DY, StrArray$( ), .Field[, Options] Group User Dialog Description Define a drop-down listbox item. Parameter Description X This number value is the distance from the left edge of the dialog box.
See Also: Begin Dialog, Dim As UserDialog. Example Sub Main Dim lists$(3) lists$(0) = "List 0" lists$(1) = "List 1" lists$(2) = "List 2" lists$(3) = "List 3" Begin Dialog UserDialog 200,120 Text 10,10,180,15,"Please push the OK button" DropListBox 10,25,180,60,lists$(),.list1 DropListBox 10,50,180,60,lists$(),.list2,1 OKButton 80,90,40,20 End Dialog Dim dlg As UserDialog dlg.list1 = 2 ' list1 is a numeric field dlg.list2 = "xxx" ' list2 is a string field Dialog dlg ' show dialog (wait for ok) Debug.
Enum Definition Syntax [ | Private | Public ] _ Enum name elem [ = value] [...] End Enum Group Declaration Description Define a new userenum. Each elem defines an element of the enum. If value is given then that is the element's value. The value can be any constant integer expression. If value is omitted then the element's value is one more than the previous element's value. If there is no previous element then zero is used. Enum defaults to Public if neither Private or Public is specified.
Return an environment string. Parameter Description Index Return this environment string's value. If there is no environment string at this index a null string is returned. Indexes start at one. Name Return this environment string's value. If the environment string can't be found a null string is returned. Example Sub Main Debug.Print Environ("Path") End Sub EOF Function Syntax EOF(StreamNum) Group File Description Return True if StreamNum is at the end of the file.
Assignment Description Reset arrayvar or user defined type array element to zero. (Dynamic arrays are reset to undimensioned arrays.) String arrays values are set to a null string. arrayvar must be declared as an array. Declare with Dim, Private, Public or Static. Declare as a parameter of Sub, Function or Property definition. Example Sub Main Dim X%(2) X%(1) = 1 Erase X% Debug.Print X%(1) ' 0 End Sub Err Object Syntax Err Group Error Handling Description Set Err to zero to clear the last error event.
[, [Description:=]errordesc] _ [, [HelpFile:=]helpfile] _ [, [HelpContext:=]context] Raise an error event. Err.LastDLLError For 32 bit windows this returns the error code for the last DLL call (see Declare). For 16 bit windows this always returns 0.
Eval Function Syntax Eval(Expr[, Depth]) Group Miscellaneous Description Return the value of the string expression as evaluated. Parameter Description Expr Evaluate this string value. Depth This integer value indicates how deep into the stack to locate the local variables. If Depth = 0 then use the current procedure. If this value is omitted then the depth is 0. Example Sub Main Dim X As String X = "Hello" Debug.Print Eval("X") 'Hello A End Sub Sub A Dim X As String X = "Bye" Debug.
Function Property Sub While Exit Exit Exit Exit the the the the Function block. Note: This instruction clears the Err and sets Error$ to null. Property block. Note: This instruction clears the Err and sets Error$ to null. Sub block. Note: This instruction clears the Err and sets Error$ to null. While loop. Example Sub Main L$ = InputBox$("Enter Do, For, While, Sub or All:") Debug.Print "Before DoSub" DoSub UCase$(L$) Debug.Print "After DoSub" End Sub C:\ABCTemp\vbs\Sub_Definition.
2.718282. Example Sub Main Debug.Print Exp(1) ' 2.718281828459 End Sub Expr definition An expression that returns the appropriate result. Field definition Use .field to access individual fields in a dialog variable. dlg.Name$ dlg.ZipCode FileAttr Function Syntax FileAttr(StreamNum, ReturnValue) Group File Description Return StreamNum's open mode or file handle. Parameter Description StreamNum Streams 1 through 255 are private to each macro. Streams 256 through 511 are shared by all macros.
FileCopy Instruction Syntax FileCopy FromName$, ToName$ Group File Description Copy a file. Parameter Description FromName$ This string value is the path and name of the source file. A path relative to the current directory can be used. ToName$ This string value is the path and name of the destination file. A path relative to the current directory can be used. Example Sub Main FileCopy "C:\AUTOEXEC.BAT","C:\AUTOEXEC.
Wend End Sub FileLen Function Syntax FileLen(Name$) Group File Description Return the length of file Name$. If the file does not exist then a run-time error occurs. Parameter Description Name$ This string value is the path and name of the file. A path relative to the current directory can be used. Example Sub Main F$ = Dir$("*.*") While F$ <> "" Debug.Print F$;" ";FileLen(F$) F$ = Dir$() Wend End Sub Fix Function Syntax Fix(Num) Group Math Description Return the integer value.
Debug.Print Fix(9.9) ' 9 Debug.Print Fix(0) ' 0 Debug.Print Fix(-9.9) '-9 End Sub For Statement Syntax For Num = First To Last [Step Inc] statements Next [Num] Group Flow Control Description Execute statements while Num is in the range First to Last. Parameter Description Num This is the iteration variable. First Set Num to this value initially. Last Continue looping while Num is in the range. See Step below.
Description Execute statements for each item in items. Parameter Description ar This is the iteration variable. items This is the collection of items to be done. See Also: Do, For, Exit For, While. Example Sub Main Dim Document As Object For Each Document In App.Documents Debug.Print Document.Title Next Document End Sub Format$ Function Syntax Format[$](expr[, form$], [firstday], _ [firstweek]) Group String Description Return the formatted string representation of expr.
vbFirstFourDays 2 vbFirstFullWeek 3 The first week that has at least four days in the year. The first week that entirely in the year. See Also: Predefined Date Format, Predefined Number Format, User defined Date Format, User defined Number Format, User defined Text Format. FreeFile Function Syntax FreeFile[( )] Group File Description Return the next unused shared stream number (greater than or equal to 256). Streams 1 through 255 are private to each macro.
[ | Private | Public | Friend ] _ Function name[type][([param[, ...]])] [As type[()]] statements End Function Group Declaration Description User defined function. The function defines a set of statements to be executed when it is called. The values of the calling arglist are assigned to the params. Assigning to name[type] sets the value of the function result. Function defaults to Public if Private, Public or Friend are not is specified. See Also: Declare, Property, Sub.
variable each element is read in sequence. For a dynamic array variable the number of dimensions and range of each dimension is read prior to reading the array values. All binary data values are read from the file in little-endian format. Note: When reading a string (or a dynamic array) from a Binary mode file the length (or array dimension) information is not read. The current string length determines how much string data is read. The current array dimension determines how may array elements are read.
GetAttr Function Syntax GetAttr(Name$) Group File Description Return the attributes for file Name$. If the file does not exist then a run-time error occurs. Parameter Description Name$ This string value is the path and name of the file. A path relative to the current directory can be used. Example Sub Main F$ = Dir$("*.*") While F$ <> "" Debug.
0 1 2 3 Only allow the user to select a file that exists. Confirm creation when the user selects a file that does not exist. Allow the user to select any file whether it exists or not. Confirm overwrite when the user selects a file that exists. +4 Selecting a different directory changes the application's current directory. Example Sub Main Debug.Print GetFilePath$() End Sub GetObject Function Syntax GetObject([File$][, Class$]) Group Object Description Get an existing object of type Class$ from File$.
Settings Description Get the setting for Key in Section in project AppName. Win16 and Win32s store settings in a .ini file named AppName. Win32 stores settings in the registration database. Parameter Description AppName$ This string value is the name of the project which has this Section and Key. Section$ This string value is the name of the section of the project settings. Key$ This string value is the name of the key in the section of the project settings.
User Dialog Description Define a groupbox item. Parameter Description X This number value is the distance from the left edge of the dialog box. It is measured in 1/8ths of the average character width for the dialog's font. Y This number value is the distance from the top edge of the dialog box. It is measured in 1/12ths of the character height for the dialog's font. DX This number value is the width. It is measured in 1/8ths of the average character width for the dialog's font.
Hour Function Syntax Hour(dateexpr) Group Time/Date Description Return the hour of the day (0 to 23). Parameter Description dateexpr Return the hour of the day for this date value. If this value is Null then Null is returned. See Also: Minute( ), Second( ), Time( ). Example Sub Main Debug.Print Hour(#12:00:01 AM#) ' 0 End Sub If Statement Syntax If condexpr Then [instruction] [Else instruction] -orIf condexpr Then statements [ElseIf condexpr Then statements]...
the following statements to be executed. If all are False then the Else's statements are executed. The ElseIf and Else portions are optional. Form 3: If objexpr's type is the same type or a type descended from objtype the Then portion is executed. See Also: Select Case, Choose( ), IIf( ). Example Sub Main S = InputBox("Enter hello, goodbye, dinner or sleep:") S = UCase(S) If S = "HELLO" Then Debug.Print "come in" If S = "GOODBYE" Then Debug.Print "see you later" If S = "DINNER" Then Debug.
Input Instruction Syntax Input [#]StreamNum, var[, ...] Group File Description Get input from StreamNum and assign it to vars. Input values are comma delimited. Leading and trailing spaces are ignored. If the first char (following the leading spaces) is a quote (") then the string is terminated by an ending quote. Special values #NULL#, #FALSE#, #TRUE#, #date# and #ERROR number# are converted to their appropriate value and data type. See Also: Line Input, Print, Write.
End Sub InputBox$ Function Syntax InputBox[$](Prompt$[, Title$][, Default$][, XPos, YPos]) Group User Input Description Display an input box where the user can enter a line of text. Pressing the OK button returns the string entered. Pressing the Cancel button returns a null string. Parameter Description Prompt$ Use this string value as the prompt in the input box. Title$ Use this string value as the title of the input box. If this is omitted then the input box does not have a title.
Index S1$ S2$ Start searching for S2$ at this index in S1$. If this is omitted then start searching from the beginning of S1$. Search for S2$ in this string value. If this value is Null then Null is returned. Search S1$ for this string value. If this value is Null then Null is returned. See Also: InStrRev( ), Left$( ), Len( ), Mid$( ), Replace$( ), Right$( ). Example Sub Main Debug.
Description Return the index where S2$ last matches S1$. If no match is found return 0. Parameter Description S1$ Search for S2$ in this string value. If this value is Null then Null is returned. S2$ Search S1$ for this string value. If this value is Null then Null is returned. Index Start searching for S2$ ending at this index in S1$. If this is omitted then start searching from the end of S1$. See Also: Left$( ), Len( ), Mid$( ), Replace$( ), Right$( ). Example Sub Main Debug.
Debug.Print Int(-9.9) '-10 End Sub Is Operator Syntax expr Is expr Group Operator Description Return the True if both exprs refer to the same object. See Also: Objects. Example Sub Main Dim X As Object Dim Y As Object Debug.Print X Is Y ' True End Sub IsArray Function Syntax IsArray(var) Group Variable Info Description Return the True if var is an array of values. Parameter Description var A array variable or a variant var can contain multiple of values. See Also: TypeName, VarType.
X=Y Debug.Print IsArray(X) 'True End Sub IsDate Function Syntax IsDate(expr) Group Variable Info Description Return the True if expr is a valid date. Parameter Description expr A variant expression to test for a valid date. See Also: TypeName, VarType. Example Sub Main Dim X As Variant X=1 Debug.Print IsDate(X) 'False X = Now Debug.Print IsDate(X) 'True End Sub IsEmpty Function Syntax IsEmpty(variantvar) Group Variable Info Description Return the True if variantvar is Empty.
Sub Main Dim X As Variant Debug.Print IsEmpty(X) 'True X=0 Debug.Print IsEmpty(X) 'False X = Empty Debug.Print IsEmpty(X) 'True End Sub IsError Function Syntax IsError(expr) Group Variable Info Description Return the True if expr is an error code. Parameter Description expr A variant expression to test for an error code value. See Also: TypeName, VarType. Example Sub Main Dim X As Variant Debug.Print IsError(X) 'False X = CVErr(1) Debug.
variantvar Return True if this variant parameter's argument expression was not specified in the Sub, Function or Property call. Example Sub Main Opt 'IsMissing(A)=True Opt "Hi" 'IsMissing(A)=False Many 'No args Many 1,"Hello" 'A(0)=1 A(1)=Hello OptBye '"Bye" OptBye "No" '"No" End Sub C:\ABCTemp\vbs\Sub_Definition.htm Sub Opt(Optional A) Debug.Print "IsMissing(A)=";IsMissing(A) End Sub C:\ABCTemp\vbs\Sub_Definition.htm Sub Many(ParamArray A()) If LBound(A) > UBound(A) Then Debug.
Sub Main Dim X As Variant X=1 Debug.Print IsNumeric(X) 'True X = "1" Debug.Print IsNumeric(X) 'True X = "A" Debug.Print IsNumeric(X) 'False End Sub IsNull Function Syntax IsNull(expr) Group Variable Info Description Return the True if expr is Null. Parameter Description expr A variant expression to test for Null. See Also: TypeName, VarType. Example Sub Main Dim X As Variant Debug.Print IsEmpty(X) 'True Debug.Print IsNull(X) 'False X=1 Debug.Print IsNull(X) 'False X = "1" Debug.
Variable Info Description Return the True if var contains an object reference. Parameter Description var A var contains an object reference if it is objexpr reference. See Also: TypeName, VarType. Example Sub Main Dim X As Variant X=1 Debug.Print IsObject(X) 'False X = "1" Debug.Print IsObject(X) 'False Set X = Nothing Debug.Print IsObject(X) 'True End Sub KeyName Function Syntax KeyName(Key) Group Miscellaneous Description Return the key name for a key number. This is the name used by SendKeys.
Group File Description Delete the file named by Name$. Parameter Description Name$ This string value is the path and name of the file. A path relative to the current directory can be used. Example Sub Main Kill "XXX" End Sub Label definition An identifier that names a statement. Identifiers start with a letter. Following chars may be a letter, an underscore or a digit. LBound Function Syntax LBound(arrayvar[, dimension]) Group Variable Info Description Return the lowest index.
LCase$ Function Syntax LCase[$](S$) Group String Description Return a string from S$ where all the uppercase letters have been lowercased. Parameter Description S$ Return the string value of this after all chars have been converted to lowercase. If this value is Null then Null is returned. See Also: StrComp( ), StrConv$( ), UCase$( ). Example Sub Main Debug.
Left$ Function Syntax Left[$](S$, Len) Group String Description Return a string from S$ with only the Len chars. Note: A similar function, LeftB, returns the first Len bytes. Parameter Description S$ Return the left portion of this string value. If this value is Null then Null is returned. Len Return this many chars. If S$ is shorter than that then just return S$. See Also: InStr( ), InStrRev( ), Len( ), Mid$( ), Replace$( ), Right$( ). Example Sub Main Debug.
Example Sub Main Debug.Print Len("Hello") ' 5 End Sub Len Function Syntax Len(S$) -orLen(usertypevar) Group String Description Return the number of characters in S$. Note: A similar function, LenB, returns the number of bytes in the string. For a usertypevar, LenB returns the number of bytes of memory occupied by the variable's data. Parameter Description S$ Return the number of chars in this string value. If this value is Null then Null is returned.
Assign the value of expr to var. The keyword Let is optional. Example Sub Main Let X = 1 X = X*2 Debug.Print X ' 2 End Sub Like Operator Syntax str1 Like str2 Group Operator Description Return the True if str1 matches pattern str2. The pattern in str2 is one or more of the special character sequences shown in the following table.
Group File Description Get a line of input from StreamNum and assign it to S$. See Also: Input, Print, Write. Example Sub Main Open "XXX" For Input As #1 Line Input #1,S$ Debug.Print S$ Close #1 End Sub Line Input Instruction Syntax Line Input [#]StreamNum, S$ Group File Description Get a line of input from StreamNum and assign it to S$. See Also: Input, Print, Write. Example Sub Main Open "XXX" For Input As #1 Line Input #1,S$ Debug.
User Dialog Description Define a listbox item. Parameter Description X This number value is the distance from the left edge of the dialog box. It is measured in 1/8ths of the average character width for the dialog's font. Y This number value is the distance from the top edge of the dialog box. It is measured in 1/12ths of the character height for the dialog's font. DX This number value is the width. It is measured in 1/8ths of the average character width for the dialog's font.
Loc Function Syntax Loc(StreamNum) Group File Description Return StreamNum file position. For Random mode files this is the current record number minus one. For Binary mode files it is the current byte position minus one. Otherwise, it is the current byte position minus one divided by 128. The first position in the file is 0. Parameter Description StreamNum Streams 1 through 255 are private to each macro. Streams 256 through 511 are shared by all macros.
StreamNum Streams 1 through 255 are private to each macro. Streams 256 through 511 are shared by all macros. RecordNum For Random mode files this is the record number. The first record is 1. Otherwise, it is the byte position. The first byte is 1. start First record (or byte) in the range. end Last record (or byte) in the range. See Also: Open, Unlock. Example Sub Main Dim V As Variant Open "SAVE_V.
Log(Num) Group Math Description Return the natural logarithm. Parameter Description Num Return the natural logarithm of this numeric value. The value e is approximately 2.718282. Example Sub Main Debug.Print Log(1) ' 0 End Sub LSet Instruction Syntax LSet strvar = str -orLSet usertypevar1 = usertypevar2 Group Assignment Description Form 1: Assign the value of str to strvar. Shorten str by removing trailing chars (or extend with blanks). The previous length strvar is maintained.
LTrim$ Function Syntax LTrim[$](S$) Group String Description Return the string with S$'s leading spaces removed. Parameter Description S$ Copy this string without the leading spaces. If this value is Null then Null is returned. See Also: RTrim$( ), Trim$( ). Example Sub Main Debug.Print ".";LTrim$(" x ");"." '".x ." End Sub Macro definition A macro is like an application. Execution starts at the macro's Sub Main.
Debug.Print S$ Close #1 End Sub MacroRun Instruction Syntax MacroRun MacroName$[, Command$] Group Flow Control Description Play a macro. Parameter MacroName$ Command$ Execution will continue at the following statement after the macro has completed. Description Run the macro named by this string value. Pass this string value as the macro's Command$ value. See Also: Command$, MacroDir$, MacroRunThis. Example Sub Main Debug.Print "Before Demo" MacroRun "Demo" Debug.
Sub Main Debug.Print "Before Demo" MacroRunThis "MsgBox ""Hello""" Debug.Print "After Demo" End Sub Me Object Syntax Me Group Object Description Me references the current macro/module. It can be used like any other object variable, except that it's reference can't be changed. See Also: Set. Example Sub Main DoIt Me.DoIt ' calls the same sub End Sub Sub DoIt MsgBox "Hello" End Sub Method definition An object provides methods and properties.
Mid[$](strvar, Index[, Len]) = S$ Group String Description Function: Return the substring of S$ starting at Index for Len chars. Instruction: Assign S$ to the substring in strvar starting at Index for Len chars. Note: A similar function, MidB, returns the Len bytes starting a byte Index. Parameter Description (Mid Function) S$ Copy chars from this string value. If this value is Null then Null is returned. Index Start copying chars starting at this index value.
Instruction: Assign S$ to the substring in strvar starting at Index for Len chars. Note: A similar function, MidB, returns the Len bytes starting a byte Index. Parameter Description (Mid Function) S$ Copy chars from this string value. If this value is Null then Null is returned. Index Start copying chars starting at this index value. If the string is not that long then return a null string. Len Copy this many chars. If the S$ does not have that many chars starting at Index then copy the remainder of S$.
MkDir Instruction Syntax MkDir Name$ Group File Description Make directory Name$. Parameter Description Name$ This string value is the path and name of the directory. A path relative to the current directory can be used. See Also: RmDir. Example Sub Main MkDir "C:\WWTEMP" End Sub Module definition A file with public symbols that are accessible by other modules/macros via the #Uses comment. A module is loaded on demand. A code module is a code library.
Parameter Description dateexpr Return the month of the year for this date value. If this value is Null then Null is returned. See Also: Date( ), Day( ), MonthName( ), Weekday( ), Year( ). Example Sub Main Debug.Print Month(#1/1/1900#) ' 1 Debug.Print Month(#2/1/1900#) ' 2 End Sub MonthName Function Syntax MonthName(NumZ{month}[, CondZ{abbrev}]) Group Time/Date Description Return the localized name of the month. Parameter Description month Return the localized name of this month.
Description Show a message box titled Title$. Type controls what the message box looks like (choose one value from each category). Use MsgBox( ) if you need to know what button was pressed. The result indicates which button was pressed. Result Value Button Pressed vbOK 1 OK button vbCancel 2 Cancel button vbAbort 3 Abort button vbRetry 4 Retry button vbIgnore 5 Ignore button vbYes 6 Yes button vbNo 7 No button Parameter Description Message$ This string value is the text that is shown in the message box.
MultiListBox Dialog Item Definition Syntax MultiListBox X, Y, DX, DY, StrArray$( ), .Field[, Options] Group User Dialog Description Define a multiple selection listbox item. Parameter Description X This number value is the distance from the left edge of the dialog box. It is measured in 1/8ths of the average character width for the dialog's font. Y This number value is the distance from the top edge of the dialog box. It is measured in 1/12ths of the character height for the dialog's font.
Name definition An identifier that names a variable or a user defined procedure. Identifiers start with a letter. Following chars may be a letter, an underscore or a digit. Count DaysTill2000 Get_Data Name Instruction Syntax Name OldName$ As NewName$ Group File Description Rename file OldName$ as NewName$. Parameter Description OldName$ This string value is the path and name of the file. A path relative to the current directory can be used. NewName$ This is the new file name (and path).
See Also: Date, Time, Timer. Example Sub Main Debug.Print Now ' example: 1/1/1995 10:05:32 AM End Sub Num definition An expression that returns a numeric result. Use &O to express an octal number. Use &H to express a hex number. Numvar definition A variable that holds one numeric value. The name of a numeric variable may be followed by the appropriate type char. Objexpr definition A expression that returns a reference to an object or module. CreateObject("WinWrap.
Oct$ Function Syntax Oct[$](Num) Group String Description Return a octal string. Parameter Description Num Return an octal encoded string for this numeric value. See Also: Hex$( ), Str$( ), Val( ). Example Sub Main Debug.Print Oct$(15) '17 End Sub OKButton Dialog Item Definition Syntax OKButton X, Y, DX, DY[, .Field] Group User Dialog Description Define an OK button item. Pressing the OK button updates the dlgvar field values and closes the dialog. (Dialog( ) function call returns -1.
Begin Dialog UserDialog 200,120 Text 10,10,180,30,"Please push the OK button" OKButton 80,90,40,20 End Dialog Dim dlg As UserDialog Dialog dlg ' show dialog (wait for ok) End Sub On Error Instruction Syntax On Error GoTo 0 -orOn Error GoTo label -orOn Error Resume Next Group Error Handling Description Form 1: Disable the error handler (default). Form 2: Send error conditions to an error handler. Form 3: Error conditions continue execution at the next statement.
Open Instruction Syntax Open Name$ For mode [Access access] [lock] As _ [#]StreamNum [Len = RecordLen] Group File Description Open file Name$ for mode as StreamNum. Parameter Description Name$ This string value is the path and name of the file. A path relative to the current directory can be used. mode May be Input, Output, Append, Binary or Random. access May be Read, Write or Read Write. lock May be Shared, Lock Read, Lock Write or Lock Read Write.
Form 2: Require all variables to be declared prior to use. Variables are declared using Dim, Private, Public, Static or as a parameter of Sub, Function or Property blocks. Form 3: Public symbols defined by the module are only accessible from the same project. See Also: Dim, Private, Public, ReDim, Static. Example Option Base 1 Option Explicit C:\ABCTemp\vbs\Sub_Definition.
OKButton 80,90,40,20 End Dialog Dim dlg As UserDialog dlg.options = 2 Dialog dlg ' show dialog (wait for ok) Debug.Print dlg.options End Sub OptionGroup Dialog Item Definition Syntax OptionGroup .Field OptionButton X, Y, DX, DY, Title$[, .Field] OptionButton X, Y, DX, DY, Title$[, .Field] ... Group User Dialog Description Define a optiongroup and option button items. Parameter Description Field The value of the option group is accessed via this field. This first option button is 0, the second is 1, etc.
Param definition [ [Optional] [ | ByVal | ByRef ] | ParamArray ] param[type][( )] [As type] [ = defaultvalue ] The param receives the value of the associated expression in the Declare, Sub, Function or Property call. (See arglist.) An Optional param may be omitted from the call. It may also have a defaultvalue. The parameter receives the default value if a value is not specified by the call.
0 3 +16 FileName is the name of the bitmap file. If the file does not exist then "(missing picture)" is displayed. The clipboard's bitmap is displayed. Not supported. Instead of displaying "(missing picture)" a run-time error occurs. See Also: Begin Dialog, Dim As UserDialog. Example Sub Main Begin Dialog UserDialog 200,120 Picture 10,10,180,75,"SAMPLE.
Print #StreamNum, [expr[; ...][;]] Group File Description Print the expr(s) to StreamNum. Use ; to separate expressions. A num is it automatically converted to a string before printing (just like Str$( )). If the instruction does not end with a semicolon, then a new line is printed at the end. See Also: Input, Line Input, Write.
Sub Main Init Debug.Print A0;A1(0);A2(0,0) ' 1 2 3 End Sub Procedure definition A subroutine, function or property. Property definition An object provides methods and properties. Properties may be used as values (like a function call) or changed (using assignment syntax). If the property name contains characters that are not legal in a name, surround the property name with []. App.[Title$] See Also: Objects. Property Definition Syntax [ | Private | Public | Friend ] _ Property Get name[type][([param[, ..
See Also: Function, Sub. Example Dim X_Value Property Get X() X = X_Value End Property Property Let X(NewValue) If Not IsNull(NewValue) Then X_Value = NewValue End Property C:\ABCTemp\vbs\Sub_Definition.htm Sub Main X = "Hello" Debug.Print X X = Null Debug.Print X End Sub Public Definition Syntax Public [WithEvents] name[type][([dim[, ...]])] [As [New] type][, ...] Group Declaration Description Create arrays (or simple variables) which are available to the entire macro/module and other macros/modules.
PushButton Dialog Item Definition Syntax PushButton X, Y, DX, DY, Title$[, .Field] Group User Dialog Description Define a push button item. Pressing the push button updates the dlgvar field values and closes the dialog. (Dialog( ) function call returns the push button's ordinal number in the dialog. The first push button returns 1.) Parameter Description X This number value is the distance from the left edge of the dialog box. It is measured in 1/8ths of the average character width for the dialog's font.
Description Write a variable's value to StreamNum. Parameter Description StreamNum Streams 1 through 255 are private to each macro. Streams 256 through 511 are shared by all macros. RecordNum For Random mode files this is the record number. The first record is 1. Otherwise, it is the byte position. The first byte is 1. If this is omitted then the current position (or record number) is used. var This variable value is written to the file.
9 10 11 12 13 14 15 light blue light green light cyan light red light magenta light yellow bright white See Also: RGB( ). Example Sub Main Debug.Print Debug.Print Debug.Print Debug.Print Debug.Print Debug.Print Debug.
ReDim [Preserve] name[type][([dim[, ...]])] [As type][, ...] -orReDim [Preserve] usertypevar.elem[type][([dim[, ...]])] [As type][, ...] Group Declaration Description Redimension a dynamic arrayvar or user defined type array element. Use Preserve to keep the array values. Otherwise, the array values will all be reset. When using preserve only the last index of the array may change, but the number of indexes may not. (A one-dimensional array can't be redimensioned as a two-dimensional array.
Rem Instruction Syntax Rem ... -or'... Group Miscellaneous Description Both forms are comments. The Rem form is an instruction. The ' form can be used at the end of any line. All text from either ' or Rem to the end of the line is part of the comment. That text is not executed. Example Sub Main Debug.
Debug.Print Replace$("abcabc","b","B",9) '"" End Sub Reset Instruction Syntax Reset Group File Description Close all open streams for the current macro/module. See Also: Close, Open. Example Sub Main ' read the first line of XXX and print it Open "XXX" For Input As #1 Line Input #1,L$ Debug.Print L$ Reset End Sub Resume Instruction Syntax Resume label -orResume Next Group Error Handling Description Form 1: Resume execution at label. Form 2: Resume execution at the next statement.
Example Sub Main On Error GoTo X Err.Raise 1 Debug.Print "RESUMING" Exit Sub X: Debug.Print "Err=";Err Resume Next End Sub RGB Function Syntax RGB(red, green, blue) Group Miscellaneous Description Return a color. See Also: QBColor( ). Example Sub Main Debug.Print Hex(RGB(255,0,0)) '"FF0000" End Sub Right$ Function Syntax Right[$](S$, Len) Group String Description Return the last Len chars of S$. Note: A similar function, RightB, returns the last Len bytes.
Len Return this many chars. If S$ is shorter than that then just return S$. See Also: InStr( ), InStrRev( ), Left$( ), Len( ), Mid$( ), Replace$( ). Example Sub Main Debug.Print Right$("Hello",3) '"llo" End Sub Right$ Function Syntax Right[$](S$, Len) Group String Description Return the last Len chars of S$. Note: A similar function, RightB, returns the last Len bytes. Parameter Description S$ Return the right portion of this string value. If this value is Null then Null is returned.
directory can be used. See Also: MkDir. Example Sub Main RmDir "C:\WWTEMP" End Sub Rnd Function Syntax Rnd([Num]) Group Math Description Return a random number greater than or equal to zero and less than one. Parameter Description Num See table below. Num Description <0 Return the same number every time, using Num as the seed. >0 Return the next random number in the sequence. 0 Return the most recently generated number. omitted Return the next random number in the sequence. See Also: Randomize.
Parameter Description Num Round this numeric value. If this value is Null then Null is returned. Places Round to this number of decimal places. If this is omitted then round to the nearest integer value. Example Sub Main Debug.Print Debug.Print Debug.Print Debug.Print Debug.Print Debug.Print End Sub Round(.5) ' 0 Round(.500001) ' 1 Round(1.499999) ' 1 Round(1.5) ' 2 Round(11.11) ' 11 Round(11.11,1) ' 11.
Description Return the string with S$'s trailing spaces removed. Parameter Description S$ Copy this string without the trailing spaces. If this value is Null then Null is returned. See Also: LTrim$( ), Trim$( ). Example Sub Main Debug.Print ".";RTrim$(" x ");"." '". x." End Sub SaveSetting Instruction Syntax SaveSetting AppName$, Section$, Key$, Setting Group Settings Description Save the Setting for Key in Section in project AppName. Win16 and Win32s store settings in a .ini file named AppName.
Return the second of the minute (0 to 59). Parameter Description dateexpr Return the second of the minute for this date value. If this value is Null then Null is returned. See Also: Hour( ), Minute( ), Time( ). Example Sub Main Debug.Print Second(#12:00:01 AM#) ' 1 End Sub Seek Function Syntax Seek(StreamNum) Group File Description Return StreamNum current position. For Random mode files this is the record number. The first record is 1. Otherwise, it is the byte position. The first byte is 1.
Description Position StreamNum for input Count. Parameter Description StreamNum Streams 1 through 255 are private to each macro. Streams 256 through 511 are shared by all macros. Count For Random mode files this is the record number. The first record is 1. Otherwise, it is the byte position. The first byte is 1. See Also: Seek( ). Example Sub Main Open "XXX" For Input As #1 Line Input #1,L$ Seek #1,1 ' rewind to start of file Input #1,A Close #1 Debug.
Select Case UCase(S) Case "HELLO" Debug.Print "come in" Case "GOODBYE" Debug.Print "see you later" Case "DINNER" Debug.Print "Please come in." Debug.Print "Dinner will be ready soon." Case "SLEEP" Debug.Print "Sorry." Debug.Print "We are full for the night" Case Else Debug.Print "What?" End Select End Sub Select Case Statement Syntax Select Case expr [Case caseexpr[, ...] statements]...
Case "DINNER" Debug.Print "Please come in." Debug.Print "Dinner will be ready soon." Case "SLEEP" Debug.Print "Sorry." Debug.Print "We are full for the night" Case Else Debug.Print "What?" End Select End Sub SendKeys Instruction Syntax SendKeys Keys$[, Wait] Group Miscellaneous Description Send Keys$ Parameter Keys$ Wait to Windows. Description Send the keys in this string value to Windows. (Refer to table below.) If this is not zero then the keys are sent before executing the next instruction.
{BackSpace} {Del} {Delete} {Ins} {Insert} {Left} {Right} {Up} {Down} {PgUp} {PgDn} {Home} {End} {Select} {Clear} {Pad0..9} {Pad*} {Pad+} {PadEnter} {Pad.} {Pad-} {Pad/} {F1..
Set Instruction Syntax Set objvar = objexpr -orSet objvar = New objtype Group Assignment Description Form 1: Set objvar's object reference to the object reference of objexpr. Form 2: Set objvar's object reference to the a new instance of objtype. The Set instruction is how object references are assigned. Example Sub Main Dim App As Object Set App = CreateObject("WinWrap.CppDemoApplication") App.Move 20,30 ' move icon to 20,30 Set App = Nothing App.
SetAttr "XXX",Attrib End Sub Sgn Function Syntax Sgn(Num) Group Math Description Return the sign. Parameter Description Num Return the sign of this numeric value. Return -1 for negative. Return 0 for zero. Return 1 for positive. Example Sub Main Debug.Print Sgn(9) ' 1 Debug.Print Sgn(0) ' 0 Debug.Print Sgn(-9) '-1 End Sub Shell Function Syntax Shell(Name$[, WindowType]) Group Miscellaneous Description Execute program Name$. This is the same as using File|Run from the Program Manager.
vbMinimizedFocus vbMaximizedFocus vbNormalNoFocus vbMinimizedNoFocus 2 3 4, 8 6, 7 Minimized Window (default) Maximized Window Normal Deactivated Window Minimized Deactivated Window See Also: AppActivate, SendKeys.
Items(1) = "Item &2" Items(2) = "Item &3" X = ShowPopupMenu(Items) ' show popup menu Debug.Print X ' item selected End Sub Sin Function Syntax Sin(Num) Group Math Description Return the sine. Parameter Description Num Return the sine of this numeric value. This is the number of radians. There are 2*Pi radians in a full circle. Example Sub Main Debug.Print Sin(1) ' 0.8414709848079 End Sub Space$ Function Syntax Space[$](Len) Group String Description Return the string Len spaces long.
End Sub Sqr Function Syntax Sqr(Num) Group Math Description Return the square root. Parameter Description Num Return the square root of this numeric value. Example Sub Main Debug.Print Sqr(9) ' 3 End Sub Statement definition Zero or more instructions. A statement is at least one line long. Begin Dialog, Do, For, If (multiline), Select Case, While and With statements are always more than one line long.
variable is defined. A dynamic array is declared using ( ) without any dims. It must be ReDimensioned before it can be used. See Also: Dim, Option Base, Private, Public, ReDim. Example Sub A Static X Debug.Print X X = "Hello" End Sub C:\ABCTemp\vbs\Sub_Definition.htm Sub Main A A ' prints "Hello" End Sub Stop Instruction Syntax Stop Group Flow Control Description Pause execution. If execution is resumed then it starts at the next instruction. Use End to terminate the macro completely.
Str$ Function Syntax Str[$](Num) Group String Description Return the string representation of Num. Parameter Description Len Return the string representation of this numeric value. Positive values begin with a blank. Negative values begin with a dash '-'. See Also: CStr( ), Hex$( ), Oct$( ), Val( ). Example Sub Main Debug.Print Str$(9*9) ' 81 End Sub Strarray definition A variable that holds an array of string values. The name of a string variable may be followed by a $.
vbUpperCase vbLowerCase vbProperCase vbWide vbNarrow vbKatakana vbHiragana vbUnicode vbFromUnicode 1 2 3 4 8 16 32 64 128 Convert Convert Convert Convert Convert Convert Convert Convert Convert to upper case. to lower case. to proper case. (Not supported.) to wide. (Only supported for Win32 in eastern locales.) to narrow. (Only supported for Win32 in eastern locales.) to Katakana. (Only supported for Win32 in Japanese locales.) to Hiragana. (Only supported for Win32 in Japanese locales.) to Unicode.
StrReverse$ Function Syntax StrReverse[$](S) Group String Description Return the string with the characters in reverse order. Parameter Description S Return this string with the characters in reverse order. Example Sub Main Debug.Print StrReverse$("ABC") 'CBA End Sub Strvar definition A variable that holds one string value. The name of a string variable may be followed by a $. FirstName$ Sub Definition Syntax [ | Private | Public | Friend ] _ Sub name[([param[, ...
Sub IdentityArray(A()) ' A() is an array of numbers For I = LBound(A) To UBound(A) A(I) = I Next I End Sub Sub CalcArray(A(),B,C) ' A() is an array of numbers For I = LBound(A) To UBound(A) A(I) = A(I)*B+C Next I End Sub Sub ShowArray(A()) ' A() is an array of numbers For I = LBound(A) To UBound(A) Debug.
Text X, Y, DX, DY, Title$[, .Field][, Options] Group User Dialog Description Define a text item. Parameter Description X This number value is the distance from the left edge of the dialog box. It is measured in 1/8ths of the average character width for the dialog's font. Y This number value is the distance from the top edge of the dialog box. It is measured in 1/12ths of the character height for the dialog's font. DX This number value is the width.
Parameter Description X This number value is the distance from the left edge of the dialog box. It is measured in 1/8ths of the average character width for the dialog's font. Y This number value is the distance from the top edge of the dialog box. It is measured in 1/12ths of the character height for the dialog's font. DX This number value is the width. It is measured in 1/8ths of the average character width for the dialog's font. DY This number value is the height.
the dialog's font. The value of this string is the title of the text control. This identifier is the name of the field. The dialogfunc receives this name as string. If this identifer is omitted then the first two words of the title are used. This numeric value controls the alignment of the text. Choose one value from following table. (If this numeric value omitted then zero is used.) Title$ Field Options Option 0 1 2 Description Text is left aligned. Text is right aligned. Text is centered.
Group Time/Date Description Return the number of seconds past midnight. (This is a real number, accurate to about 1/18th of a second.) See Also: Date, Now, Time. Example Sub Main Debug.Print Timer ' example: 45188.13 End Sub TimeSerial Function Syntax TimeSerial(Hour, Minute, Second) Group Time/Date Description Return a date value. Parameter Description Hour This numeric value is the hour (0 to 23). Minute This numeric value is the minute (0 to 59). Second This numeric value is the second (0 to 59).
Description Return the time part of date encoded as a string value. Parameter Description Date$ Convert this string value to the time part of date it represents. See Also: DateSerial, DateValue, TimeSerial. Example Sub Main Debug.Print TimeValue("1/1/2000 12:00:01 AM") '12:00:01 AM End Sub Trim$ Function Syntax Trim[$](S$) Group String Description Return the string with S$'s leading and trailing spaces removed. Parameter Description S$ Copy this string without the leading or trailing spaces.
Type Definition Syntax [ | Private | Public ] _ Type name elem [([dim[, ...]])] As [New] type [...] End Type Group Declaration Description Define a new usertype. Each elem defines an element of the type for storing data. As [New] type defines the type of data that can be stored. A user defined type variable has a value for each elem. Use .elem to access individual element values. Type defaults to Public if neither Private or Public is specified.
Group Variable Info Description Return a string indicating the type of value stored in var. Parameter Description var Return a string indicating the type of value stored in this variable. Result Description Empty Variant variable is empty. It has never been assigned a value. Null Variant variable is null. Integer Variable contains an integer value. Long Variable contains a long value. Single Variable contains a single value. Double Variable contains a double value.
Group Variable Info Description Return the highest index. Parameter Description arrayvar Return the highest index for this array variable. dimension Return the highest index for this dimension of arrayvar. If this is omitted then return the highest index for the first dimension. See Also: LBound( ). Example Sub Main Dim A(3,6) Debug.Print UBound(A) ' 3 Debug.Print UBound(A,1) ' 3 Debug.
Unlock StreamNum -orUnlock StreamNum, RecordNum -orUnlock StreamNum, [start] To end Group File Description Form 1: Unlock all of StreamNum. Form 2: Unlock a record (or byte) of StreamNum. Form 3: Unlock a range of records (or bytes) of StreamNum. If start is omitted then unlock starting at the first record (or byte). Note: For sequential files (Input, Output and Append) unlock always affects the entire file. Parameter Description StreamNum Streams 1 through 255 are private to each macro.
Declare with Dim, Private, Public or Static. Declare as a parameter of Sub, Function or Property definition. Uses Comment Syntax '#Uses "module" [Only:[Win16|Win32]] ... -or'$Include: "module" Description The Uses comment indicates that the current macro/module uses public and friend symbols from the module. The Only option indicates that the module is only loaded for that Windows platform. Parameter Description module Public and Friend symbols from this module are accessible.
S$ Return the numeric value for this string value. A string value begins with &O is an octal number. A string value begins with &H is a hex number. Otherwise it is decimal number. Example Sub Main Debug.Print Val("-1000") '-1000 End Sub Var definition A variable holds either a string, a numeric value or an array of values depending on its type. Variantvar definition A variant variable can hold any type of value (except String*n or usertypevar). or it can hold an array.
vbVariant vbDataObject vbDecimal vbByte vbUserDefinedType +vbArray 12 13 14 17 36 8192 Variable contains a variant value. (Only used for arrays of variants.) Variable contains a non-ActiveX Automation object reference. Variable contains a 96 bit scaled real. Variable contains a byte value. Variable contains a User Defined Type value. Variable contains an array value. Use VarType( ) And 255 to get the type of element stored in the array. See Also: TypeName. Example Sub Main Dim X As Variant Debug.
Weekday Function Syntax Weekday(dateexpr) Group Time/Date Description Return the weekday. vbSunday (1) - Sunday vbMonday (2) - Monday vbTuesday (3) - Tuesday vbWednesday (4) - Wednesday vbThursday (5) - Thursday vbFriday (6) - Friday vbSaturday (7) - Saturday Parameter Description dateexpr Return the weekday for this date value. If this value is Null then Null is returned. See Also: Date( ), Day( ), Month( ), WeekdayName( ), Year( ). Example Sub Main Debug.Print Weekday(#1/1/1900#) ' 2 Debug.
Example Sub Main Debug.Print WeekdayName(1) 'Sunday Debug.Print WeekdayName(Weekday(Now)) End Sub While Statement Syntax While condexpr statements Wend Group Flow Control Description Execute statements while condexpr is True. See Also: Do, For, For Each, Exit While. Example Sub Main I=2 While I < 10 I = I*2 Wend Debug.Print I ' 16 End Sub With Statement Syntax With objexpr statements End With Group Object Description Method and property references may be abbreviated inside a With block. Use .
Example Sub Main Dim App As Object Set App = CreateObject("WinWrap.CppDemoApplication") With App .Move 20,30 ' move icon to 20,30 End With End Sub WithEvents Definition Syntax [Dim | Private | Public] _ WithEvents name As objtype[, ...] Group Declaration Description Dimensioning a module level variable WithEvents allows the macro to implement event handling Subs. The variable's As type must be a type from a referenced type library (or language extension) which implements events.
Description Write's expr(s) to StreamNum. String values are quoted. Null values are written as #NULL#. Boolean values are written as #FALSE# or #TRUE#. Date values are written as #date#. Error codes are written as #ERROR number#. See Also: Input, Line Input, Print. Example Sub Main A=1 B=2 C$ = "Hello" Open "XXX" For Output As #1 Write #1,A,B,C$ Close #1 End Sub Year Function Syntax Year(dateexpr) Group Time/Date Description Return the year.
Return the value of method for objexpr. objexpr.property[([expr][, ...] [param := expr][,...])] Return the value of property for objexpr. objexpr[([expr][, ...] [param := expr][,...])] Return the default value for the objexpr. objexpr.property[([expr][, ...])] = expr Assign the value of property for objexpr. objexpr[([expr][, ...])] = expr Assign the default value for the objexpr. Set objexpr.property[([expr][, ...])] = objexpr Set the object reference of property for objexpr.
On/Off Return "On" if zero, else return "Off". Example Sub Main Debug.Print Format$(2.145,"Standard") ' 2.15 End Sub Format User Defined Date Description The following date formats may be used with the Format function. Date formats may be combined to create the user defined date format. User defined date formats may not be combined with other user defined formats or predefined formats.
Format User Defined Number Description The following number formats may be used with the Format function. Number formats may be combined to create the user defined number format. User defined number formats may not be combined with other user defined formats or predefined formats.
Format User Defined Text Description The following text formats may be used with the Format function. Text formats may be combined to create the user defined text format. User defined text formats may not be combined with other user defined formats or predefined formats. User defined text formats can contain one or two sections separated by ';': form - format for all strings form;nullform - nullform: format for empty and null strings Parameter @ & < > ! \c "text" Description char placeholder, insert char o
10034 10035 10040 10041 10048 10049 10050 10051 10052 10053 10054 10055 10056 10057 10058 10059 10060 10061 10062 10063 10064 10069 10071 10075 10080 10081 10082 10083 10084 10085 10086 10087 10088 10089 10090 10091 10092 10093 10094 10095 10096 10097 10098 10099 10100 10101 10102 10103 10104 10105 10106 10107 10108 10109 10110 10111 10112 10113 10114 267 Current UserDialog is inaccessible. Wrong with, don't GoTo into or out of With blocks. Module could not be loaded. Function not found in module.
10115 10116 10119 10120 10130 10131 10132 10133 10134 10135 10140 10150 10151 10160 10200 10201 10202 10203 10204 Missing semi-colon ';'. SendKeys couldn't install the Windows journal playback hook. String too long (too many keys). Window could not be found. DDE is not available. Too many simultaneous DDE conversations. Invalid channel number. DDE operation did not complete in time. DDE server died. DDE operation failed. Can't access the clipboard. Window style must be in the range from 1 to 9.
R RememberPoint RunScriptFile S SendDragonKeys SendSystemKeys SetMicrophone SetMousePosition SetNaturalText SetState ShellExecute T TTSPlayString W Wait WaitForWindow WakeUp WinHelp Reference Key names Windows shortcut keys Error messages Guidelines for writing scripts Scripting commands have two parts: a command name and a set of arguments. Syntax CommandName "argument," [, argument] Rules Command names are case-sensitive. Arguments in brackets ([ ]) are optional.
Adding a list variable to a command name To add a list variable to a command name, type the list name with angle brackets. For example, type "Send Email to ", where Employee is the name of a new list. A command with a list can: • Perform different actions depending on the particular list value that is used. For example, the command Move Cursor to performs a different action depending on the list value (Top, Bottom, Beginning, and End) used for .
check boxes, group boxes, list boxes, and text fields are examples of controls. Only controls within the currently active window are available. Some programs require Active Accessibility to select controls. Most applications do not require Active Accessibility and some system environments do not support it. Therefore, you should only use the ActiveControlPick command for applications that require Active Accessibility for control selection.
Argument Description MenuItem The name (as displayed in the menu) of the menu or menu item to open. This value is case-sensitive. Example This example displays the File menu and then selects the Save As menu item. ActiveMenuPick "File" ActiveMenuPick "Save As" Notes • If the menu name contains an ellipsis, do not include it in the menuItem value. • You may need to insert a Wait command between consecutive MenuPick commands to ensure that the first menu appears before selecting one of its entries.
dir 1 (default) Default window size; active 2 Minimized window; active 3 Maximized window; active 4 Default window size; not active 6 Minimized window; not active Specifies the default working directory for the application. The default value is the directory containing the program's executable file. Example 1 This example starts or reactivates WordPad, opens the MyApp Readme file in a maximized window. AppBringUp "Readme", "Notepad C:\Program Files\Myapp\Readme.
If the appName value has not been used in a previous AppBringUp or AppSwapWith command and the program is not running, an executable file named appName must be in the Dragon NaturallySpeaking Program folder or in a directory that is searched when Windows starts a program. Beep Generates the Windows default beep sound by calling the Windows API MessageBeep() function. The exact result of this call depends on the hardware and system software configuration.
Example This example generates a double-click with the left mouse button. ButtonClick 1,2 Note Use a series of ButtonClick commands to generate triple- or quadruple-clicks. ClearDesktop Minimizes all open applications. Syntax ClearDesktop This command does not have any arguments. ControlPick Selects a specified control in an active secondary window. Command buttons, option buttons, check boxes, group boxes, list boxes, and text fields are examples of controls.
DdeExecute Sends a command or series of commands to a dynamic-data exchange (DDE) application. Syntax DdeExecute "appName", "topic", "command"[, async] Argument Description appName The name of the DDE application receiving the command. The appName value is usually the name of the application's .EXE file without the file name extension. The application must be running. topic The name of a topic recognized by the application.
DdePoke "appName", "topic", "item", "value" Argument Description appName The name of the DDE application receiving the command. The application must be running. topic The name of the topic receiving the command. item An item within the specified DDE topic. value A string containing the data to send to the specified item. Example This example sends the string "Total: $1,216" to the second row and third column of the Expenses worksheet in Microsoft Excel.
function The name or number of the .DLL file function to call. If a number is used, do not enclose the value in quotation marks. The value cannot be an expression. argString The string containing the data to be passed to the dynamic-link function. The value can be an expression. This argument is passed as the first (or only) argument to the DLL function. maxStringLengt h Maximum length of the string that the DLL can return as stringVariable.
4 third (middle) button Example This instruction positions the mouse pointer in the last RememberPoint location, presses the right mouse button, and then drags the pointer to the current pointer position. DragToPoint 2 Notes DragtoPoint will have no effect if the RememberPoint command has not been used earlier in the script. This command does not work if you hold down any modifier keys (SHIFT, CTRL, ALT) when you run it. The DragToPoint command works only in applications that support dragging.
Syntax HeardWord "word1" [, "word2", . . .] Argument Description word A single word in the active vocabulary or a single item in a command list. A list item can contain multiple words. This argument is case-sensitive. Up to eight word values can be specified, separated by commas. A series of word values is recognized as a single continuous phrase. Example 1 This example types a closing remark, in bold type, at the end of a Dragon NaturallySpeaking document.
active Dragon NaturallySpeaking Help folder. If the file is not found there, the normal HTML Help file search rules apply. topic The specific HTML topic to display. If the compiled help uses subdirectories, this parameter must include the subdirectory. For example, this topic is scrptref/htmlhelp.htm. Note that the identifier uses a forward slash (/). window The name of the window in which to display the HTML Help, for example, main. This parameter is always optional.
MenuCancel Cancels the active menu and any parent menus. Syntax MenuCancel Arguments This command does not have any arguments. Note The MenuCancel command is seldom needed in an application-specific command. Application-specific commands are not recognized when Windows is in a special mode such as when a menu is active or while a window is being moved or sized. MenuPick Selects the specified menu or menu item, visible in the active window, by executing the menu's access keys.
MouseGrid [state[, gridbox]] Argument Description state A value indicating whether MouseGrid is sized relative to the screen or the active window. gridbox 1 (default) Open MouseGrid relative to the screen or resize an open MouseGrid. If no gridbox value is specified, restore MouseGrid it to its previous size or to fit the screen. 2 Open MouseGrid relative to the active window or resize an open MouseGrid.
16 critical symbol (stop sign) 32 warning query symbol (question mark). The Microsoft Windows Interface Guidelines for Software Design discourages using this icon. 48 warning symbol (exclamation mark) 64 information symbol (lowercase i) + 0 OK button 1 OK and Cancel buttons 4 Yes and No buttons 5 Retry and Cancel buttons + 0 first button is the default 256 second button is the default title The text to be displayed in the message box title bar.
Parameters Argument Description StateName The name of the active MyCommands Structured State. PlaySound Plays the specified sound file. This command turns the microphone off while the sound plays. The next command in the script executes when the sound file stops playing. Syntax PlaySound "fileName.wav" Argument Description fileName.wa v The name of the sound file to play and, optionally, its path.
Argument Description Values The array of values that will be shown to the user. In order to group values, you can use an empty string. This string appears as a separator element in the array. The values can optionally contain a word's spoken form, separated by backslash symbol (see example below). Description The caption that appears on the prompt box. X, Y Optional. Screen coordinates of the Prompt-box.
RunScriptFile Runs a Dragon NaturallySpeaking script contained in the specified file. The script file can contain only valid Dragon NaturallySpeaking scripting commands. Syntax RunScriptFile "fileName" Argument Description fileName The name of the file containing the Dragon NaturallySpeaking script to be run. The file must be in ANSI text format. If no path is specified, the file must be in the Dragon NatuallySpeaking Program folder or in a directory that is searched when Windows starts a program.
Notes • Scripting commands from Dragon NaturallySpeaking version 5 that use the Dragon List Variables will only function when the .dvc file is imported. You cannot create new commands using these old Dragon List Variables. • Sending uppercase characters is equivalent to sending SHIFT plus the character. For example, A and {Shift+a} are equivalent. • Do not include spaces between the names of simultaneously pressed keys, such as Alt+Tab.
SetMicrophone Turns the microphone on or off. Syntax SetMicrophone [onOff] Argument Description onOff A value indicating the microphone state. If no value is specified, the microphone switches to the opposite state. 0 off 1 on Example This example turns the microphone on. SetMicrophone 1 Note SetMicrophone is used in the Microphone Off command. SetMousePosition Positions the mouse pointer by using absolute or relative coordinates.
interior (area within the window borders). x A value indicating the x-coordinate for the mouse position. Value must be an integer. If relativeTo is 1, 2, or 5, x is in pixels and positive values move the pointer right. If relativeTo is 3, 4 or 6, x must be a number between 0 and 8 corresponding to one of nine mapped positions as follows: 8 4 7 1 0 3 y 5 2 6 A value indicating the y-coordinate for the mouse position, in pixels. Value must be an integer. Positive values move the pointer down.
SetNaturalText 1 SetState Activates the specified Structured State and the commands associated with it as long as their availability also matches the foreground window. The states of the commands are specified during their creation, so that at runtime, the groups of commands can be activated or deactivated using the SetState scripting command or the ActiveState property of the DgnEngineControl object in the MyCommands Advanced Scripting editor.
that contains the executable file. applicationNam e Lets you name the application. This name is used by the AppBringUp and AppSwapWith commands. The application name must be unique. ShellExecute reports an error if the name is already in use. Example This instruction starts an instance of WordPad with its window maximized and sets the working directory to C:\DOCS.
Wait Causes the script to pause for the specified number of milliseconds before executing the next command. Note This command works only for legacy Dragon NaturallySpeaking version 5 commands that have been imported into version 8. It will not work in commands that you create using the MyCommands editor. If you are creating a command from the MyCommands editor, use the Wait Instruction command.
the window caption. If parts of the actual window caption are guaranteed to be unpredictable, you MUST use an * wild-card to get a successful match. The caption may also be an empty string "", to indicate that the caption does not matter. windowClas s A text string which, when not empty (""), must exactly match (case-sensitive) the window class name of the window you are looking for. The window class name is usually obtainable only through programmer utilities like "Spy".
WinHelp Activates the Windows Help application and specified Help (.HLP) file, and then displays the specified window or topic. Syntax WinHelp "helpFile", cmd, data Argument Description helpFile The name of the Help (.HLP) file to activate. If no path is specified, Dragon NaturallySpeaking looks for the file in the Dragon NaturallySpeaking Help folder. If the file is not found there, the normal Windows Help file search rules apply.
Key Key Code ALT {Alt} BACKSPACE {BackSpace} BREAK {Break} CAPS LOCK {CapsLock} CENTER {Center} CONTROL {Ctrl} DEL {Del} DOWN ARROW {Down} END {End} ENTER {Enter} ESC {Esc} HELP {F1} HOME {Home} INS {Ins} LEFT ARROW {Left} NUM LOCK {NumLock} (extended keyboards only) PAGE DOWN {PgDn} PAGE UP {PgUp} PAUSE {Pause} PRINT SCREEN {Prtsc} RIGHT ARROW {Right} SCROLL LOCK {ScrollLock} SHIFT {Shift} SPACE {Space} SYS REQ {SysReq} TAB {Tab} UP ARROW {Up} F1, F2, F
Extended Keys These keystrokes are generated by the extended keypad keys that are available on most keyboards. Most applications treat them the same as the corresponding keystrokes that do not have the Ext prefix (listed in the preceding table). {ExtDel} {ExtDown} {ExtEnd} {ExtHome} {ExtIns} {ExtLeft} {ExtPgDn} {ExtPgUp} {ExtRight} {ExtUp} Notes • Always precede the BREAK key with the CONTROL key. • CENTER is the non-NUM LOCK version of NUM KEY 5.
• If the command name contains punctuation (for example, "What Time Is It?"), did you verbalize the punctuation? Structured Commands About Structured Commands Dragon NaturallySpeaking Professional, Medical and Legal include an extension to text and graphics commands that let you to set the values of variables in text blocks based on voice input. You can create simple text and graphics commands with variables in the My Commands Editor dialog box without having to do extensive programming in Microsoft® VBA.
your own commands. The sample commands are fully commented. Sample location The sample commands are installed in: \Documents and Settings\All Users\Application Data\Nuance\NaturallySpeaking9\Data\Enx\samplecommands A shortcut to this directory is available on the Windows Start menu. To open this directory, click Start, point to Programs, then point to Dragon NaturallySpeaking 8, and click Sample Commands.
SetStateSample SetStateSample.xml contains simple Text and Graphics commands that demonstrate how to use variables and text formats and Advanced Scripting commands to set and unset a command state. This sample is designed to work in DragonPad with the initial command "Sample Set State". When the command executes, a command state is set for DragonPad and a simple exchange of greetings is simulated between the user and the system. The user speaks the greeting, e.g.