Variable Set Decimal

 

The Variable Set Decimal command assigns a value to a decimal variable. This command provides four options for setting a decimal variable. Use the Modify Decimal Variables command to manipulate the original values assigned to a macro.

 

üNote: A decimal variable can range from 5.0 x 10^ -324 to 1.7 x 10^308 with 15 to 16 significant digits. This first example is a decimal expanded to include 324 leading zeros followed by the number 5, represented as .000(321 more zeros)5. The second range extends to 17 followed by 308 zeros which would look like 1700000000(300 more zeros).0. The numbers are rounded to 15 or 16 significant digits.

 

 

Script Editor > Expand Variables Category > Variable Set Decimal

 

 

What Method Would You Like to Use?

Select from the drop down list the method required for defining the variable. Each of the options are described below.

 

Set Value Now

The Set Value Now option assigns a value to the decimal variable now for use later in the macro.

 

Destination Variable

Select a variable to use or create a new decimal variable.

 

Initial Value

Insert the contents of the variable in this field.

 

 

Prompt for Value

The Prompt for Value function opens an edit box during macro playback. The user is prompted to insert a decimal value.

 

Destination Variable

Select a variable to use or create a new decimal variable.

 

Prompt

Optionally enter text in the Prompt edit field to explain the type of value the user should input. During macro playback, the instructions appear above the input field.

 

Mask the Input

The Mask the Input option masks the text entered into the input box and is viewed as *** instead of the actual digits.

 

The Dialog Should Always be on Top

This option makes sure that the prompt window is always on top of other open windows.

 

Positioning the Prompt Window

Use this feature to define the position on the screen where the input box will appear during the playback of the macro. Insert exact coordinates or use the Set Position Manually button to set where the window should appear. See the Window Positioning topic for additional information.

 

 

Hint: Setting a Default Value in the Prompt Window

 

First use the Set Value Now option. Insert the decimal value that you want set as the default. Then use the Prompt for Value option. Both options must reference the same variable, such as D[1]. When the macro is run, the prompt window displays the default value. The user can overwrite, amend, accept or append to this value.

 

Below is a sample of the commands as they would look in the Scripting Editor. The decimal .52 is the default value.

 

Variable Set Decimal %D[1]% to .52

Variable Set Decimal %D[1]% from Prompt

 

 

Set Value from Clipboard

Set Value from Clipboard examines the text contents of the clipboard. It takes this value and strips off any spaces, carriage returns or line feeds. It then attempts to convert the contents to a decimal value and place it in the variable. If a non-decimal value (i.e. a string of text) is in the clipboard or the text clipboard is empty, the variable value is set to zero.

 

Destination Variable

Select a variable to use or create a new decimal variable.

 

 

Display Size Multiplier

Windows allows users to adjust the size of text, apps,  and other items on the screen by changing the Display Settings. Typical settings are the default of 100% or custom settings such as 125%, 150% or 200%. There is also an option to set a custom scaling level (not recommended). Windows changes the size of items on the screen by adjusting the Dots Per Inch (DPI).

 

Macros designed for one screen size setting will not be properly displayed on a computer with a different screen size. Windows automatically adjusts the font size but the size and positioning of commands such as Text Box Display, If Message and Complex Pause will need to be changed to allow it to fit in the box size selected.

 

The Display Size Multiplier command returns a value that can be used to adjust the screen position and size to allow a macro to work correctly on computers with different screen size settings.

 

 

Example

To create a Text Box display with these parameters: Left: 50, Top: 10, Width: 300 and Height: 250, enter the values into variables, as shown below, rather than entering the values directly into the Text Box Display command.

 

Variable Set Decimal %DisplaySizeMulitplier% to Display Size Multiplier

Variable Set Integer %Left% to 50

Variable Set Integer %Top% to 10

Variable Set Integer %Width% to 300

Variable Set Integer %Height% to 250

// Left Coordinate

Variable Modify Decimal: %lft% = %Left% * %DisplaySizeMulitplier%

Variable Modify Decimal: Round %lft% to 0 decimal places

Variable Modify Decimal %lft%: Truncate to Integer (%Left%)

// Top Coordinate

Variable Modify Decimal: %tp% = %Top% * %DisplaySizeMulitplier%

Variable Modify Decimal: Round %tp% to 0 decimal places

Variable Modify Decimal %tp%: Truncate to Integer (%Top%)

// Width

Variable Modify Decimal: %wid% = %Width% * %DisplaySizeMulitplier%

Variable Modify Decimal: Round %wid% to 0 decimal places

Variable Modify Decimal %wid%: Truncate to Integer (%Width%)

// Height

Variable Modify Decimal: %hgt% = %Height% * %DisplaySizeMulitplier%

Variable Modify Decimal: Round %hgt% to 0 decimal places

Variable Modify Decimal %hgt%: Truncate to Integer (%Height%)

 

 

Then insert the Integer variables in the Text Box Display command.

 

 

 

Or mix variables along with the predefined positioning values of Top, Left, Right, Bottom and Center:

 

 

Using the macro above the Text Box would appear 50 pixels to the right of the left edge and upper edge of the box would be 10 pixels down from the top of the screen, if the screen resolution is set to Smaller (100%). The text box is sized at 300 x 250.

 

If the screen resolution were set to Medium (125%), then the text box would appear 63 pixels to the right of the left edge of the screen and 13 pixels from the top. The box size would be 373 x 313 pixels. Leaving out the Rounding function would change some of the values slightly, by one pixel in some instances.