opapotamus Posted February 1, 2011 Share Posted February 1, 2011 Howdy everyone! I have what should hopefully be a very simple question for anyone to answer that is not a total noob like me. What I am trying to do is compare two variables via an IF statement and have the script function from there. Here is my verrrrry sloppy code: WinActivate("Microsoft Excel - test_copy.xlsx") $ka = InputBox("Question", "Please enter maximum allowable value for ka:", "", "") For $i = 1 to 3 sleep(500) Send("^c") sleep(500) $value = ClipGet() sleep(500) MsgBox(0, "value is:", $value) MsgBox(0, "ka is:", $ka) sleep(500) if $value < $ka then ;PRRRRRRRRRRRRRRRRRRRRRRRRROOOOOOOOOOOOOOOOOOOOBLEMMMMMMMMMMMMM Send("{RIGHT 1}") send("{SCROLLLOCK off}") sleep(500) Send("+{RIGHT 2}") send("{SCROLLLOCK off}") sleep(500) Send("{DEL}") send("{SCROLLLOCK off}") sleep(500) Send("{DOWN 1}") send("{SCROLLLOCK off}") sleep(500) Send("{LEFT 1}") send("{SCROLLLOCK off}") sleep(500) else Send("{DOWN 1}") send("{SCROLLLOCK off}") EndIf Next The problem is where it tries to compare the two variables. If I put a numerical value where $ka is in the IF statement then the script works fine though. Any help would be greatly appreciated! Link to comment Share on other sites More sharing options...
MvGulik Posted February 1, 2011 Share Posted February 1, 2011 (edited) Read up on string-type versus number-type compare. and ClipGet() -> returns its data as string-type. Edited February 1, 2011 by MvGulik "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
Triblade Posted February 1, 2011 Share Posted February 1, 2011 (edited) The script works fine here.. Edit: excel 2010 x64 and AutoIt v3.3.6.1 Edited February 1, 2011 by Triblade My active project(s): A-maze-ing generator (generates a maze) My archived project(s): Pong3 (Multi-pinger) Link to comment Share on other sites More sharing options...
ZacUSNYR Posted February 1, 2011 Share Posted February 1, 2011 Read up on string-type versus number-type compare. and ClipGet() -> returns its data as string-type. InputBox does as well. So if you want to compare the whole number comparison you could just do something like. If Int($value) < Int($ka) Then Link to comment Share on other sites More sharing options...
opapotamus Posted February 1, 2011 Author Share Posted February 1, 2011 InputBox does as well. So if you want to compare the whole number comparison you could just do something like. If Int($value) < Int($ka) Then Beautiful! Exactly what I needed to do, thank you so much! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now