logo

Macro Expert

Save your TIME!

Site Map About us
Home Overview Downloads Purchase Support Contact Us
 
 

Variable and Expression


Variable

Variable is a symbol that stands for a value. For example, in the expression

x+y+10

x and y are variables, and 10 is a constant. Variables can represent numeric values, character strings, date time or other data type.

Variables play an important role in Macro Expert because they enable you to create flexible macros. Rather than entering data directly into a script, you can use variables to represent the data. Then, when the macro is played, the variables are replaced with real data. This makes it possible for the same macro to process different sets of data. For example, you might want to use the action "Mouse Move" for placing the mouse pointer at a position, and the position should be determined when the macro is played. You can use the variable to represent the coordinates value of the position. Depending on the value of variable, the mouse pointer will be placed at the different position.

Every variable has a name, called the variable name, and a data type. A variable's data type indicates what sort of value the variable represents. Macro Expert supports 4 data types, String, Number, Datetime and Binary data. The binary data is used to the instruction "Call an External DLL".

In Macro Expert, there are two type variables, the global variables and local variables. The global variables are predefined by the software for holding those general content, such as the current time, Windows Directory and etc.. The local variables are restricted to a single macro. This means that you cannot access the variables from a different macro. For more information about working with the local variables, please click here.

  • String

    Holds sequences character code which represents a single character. The string data type supports + operator and - operator.

    Example A:
    "abc"+"bcd"
    ' The preceding expression evaluates to "abcbcd".

    Example B:
    "abcd"-"bc"
    ' The preceding expression evaluates to "ad".

    In an expression, the string data should be quoted by the single or double quotation marks. You may use \' to represent the single quotation sign, and use the \" to represent the double quotation sign. For example,

    Example A:
    'He\'s a student.'
    ' The preceding expression evaluates to "He's a student.".

    Example B:
    "He said: \"No\""го
    ' The preceding expression evaluates to "He said: "No"".

  • Number

    Holds signed IEEE 64-bit (8-byte) double-precision floating-point numbers ranging in value from -1.79769313486231570E+308 through -4.94065645841246544E-324 for negative values and from 4.94065645841246544E-324 through 1.79769313486231570E+308 for positive values. Double-precision numbers store an approximation of a real number.

    The number data type supports + operator, - operator, * operator, / opeartor and \ mod operator. For example,

    Example A:
    1+20
    ' The preceding expression evaluates to "21".

    Example B:
    0x10 \ 3
    ' The preceding expression evaluates to "1".

    In an expression, you may use the hexadecimal notation to represent a number, for example, 0x2A.

  • Datetime

    Holds date and time values. The datetime supports + operator, - operator, * operator, / opeartor.

    Example A:
    #2007-08-10#+1
    ' The preceding expression evaluates to 2007-08-11.

    Example B:
    #2007-08-10#-8
    ' The preceding expression evaluates to 2007-08-02.

    In an expression, the datetime content should be quoted by the number sign #.

  • Binary

    Holds the binary data of any kind. This data type is used to represent a structural data for the instruction "Call an External DLL".

    For reading the content in a binary data, you could use the instruction "Advanced Get Variable Value".

Expression

An expression is a series of value elements (variables or constants) combined with operators, which yields a new value. The operators act on the value elements by performing calculations, comparisons, or other operations.

  • Operator

    An operator is a code element that performs an operation on one or more value elements that hold values. Value elements include variables, constants, returns from Function and Operator procedures, and expressions.

    Macro Expert supports +, -, *, /, \(mod) and () operator, and it will convert the right value element to the appropriate data type before performing the operation, as the following example demonstrates.

    %="abc "+20.03%
    ' The preceding expression evaluates to "abc 20.03".

    %=20.03 + "abc"%
    ' The preceding expression evaluates to 20.03.

    %=20.03 + "5abc"%
    ' The preceding expression evaluates to 25.03.

  • Using Expression

    To use an expression, simply quote the expression by percentage signs, and use the equal mark to lead, like this:
    %=1+2%, or %=5 * VARIABLENAME% (substitute VARIABLENAME for the variable name you used.)

    The equal mark could be ignored if the expression does not include the operator, for example,
    %VARIABLENAME%.

  • Special character

    Percentage sign %
    Uses the \% to represent the percentage sign in an expression. For example, %="100\%"+"abc"%.

    New line sign
    Uses the \n to represent the new line sign in an expression. For example, %="100\n"+"abc"%.

    Tab character
    Uses the \t to represent the horization tab character in an expression. For example, %="100\tabc"%.

    Note:

    New line sign and Tab character are available only in the experssion.


Note:

  • The number datatype in memory is same as the double-precision floating-point numbers.


  • The datatime datatype in memory is same as the struct SYSTEMTIME in Windows API.


  • Not all parameters of actions support the expression. If you could see the icon on the right of the parameter field in the instruction parameters dialog, then the parameter supports the expression.
  • Introduction
  • Compare Editions
  • Installation and Uninstall
    • Minimum system requirements
    • Installnation
    • Uninstalling
  • Work environment
    • Getting familiar with Macro Manager
    • Folder panel
    • The tool bar of the macro list
    • Working with the progress window
    • Working with Macro Player Manager
  • Using Macro Expert
    • Basic concept of Macro Expert
    • Creating a new macro
    • Playing a macro manually
    • Recording/Editing TemporaryMacro
    • Playing TemporaryMacro
    • Stop Macro Service
    • Disabling all triggers of macro
  • Changing the properties of a macro
    • General
    • Scope
    • Triggers
    • Schedule
    • Play back
    • Advance
  • Triggering macro
    • Triggering macro overview
    • Idle trigger
    • Startup trigger
    • System event trigger
    • Resource event trigger
    • Driver trigger
    • Dial trigger
    • Hotkey
    • Window Trigger
    • File Trigger
  • Scheduling macro
    • Scheduling macro overview
    • Minute
    • Daily
    • Weekly
    • Monthly
    • Once
    • At a time
  • Changing Options
    • General
    • Hot keys
    • TemporaryMacro
    • Play back
    • Record
    • Macro list
    • Auto-logon
    • Appearance
  • Script Editor
    • Looking at the work area
    • Inserting an action
    • Editing an action
    • Removing one or more actions
    • Working with the variables
  • Macro Commands
    • General settings and Error Handling Options
    • Keyboard and mouse
      • Key action
      • Mouse action
      • Put a Text
      • Mouse Move Activity
      • Mouse Action on Object
    • Dialog
      • Display Message Dialog
      • Select a Folder
      • File-selection Dialog
      • Input Dialog
      • Show Tip Text
      • Hide tip text
    • Wait
      • Delay
      • Wait for a window
      • Wait for color
      • Wait for keystroke
      • Wait for mouse motion
      • Wait for file
      • Wait for process
    • Play Control
      • On Error
      • Pause
      • Stop
      • End
      • Play speed
      • Play a macro
      • Set emulation level
    • System
      • Run
      • Image search
      • Text earch based on image
      • Generate random number
      • Log off
      • Start Screen-Saver
      • Lock workstation
      • Shut down computer
      • Registry Operation
      • Call an External DLL
      • Send Message to Window
      • Get Text from Object
    • Flow
      • Comments
      • Separator line
      • Label
      • Goto
      • If variable
      • If color
      • If File Exists
      • If Window Exists
    • Loop
      • Loop
      • Loop Windows
      • Loop Files
      • Loop Processes
      • Loop Control
    • Window
      • Window action
    • Clipboard
      • Copy, Cut, Paste and Clear
      • Put a text to the clipboard
      • Get the text from the clipboard
    • Multimedia
      • Play an audio
      • Increase/Decrease Volume
      • Adjust volume
      • Sound Switch
      • Sound on/off
      • CD Player
    • Network
      • Make remote access connection
      • Disconnect remote access connection
      • Connect network resource
      • Disonnect network resource
      • Clear Internet Explorer History
      • Delete Internet Explorer Cookies
      • Delete Tempoary Internet Files
      • Internet Explorer Navigation Actions
    • Webpage
      • On Popup Window on Webpage
      • Open a Web page
      • Connect a Opened Webpage
      • Close Webpage
      • Read Field on Webpage
      • Fill Field on Webpage
      • Submit Form on Webpage
      • Click Element on Webpage
      • Find Element on Webpage
    • File
      • Copy files
      • Move files
      • Delete files
      • Create a folder
      • Delete a folder
      • Rename files
      • Set file attributes
      • Change file time
      • Synchronize Folders
      • Compress files
      • Extract a zipped file
      • Read text file
      • Write text file
    • Document
      • Open Document
      • Close Document
      • Save Document
      • Read Excel Cell
      • Write Excel Cell
      • Find Excel Cell
      • Add Worksheet
      • Remove Worksheet
      • Activate Worksheet
    • Variable
      • Increase/Decrease value
      • Set value
      • Advanced Set Variable Value
      • Advanced Get Variable Value
    • Database
      • Execute SQL Statement
      • Close Dataset
      • Set Field Value
      • Get Field Value
      • Change Current Record Position
  • Command Line Usage
  • Variables and Expressions
  • Frequent Question and Answer
  • Purchasing Macro Expert
  • Contact Grass Software
  • License Agreement
  • Help & Support
    Support
    Online Manual
    Online Bug Report
    Suggestion & Comments
    Downloads
    Macro Expert
    Advanced Key and Mouse Recorder
    GS Typing Tutor
    GS Typing Test
    GS Typing Network
    Websites
    GS Typing Tutor
    One-hand typing tutor
    Macro Expert
    Advanced Key and Mouse Recorder
    Company
    About Us
    Press Room
    Privacy Policy
    Links
    Copyright © 2002-2009 GrassSoftware. All Rights Reserved.