Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
if else
#1
i must be lost on is else! i am trying to write this code that is activated by a window trigger ,then it is going to click a button to receive a value! how do i get it to argue if the value is less than 1 make it 25 but if it's more than 1 just click ok? how would i format this?

thanks!
#2
if x <1
x=25
else
click ok


note if ix=1 it also clicks ok.
An old blog on QM coding and automation.

The Macro Hook
#3
thanks ken , i'll try that!
#4
it keeps giving me else without if err!!!


if x <1
x=25
else
click ok


note if ix=1 it also clicks ok.

is this the complete code? i replaced x with object window but it's not working!!!
#5
Is there command "click ok"? Use "object.DoDefaultAction" or "object.Mouse(1 2 2)"
#6
no this is not complete code you'll need to put in all your variables and your "results" code.
An old blog on QM coding and automation.

The Macro Hook
#7
well i have read reread and tried countless times , i guess i just don't get it! not a great big deal , i can use 2 button on my toolbar was just wanting it to work both from the websites button! anyway thanks again for your explaination!
#8
int hwnd=val(_command)
if w<99,999.99
w=100,000.00
else
dou 352 454


this is in a macro with window trigger! w is in a function

this is w str a.getwinclass(child(331 "98,000.00" 0x5))

this is my code so far what am i doing wrong? it keeps giving a syntax on the = ?
#9
but it doesn't look like your initializing the w variable. is this your whole code?
An old blog on QM coding and automation.

The Macro Hook
#10
yes , so far everything i have made has been trial an error! lol i'm so lost!
#11
first you need this

double w

this makes w a variable of type "double" which lets you have the ".99" part.
An old blog on QM coding and automation.

The Macro Hook
#12
also, if w is a string then you can't use "<". that's only for a number.

you can do it this way though.
str w
double z

z=val(w)
if z<99999.99
etc
An old blog on QM coding and automation.

The Macro Hook
#13
thanks again ken! i will prolly be revisiting this issue shortly!!!
#14
if x equals 1, then the else will kick in with that code.
if x < 1
do this
else
do that

If x equals 1, then it will "do that". if you want "do this" executed on x equalling 1, then you need to change the code to:

if x <= 1
do this
else
do that
#15
meanmuggin Wrote:int hwnd=val(_command)
if w<99,999.99
w=100,000.00
else
dou 352 454


this is in a macro with window trigger! w is in a function

this is w str a.getwinclass(child(331 "98,000.00" 0x5))

this is my code so far what am i doing wrong? it keeps giving a syntax on the = ?

your problem is that w is a string variable. you would first need to remove the commas from the string, then convert to a double, then compare to to a number without commas.
#16
thanks kam!


Forum Jump:


Users browsing this thread: 1 Guest(s)