Jump to content
Macro Express Forums

Multiply two Variables.


Amerifax-Bob
 Share

Recommended Posts

I have been using Set Intereger and Modify Interger to do the following

 

1. Copy a number into a dbase forum.

2. Copy to Clipboard. ( Works fine)

3. Then save it to a "N1" -> Set Interger - Set Value from Clipboard

Trying to put the value that's on clipboard into variable "N1"

4. Modity Interger-> Multiply - Variable to receive result "N2" - Variable "N1" x Value "43560

Trying to muliply "N1" x 43560 and put into "N2"

5. Put the result of step 3 into the original dbase forum location.

Than somehow enter the "n2"value into forum.

 

Activate Window: "Add Permits"

Mouse Move Window 498, 302

Mouse Left Button Double Click

Clipboard Copy

Variable Set Integer %N1% from Clipboard

Variable Modify Integer: %N2% = %N1% * 5

Mouse Move Window 622, 302

Mouse Left Button Double Click

Clipboard Paste

 

 

Hoping for help.

 

Bob

Link to comment
Share on other sites

Your last macro line, Clipboard Paste, won't do what you want because the clipboard does not contain the N2 value. After multiplying, you can "variable modify integer" to convert N2 into a text string.

 

Then "variable modify string" (option 2 tab) to save the string to the clipboard then do the Clipboard Paste. Or simply Text Type %Tx% to type the string into the field.

 

When multiplying integers, be sure the result does not exceed the maximum interger value of 2,147,483,647.

Link to comment
Share on other sites

>rberq<Thanks for the help.

I got it to work but when I put in the value 4.75 the macro returned the value for "4". I have a feeling it's not seeing the decimal point properly. Could you help me with the adjustment I need to make so that the macro will process a number with a decimal point? Thanks a lot for your help.

 

Activate Window: "Add Permits"
Mouse Move Window 498, 302
Mouse Left Button Double Click
Mouse Move Window 501, 303
Mouse Left Button Double Click
Clipboard Copy
Variable Set Integer %N1% from Clipboard
Variable Modify Integer: %N2% = %N1% * 43560
Variable Modify Integer: Convert %N2% to text string %T3%
Mouse Move Window 501, 303
Mouse Left Button Double Click
Text Type: %T3%

 

 

Bob

Link to comment
Share on other sites

>rberq<Thanks for the help.

I got it to work but when I put in the value 4.75 the macro returned the value for "4". I have a feeling it's not seeing the decimal point properly. Could you help me with the adjustment I need to make so that the macro will process a number with a decimal point? Thanks a lot for your help.

 

Activate Window: "Add Permits"
Mouse Move Window 498, 302
Mouse Left Button Double Click
Mouse Move Window 501, 303
Mouse Left Button Double Click
Clipboard Copy
Variable Set Integer %N1% from Clipboard
Variable Modify Integer: %N2% = %N1% * 43560
Variable Modify Integer: Convert %N2% to text string %T3%
Mouse Move Window 501, 303
Mouse Left Button Double Click
Text Type: %T3%

 

Integers do not have decimal parts they are whole numbers by definition. Your macro is doing exactly what you are telling it to do. If you pass the value 4.75 to a integer variable the .75 will be stripped off. Try using decimal variables if you need fractional values.

 

Bob

Edited by Thoraldus
Link to comment
Share on other sites

I got it to work but when I put in the value 4.75 the macro returned the value for "4".
Integers do not have decimal values. Try the decimal variables (%D1%).

 

From the Macro Express help:

2. An Integer variable is one that can hold a "whole" number. Whole numbers are values that do not contain fractions (... -2, -1, 0, 1, 2 ...). Note: An integer variable (N1, etc.) can range from –2147483648 to 2147483647. When the value exceeds 2147483647, it ‘wraps’. If an integer variable contains 2147483647 and you add 1 to it, the integer variable will contain –2147483648.

 

3. A Decimal variable is one that can hold any type of number, such as 12.432 or -1.3. Note: A decimal variable (D1) 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.

Link to comment
Share on other sites

This is how it works. Thanks for the help. I have accomplished four things here. I listed the items for people that might be doing a search.

 

1. Capture a value from the clipboard. Clipboard to variable.

2. Convert value to decimal. Text to decimal.

3. Do a bit of math, multiply.

4. Copy value back to the forum being used. Copy variable to forum.

 

Activate Window: "Add Permits"

Mouse Move Window 736, 420

Mouse Left Button Double Click

Clipboard Copy

Variable Set Decimal %D1% from Clipboard

Variable Modify Decimal: %D2% = %D1% * 1000

Variable Modify Decimal: Convert %D2% to text string %T3%

Mouse Move Window 736, 420

Mouse Left Button Double Click

Text Type: %T3%

 

Bob

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...