ffdshow Posted February 5, 2008 Share Posted February 5, 2008 Hi I try to install a program using a script. The problem is the window with "Install" button. All command I used to click on that button failed. I tried ControlClick, Send("{ENTER}"), Send("!n") and finally MouseClick. WinGetHandle and ControlGetHandle doesn't help (I used WinGetHandle with this: AutoItSetOption("WinTitleMatchMode", 4) on top). ControlClick and MouseClick works if I start the installation manually and stop on that window and then start a script with ControlClick or MouseClick command inside. Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 5, 2008 Share Posted February 5, 2008 HiI try to install a program using a script.The problem is the window with "Install" button. All command I used to click on thatbutton failed.I tried ControlClick, Send("{ENTER}"), Send("!n") and finally MouseClick.WinGetHandle and ControlGetHandle doesn't help (I used WinGetHandle with this: AutoItSetOption("WinTitleMatchMode", 4)on top).ControlClick and MouseClick works if I start the installation manually and stop on that window and then start a script with ControlClick or MouseClick command inside.Run the AU3Info.exe AutoIt Window Info tool and see what you get for window class/title/text and the same for the control. Post the results if that doesn't give you the answer. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
simusphere Posted February 5, 2008 Share Posted February 5, 2008 HiI try to install a program using a script.The problem is the window with "Install" button. All command I used to click on thatbutton failed.I tried ControlClick, Send("{ENTER}"), Send("!n") and finally MouseClick.WinGetHandle and ControlGetHandle doesn't help (I used WinGetHandle with this: AutoItSetOption("WinTitleMatchMode", 4)on top).ControlClick and MouseClick works if I start the installation manually and stop on that window and then start a script with ControlClick or MouseClick command inside.It appears you have not given us enough information. What program are you trying to install? We need to know how many windows are open during the install that are associated with this program. Are you using the correct title info for the WinWaitActive command before you do the send.Really, the winzip install example that comes with autoit is a very good example on what you need to do in most install circumstances. Link to comment Share on other sites More sharing options...
ffdshow Posted February 5, 2008 Author Share Posted February 5, 2008 Run the AU3Info.exe AutoIt Window Info tool and see what you get for window class/title/text and the same for the control. Post the results if that doesn't give you the answer.Au3info window:CODE>>>> Window <<<<Title: VideoLAN VLC media player 0.8.6d Setup Class: #32770Position: 382, 179Size: 503, 393Style: 0x94CA084CExStyle: 0x00010100Handle: 0x0002064E>>>> Control <<<<Class: ButtonInstance: 2ClassnameNN: Button2ID: 1Text: &InstallPosition: 324, 327Size: 75, 23ControlClick Coords: 37, 7Style: 0x50010001ExStyle: 0x00000004Handle: 0x00020658>>>> Mouse <<<<Position: 746, 542Cursor ID: 2Color: 0xFDFDFD>>>> StatusBar <<<<>>>> Visible Text <<<<< &Back&InstallCancelNullsoft Install System v2.33-1 Nullsoft Install System v2.33-1Choose Install LocationChoose the folder in which to install VideoLAN VLC media player 0.8.6d.C:\Program Files\VideoLAN\VLCB&rowse...Space available: 26.0GBSpace required: 31.9MBSetup will install VideoLAN VLC media player 0.8.6d in the following folder. To install in a different folder, click Browse and select another folder. Click Install to start the installation.Destination Folder>>>> Hidden Text <<<<And again ControlClick command works if is started from a separate script. Link to comment Share on other sites More sharing options...
Valik Posted February 5, 2008 Share Posted February 5, 2008 Given that you haven't provided your script, I'm going to guess that you're either blocking on a condition that is never true thus ControlClick() is never even called, or you're not waiting until the button is ready to be clicked so the ControlClick() goes off into the void. Link to comment Share on other sites More sharing options...
ffdshow Posted February 5, 2008 Author Share Posted February 5, 2008 Given that you haven't provided your script, I'm going to guess that you're either blocking on a condition that is never true thus ControlClick() is never even called, or you're not waiting until the button is ready to be clicked so the ControlClick() goes off into the void.This is the installer. The script: Opt("TrayIconDebug", 1) Opt("SendKeyDelay", 200) Run("vlc-0.8.6d-win32.exe") ; Please select a language. WinWait("Installer Language", "Please select a language.") WinActivate("Installer Language", "Please select a language.") ControlClick("Installer Language", "", "Button1") ; Welcome to the VideoLAN VLC media player 0.8.6d Setup Wizard WinWaitActive("VideoLAN VLC media player 0.8.6d Setup", "Welcome to the VideoLAN VLC media player 0.8.6d Setup Wizard") ControlClick("VideoLAN VLC media player 0.8.6d Setup", "", "Button2") ; License Agreement WinWaitActive("VideoLAN VLC media player 0.8.6d Setup ", "License Agreement") ControlClick("VideoLAN VLC media player 0.8.6d Setup ", "", "Button2") ; Choose Components WinWaitActive("VideoLAN VLC media player 0.8.6d Setup ", "Choose Components") ControlClick("VideoLAN VLC media player 0.8.6d Setup ", "", "Button2") ; License Agreement WinWaitActive("VideoLAN VLC media player 0.8.6d Setup ", "License Agreement") ControlClick("VideoLAN VLC media player 0.8.6d Setup ", "", "Button2") ; Choose Install Location WinWaitActive("VideoLAN VLC media player 0.8.6d Setup ", "Choose Install Location") ControlClick("VideoLAN VLC media player 0.8.6d Setup ", "", "Button2") ; Completing the VideoLAN VLC media player 0.8.6d Setup Wizard WinWaitActive("VideoLAN VLC media player 0.8.6d Setup ", "Completing the VideoLAN VLC media player 0.8.6d Setup Wizard") ControlCommand("VideoLAN VLC media player 0.8.6d Setup ", "", "Button4", "UnCheck", "") ControlClick("VideoLAN VLC media player 0.8.6d Setup ", "", "Button2") The installation is stopped on "Choose Install Location" Link to comment Share on other sites More sharing options...
Valik Posted February 5, 2008 Share Posted February 5, 2008 Did it not occur to you when you were copy and pasting ""VideoLAN VLC media player 0.8.6d Setup" for the 8th time to maybe make it a variable? Why do you have 2 spaces at the end of that string in every usage but the first? Probably not related to your problem, but it's still stupid to write the same string so many times. Link to comment Share on other sites More sharing options...
ffdshow Posted February 5, 2008 Author Share Posted February 5, 2008 Rewrite the script but with the same result. Opt("TrayIconDebug", 1) Opt("SendKeyDelay", 200) Run("vlc-0.8.6d-win32.exe") $title = "VideoLAN VLC media player 0.8.6d Setup" ; Please select a language. WinWait("Installer Language", "Please select a language.") WinActivate("Installer Language", "Please select a language.") ControlClick("Installer Language", "", "Button1") ; Welcome to the VideoLAN VLC media player 0.8.6d Setup Wizard WinWaitActive($title, "Welcome to the VideoLAN VLC media player 0.8.6d Setup Wizard") ControlClick($title, "", "Button2") ; License Agreement WinWaitActive($title, "License Agreement") ControlClick($title, "", "Button2") ; Choose Components WinWaitActive($title, "Choose Components") ControlClick($title, "", "Button2") ; License Agreement WinWaitActive($title, "License Agreement") ControlClick($title, "", "Button2") ; Choose Install Location WinWaitActive($title, "Choose Install Location") ControlClick($title, "", "Button2") ; Completing the VideoLAN VLC media player 0.8.6d Setup Wizard WinWaitActive($title, "Completing the VideoLAN VLC media player 0.8.6d Setup Wizard") ControlCommand($title, "", "Button4", "UnCheck", "") ControlClick($title, "", "Button2") Link to comment Share on other sites More sharing options...
whim Posted February 5, 2008 Share Posted February 5, 2008 @OP How about using the .7z version of VideoLAN ? No installer, just unpack -> done Link to comment Share on other sites More sharing options...
simusphere Posted February 5, 2008 Share Posted February 5, 2008 The following code is for the portable version of VLC and it works fine for me: $titlebar1 = "VLC Media Player Portable | PortableApps.com Installer" Opt("TrayIconDebug", 1) Run("portvlc086cpaf.exe") ;First dialog screen WinWaitActive($titlebar1) Send("{ENTER}") ;Second dialog screen WinWaitActive($titlebar1) Send("C:\temp\VLCPortable") Send("{ENTER}") ;Third dialog screen WinWaitActive($titlebar1) Send("!f") Link to comment Share on other sites More sharing options...
MHz Posted February 6, 2008 Share Posted February 6, 2008 Problems that I notice:WinWaitActive not needed for Control* functions so use WinWait instead to ensure reliability.2 license windows in the script but I experienced 1 only. Perhaps the installation causes the 2nd license window to not appear when you have had it installed previously so I added AdlibEnable to handle it.This works for me:Opt("TrayIconDebug", 1) $pid = Run('vlc-0.8.6d-win32.exe') $title = "VideoLAN VLC media player" ; Please select a language. If WinWait("Installer Language", "Please select a language", 60) Then ControlClick("Installer Language", "Please select a language", "Button1") ; Start checking for a license window during installation AdlibEnable('_Adlib') ; Welcome to the VideoLAN VLC media player 0.8.6d Setup Wizard WinWait($title, "Welcome to the VideoLAN VLC media player") ControlClick($title, "Welcome to the VideoLAN VLC media player", "Button2") ; Choose Components WinWait($title, "Choose Components") ControlClick($title, "Choose Components", "Button2") ; Choose Install Location WinWait($title, "Choose Install Location") ControlClick($title, "Choose Install Location", "Button2") ; Completing the VideoLAN VLC media player 0.8.6d Setup Wizard WinWait($title, "Completing the VideoLAN VLC media player") ControlCommand($title, "Completing the VideoLAN VLC media player", "Button4", "UnCheck") ControlClick($title, "Completing the VideoLAN VLC media player", "Button2") ; Stop checking for a license window AdlibDisable() ; Continue when setup process has finished ProcessWaitClose($pid) EndIf Exit Func _Adlib() ; License Agreement If WinExists($title, "License Agreement") Then ControlClick($title, "License Agreement", "Button2") EndIf EndFunc 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