Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can I send clipboard data into variable then do some math?
#1
Can I copy several numbers at once and send them to different variables.
Then calculate new amounts.

100.00
75.00
50.00

Then be able to do some math.

100/50=2
75/50=1.5

Then take that times a new amount like 55.00

55*2=110.00
55*1.5=82.5
#2
Code:
Copy      Help
str sclip sline
double d ;;numeric variable that can contain .
ARRAY(double) a ;;array of variables for results
sclip.getclip ;;or use getsel
foreach sline sclip
,d=val(sline 2) ;;convert string to double
,a[a.redim(-1)]=d/50*55 ;;calculate and add to the array

;show results
int i
for i 0 a.len
,out a[i]
#3
Looks good but I would also like to have it go back and paste where there is an amount in the array.

date | 11/21/06 | 11/21/07
---------------------------------------------------------
| |
LIST | 100.00 | 110.00 < paste this amount from calculation
COL1 | 75.00 | 82.50 < paste this amount from calculation
COL2 | | < sometimes there will be an amount here.
COL3 | | < sometimes there will be an amount here.
PUB-COST | 50.00 | 55.0 < This would be the new amount I would key.
REP-COST | 50.00 | 55.0

The new amount that I key will be the amount to multiply up from.
and paste new values under the 11/21/07 column

How can I manually enter the 55.00 or whatever the new cost is into the calculation.
Then send the output back to the clipboard to paste.
I really love quick macros, but I have a ways to go to get the full use out of it.

Thanks,
yoz
#4
Use outp. It can paste strings and numeric values.

outp a[0]
outp a[1]
...


Forum Jump:


Users browsing this thread: 1 Guest(s)