wjp79 Posted June 8, 2009 Share Posted June 8, 2009 I have 2 server where the autoit scripts are located. ("\\server1\software\INSTALLEREN-autoit\") and ("\\10.0.0.1\software\INSTALLEREN-autoit\ How do I make this work. I Tried everything. here is my latest trial and error. SELECT CASE FileExists ("\\server1\software\INSTALLEREN-autoit\") $ShellCMD = ("\\server1\software\INSTALLEREN-autoit\") CASE FileExists ("\\10.0.0.1\software\INSTALLEREN-autoit\") $ShellCMD = ("\\10.0.0.1\software\INSTALLEREN-autoit\") ENDSELECT $exe = "7-Zip 4.57 Setup" $titel = "7-Zip 4.57 Setup" $window = "7-Zip" run ($ShellCMD & "7z457.exe") if not WinActive($titel) then WinActivate($titel, "") WinWaitActive($titel, "Choose Install Location") ControlClick($titel, "", "Button2") WinWaitActive($titel, "Completing the 7-Zip 4.57 Setup Wizard") ControlClick($titel, "", "Button2") Exit Link to comment Share on other sites More sharing options...
KaFu Posted June 8, 2009 Share Posted June 8, 2009 Something like this might work. I also would add further timeout timers for the two windows "Choose Install Location" and "Completing the 7-Zip 4.57 Setup Wizard". CODE Global $ShellCMD[2] Global $Executeable = "7z457.exe" Global $bExecuteableFound = False $ShellCMD[0] = "\\server1\software\INSTALLEREN-autoit\" $ShellCMD[1] = "\\10.0.0.1\software\INSTALLEREN-autoit\" For $i = 0 To UBound($ShellCMD) - 1 If FileExists($ShellCMD[$i] & $Executeable) Then $Executeable = $ShellCMD[$i] & $Executeable $bExecuteableFound = True EndIf Next If $bExecuteableFound = True Then $exe = "7-Zip 4.57 Setup" $titel = "7-Zip 4.57 Setup" $window = "7-Zip" Run($Executeable) $iTimeout = TimerInit() While Not WinExists($titel, "") Sleep(10) If TimerDiff($iTimeout) > 3000 Then MsgBox(0, "Title not found", "Title not found, wait start timed-out.") Exit EndIf WEnd WinActivate($titel, "") WinWaitActive($titel, "Choose Install Location") ControlClick($titel, "", "Button2") WinWaitActive($titel, "Completing the 7-Zip 4.57 Setup Wizard") ControlClick($titel, "", "Button2") Else MsgBox(0, "Exe not found", "Exe not found") EndIf Exit OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
wjp79 Posted June 9, 2009 Author Share Posted June 9, 2009 Thank you.. seems to be working. Just have to understand the how and why part. But now I have something to work on. Tnx again. Something like this might work. I also would add further timeout timers for the two windows "Choose Install Location" and "Completing the 7-Zip 4.57 Setup Wizard". CODE Global $ShellCMD[2] Global $Executeable = "7z457.exe" Global $bExecuteableFound = False $ShellCMD[0] = "\\server1\software\INSTALLEREN-autoit\" $ShellCMD[1] = "\\10.0.0.1\software\INSTALLEREN-autoit\" For $i = 0 To UBound($ShellCMD) - 1 If FileExists($ShellCMD[$i] & $Executeable) Then $Executeable = $ShellCMD[$i] & $Executeable $bExecuteableFound = True EndIf Next If $bExecuteableFound = True Then $exe = "7-Zip 4.57 Setup" $titel = "7-Zip 4.57 Setup" $window = "7-Zip" Run($Executeable) $iTimeout = TimerInit() While Not WinExists($titel, "") Sleep(10) If TimerDiff($iTimeout) > 3000 Then MsgBox(0, "Title not found", "Title not found, wait start timed-out.") Exit EndIf WEnd WinActivate($titel, "") WinWaitActive($titel, "Choose Install Location") ControlClick($titel, "", "Button2") WinWaitActive($titel, "Completing the 7-Zip 4.57 Setup Wizard") ControlClick($titel, "", "Button2") Else MsgBox(0, "Exe not found", "Exe not found") EndIf Exit Link to comment Share on other sites More sharing options...
KaFu Posted June 9, 2009 Share Posted June 9, 2009 It loops through the possible locations, and if it has found found then it exits the loop... This will select the last valid location found (as in the example above): For $i = 0 To UBound($ShellCMD) - 1 If FileExists($ShellCMD[$i] & $Executeable) Then $Executeable = $ShellCMD[$i] & $Executeable $bExecuteableFound = True EndIf Next And this will select the first valid location found in the list (might even be better, why waste time searching for network locations (which can be time consuming), if we've already found a valid file location): For $i = 0 To UBound($ShellCMD) - 1 If FileExists($ShellCMD[$i] & $Executeable) Then $Executeable = $ShellCMD[$i] & $Executeable $bExecuteableFound = True ExitLoop EndIf Next OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
wjp79 Posted July 15, 2009 Author Share Posted July 15, 2009 It loops through the possible locations, and if it has found found then it exits the loop... This will select the last valid location found (as in the example above): For $i = 0 To UBound($ShellCMD) - 1 If FileExists($ShellCMD[$i] & $Executeable) Then $Executeable = $ShellCMD[$i] & $Executeable $bExecuteableFound = True EndIf Next And this will select the first valid location found in the list (might even be better, why waste time searching for network locations (which can be time consuming), if we've already found a valid file location): For $i = 0 To UBound($ShellCMD) - 1 If FileExists($ShellCMD[$i] & $Executeable) Then $Executeable = $ShellCMD[$i] & $Executeable $bExecuteableFound = True ExitLoop EndIf Next Thank you for the explanation.. Sorry for my late reply.. I was on holiday. Adjusting all my scripts now. 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