Lope Posted April 30, 2010 Posted April 30, 2010 (edited) AutoIt doesn't like the way I do If Statements. If someone can tell me how I can get stuff like this on one line that would be great. ;this will not parse correctly If FileExists($path_startmenu_client_me) Then If DirRemove($path_startmenu_client_me) Then install_log("StartMenu Deleted " & @UserName & " " & $path_startmenu_client_me) Else install_log("StartMenu Delete Failed " & @UserName & " " & $path_startmenu_client_me,"Failed to delete old startmenu items for " & @UserName & @CRLF & "Setup will now end.") EndIf ;if I separate it into multiple lines it parses fine... If FileExists($path_startmenu_client_me) Then If DirRemove($path_startmenu_client_me) Then install_log("StartMenu Deleted " & @UserName & " " & $path_startmenu_client_me) Else install_log("StartMenu Delete Failed " & @UserName & " " & $path_startmenu_client_me,"Failed to delete old startmenu items for " & @UserName & @CRLF & "Setup will now end.") EndIf EndIf Edited April 30, 2010 by Lope
Developers Jos Posted April 30, 2010 Developers Posted April 30, 2010 (edited) AutoIt doesn't like the way I do If Statements. If someone can tell me how I can get stuff like this on one line that would be great.Your second example is the one and only correct way. What is the need for putting it on one line?Jos Edited April 30, 2010 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Lope Posted April 30, 2010 Author Posted April 30, 2010 Thanks Jos. I prefer shorter looking code I'd love it if AutoIt had an option to use {} instead of newlines and EndBlah's C style is way better. Maybe I'm just sick of VB code, been coding VB5/6 for 13 years hehe.
Developers Jos Posted April 30, 2010 Developers Posted April 30, 2010 Thanks Jos.I prefer shorter looking code I'd love it if AutoIt had an option to use {} instead of newlines and EndBlah's C style is way better. Maybe I'm just sick of VB code, been coding VB5/6 for 13 years hehe.Putting code on one line doesn't per-say make it "shorter" unless you mean less lines. It does however make it much harder to read when it contains an "Else".So one line IF's are fine as long as they only contain a THEN. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
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