Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Augmenting a Number
#1
I am new to programming within QM2. What I am looking to do is to copy a number from a field, add one to the number and paste it back into the same field.
#2
good example in here

http://www.quickmacros.com/forum/showthr...p?tid=2261
#3
To perform various operations with text and numbers, store the text in a variable. You can use the Text dialog (the first button in the floating toolbar) to create code to copy and paste using a variable.

If it is an arithmetic operation, the variable type must be int, or double, or long. Use function val() to convert string variable to number.

Example
Macro
Code:
Copy      Help
;select all text
key Ca
;variables
str s
int i
;store selected text into variable s
s.getsel
;convert to integer
i=val(s)
;add 1
i=i+1
;assign to a str variable (a conversion function like val() here is not needed)
s=i
;paste
s.setsel


Forum Jump:


Users browsing this thread: 1 Guest(s)