Lope 0 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 Share this post Link to post Share on other sites
Jos 2,210 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. Share this post Link to post Share on other sites
Lope 0 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. Share this post Link to post Share on other sites
Jos 2,210 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. Share this post Link to post Share on other sites