Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Nested If...Then..Else statements

$
0
0
Maybe my logic is flawed...but I am having trouble coding a function sort of like this...
[ autoit ]      
IF aFunction() Then if FileExists("c:\path") Then if FileExists("c:\path1") Then;;; these If FileExists Then...are checking to see if files have been downloaded...there are about ten of these if FileExists("c:\path10") Then MsgBox(64,@ScriptName,"Downloads Complete!") Else MsgBox(64,@ScriptName,"Can't get them all!") EndFunc


In that format it just gives me syntax errors...in this next format it always returns that the download did not complete, but it actually did...

[ autoit ]         
Func gotTermServApps() If $Lmi=1 Then MsgBox(64,@ScriptName,"Got LogMeIn!") Else MsgBox(64,@ScriptName,"Could not get LogMeIn!") EndIf If $reader=True Then MsgBox(64,@ScriptName,"Got Reader!") Else MsgBox(64,@ScriptName,"Could not get Reader!") EndIf if $filezilla=True Then MsgBox(64,@ScriptName,"Got FileZilla!") Else MsgBox (64,@ScriptName,"Could not get FileZilla!") EndIf If $transact=True Then Msgbox(64,@ScriptName,"Got TransActPOS!") Else MsgBox(64,@ScriptName,"Could not get TransActPOS!") EndIf If $openManage=True Then MsgBox(64,@ScriptName,"Got OpenManage!") Else MsgBox(64,@ScriptName,"Could not get OpenManage!") EndIf IF $tp86=True Then MsgBox(64,@ScriptName,"Got ThinPrint Engine 8.6!") Else MsgBox(64,@ScriptName,"Could not get ThinPrint Engine 8.6!") EndIf If $tp90=True Then MsgBox(64,@ScriptName,"Got ThinPrint Engine 9.0!") Else MsgBox(64,@ScriptName,"Could not get ThinPrint Engine 9.0!") EndIf If $chrome=True Then MsgBox(64,@ScriptName,"Got Chrome!") Else MsgBox(64,@ScriptName,"Could not get Chrome!") EndIf EndFunc

Although I do not really want a bunch of boxes popping up...just testing the logic really. Any help is appreciated!

The $lmi, $reader, etc are all declared globally outside functions. This is the basic structure of the vars...
[ autoit ]      
global $lmi, $chrome, $filezilla, $mse32, $mse64, $reader, $tp86, $tp90, $tpClient, $transact $reader=FileExists(@DesktopDir & "\AdbeRdr11002_en_US.exe")


Edited to be more decriptive...

Viewing all articles
Browse latest Browse all 12506

Trending Articles