Jzullo Posted November 13, 2007 Posted November 13, 2007 Hello all, once again I come to request the great help of the individuals in this forum. I'm trying to write a script that will copy the contents of a cell in Excel and store the contents in a variable. I will then use the contents of this variable to compare to a constant. The problem I'm having is that even when the statement is true, it goes to the else part of the If clause. What I have so far is below: $iShpCnd = ClipGet() MsgBox(0,$iShpCnd, $iShpCnd) If $iShpCnd = "02" then MsgBox(0,"First IF", $iShpCnd) WinActivate("XXXXXX") WinWaitActive("XXXXXX") MouseClick("left", 117, 337, 1) Send("02") Send("{Enter}") Else MsgBox(0,"Else", $iShpCnd) WinActivate("XXXXXX") WinWaitActive("XXXXXX") MouseClick("left", 117, 337, 1) Send("LD") Send("{Enter}") EndIf The "02" is stored as text in Excel, that's why I put it between "" in AutoIT. I tried putting switching the comparison, but it still goes to Else nonetheless. I really appreciate if anyone can shed a light on this.
Moderators big_daddy Posted November 14, 2007 Moderators Posted November 14, 2007 Even though you say it's stored as text in Excel your variable naming scheme $iShpCnd represents as integer. That doesn't affect the actual variable content, but it is confusing. Try changing this... If $iShpCnd = "02" then
PsaltyDS Posted November 14, 2007 Posted November 14, 2007 Even though you say it's stored as text in Excel your variable naming scheme $iShpCnd represents as integer. That doesn't affect the actual variable content, but it is confusing. Try changing this... If $iShpCnd = "02" thenoÝ÷ Ûú®¢×¢}ý· +Ø^æx3zº,jëh×6$iShpCnd = 02 If String($iShpCnd) = "02" Then ConsoleWrite('Debug: $iShpCnd = "02"' & @LF) Else ConsoleWrite('Debug: $iShpCnd <> "02"' & @LF) EndIfoÝ÷ ÚéåzË2¢ä®)àæjÛh«Ü©àz+m¡«¢+Ù%MÑÉ¥¹ ÀÌØí¥M¡Á ¹¤ôÅÕ½ÐìÈÅÕ½ÐìÑ¡ Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
AdmiralAlkex Posted November 14, 2007 Posted November 14, 2007 If Clause always goes to Elf's???8)A big lol to that!! .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
PsaltyDS Posted November 14, 2007 Posted November 14, 2007 If Clause always goes to Elf's???8)It's the pointy ears and green outfits... turns 'em on. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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