Using getsel

Creating macros. Working with QM.

Using getsel

Postby Tyler5248 on Fri Sep 15, 2017 3:53 pm

I am working with a program that I is tabled out but it isn't like excel where cells can be indetified as column/row (ie. "A1, A2..").

I am trying to right a macro to take the cell that I am currently in, copy the contents to a variable and then evaluate the variable, use left arrow to move over a cell and then paste out the resulting contents from the evaluation. See my code below and please help me.

Thank you,

#region Recorded 9/14/2017 4:33:53 PM
int w1=act(win("Costing Template Editor - Jones machining template(metric) TYLER.sldctm" "#32770"))
double i = 1
double A =1
double B =76.2
rep (1)
str s.getsel
if x>=0 and x<=3.175
A = 0.0127
else if x>=3.175 and x<=6.35
A = 0.0254
else if x>=6.35 and x<=12.7
A = 0.0508
else if x>=12.7 and x<=19.05
A = 0.0889
else if x>=19.05 and x<=25.4
A = 0.1397
else
A = 0.1905
'R
'F"{A}"
'R
'F"{B}"
'R
'D
'L
'L
'L
#endregion
Tyler5248
 
Posts: 2
Joined: Fri Sep 15, 2017 3:33 pm

Re: Using getsel

Postby Gintaras on Fri Sep 15, 2017 8:10 pm

double x = val(s 2)
Gintaras
Site Admin
 
Posts: 10385
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania

Re: Using getsel

Postby Tyler5248 on Mon Sep 18, 2017 4:34 pm

#region Recorded 9/14/2017 4:33:53 PM
int w1=act(win("Costing Template Editor - Jones machining template(metric) TYLER.sldctm" "#32770"))
double i = 1
double A =1
double B =76.2
rep (1)
str s.getsel
double x=val(s 2)
if x>=0 and x<=3.175
A = 0.0127
else if x>=3.175 and x<=6.35
A = 0.0254
else if x>=6.35 and x<=12.7
A = 0.0508
else if x>=12.7 and x<=19.05
A = 0.0889
else if x>=19.05 and x<=25.4
A = 0.1397
else
A = 0.1905
'R
'F"{A}"
'R
'F"{B}"
'R
'D
'L
'L
'L
out x
#endregion

When I run this is states my x =0
Tyler5248
 
Posts: 2
Joined: Fri Sep 15, 2017 3:33 pm

Re: Using getsel

Postby Gintaras on Mon Sep 18, 2017 5:13 pm

If s is like "0,5", replace "," with ".".

out s
s.findreplace("," ".")
out s
Gintaras
Site Admin
 
Posts: 10385
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania


Return to General

Who is online

Users browsing this forum: No registered users and 2 guests

cron