Jango Posted April 14, 2006 Share Posted April 14, 2006 Hello, I would like to understand the difference between using = or == in a If statment. I ask that because i got some problems (missing endif at runtime but no error at compilation ) using: If FileCopy(...) = 1 Then... Perhaps should i use If FileCopy(...) == 1 Then... instead ? what are the difference ? Thx Link to comment Share on other sites More sharing options...
greenmachine Posted April 14, 2006 Share Posted April 14, 2006 (edited) In the "Operators" section of the helpfile:= Tests if two values are equal (case insensitive if used with strings). e.g. If $var= 5 Then (true if $var equals 5)== Tests if two values are equal (case sensitive if used with strings)That definitely isn't the problem, and I can't tell from such a small code sample. If you really need your question answered, you'll post more code. Edited April 14, 2006 by greenmachine Link to comment Share on other sites More sharing options...
Jango Posted April 14, 2006 Author Share Posted April 14, 2006 If you really need your question answered, you'll post more code. I completly modified my code to get it working (and it works now) so if i remember well: $InstPath = "C:\Temp" $UpdPath = "C:\Windows" $ExeName = "notepade.exe" If FileCopy($UpdPath & "\" & $ExeName, $InstPath & "\" & StringTrimRight($ExeName, 1) & "_", 1) = 1 Then MsgBox(0, "Debug", "Copy ok") EndIf this code was included in more if...then...else but as i said i completly modified my original code 1. The FileCopy rename the .exe in .ex_ and i don't know if my "_" is wrongly interpreted during compilation ? 2. Can i do If, FileCopy and String operation in one statment ? Thank you Link to comment Share on other sites More sharing options...
Infinitex0 Posted April 14, 2006 Share Posted April 14, 2006 Well for one Notepade should be notepad (no "e" at the end) The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center] Link to comment Share on other sites More sharing options...
Jango Posted April 14, 2006 Author Share Posted April 14, 2006 Well for one Notepade should be notepad (no "e" at the end)yes sure as i don't have the code anymore i rewrote it rapidly ... i took an example just to show what give me the "missing endif" runtime error...I don't understand why i did'nt have an error compiling the code ...Anyway it works now but i splitted all operations (one line per operation) instead of doing all in the If then else statement... 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