mrrlg Posted October 15, 2004 Posted October 15, 2004 I am practicing my script writing skills by attempting to install some software from a network share. I can start the installation, but no matter how I try, I cannot get the ControlClick command to work. I have used Auto Spy to find out the title, text class and button number for each command that needs to be executed but the script refuses to run at the first ControlClick. All these commands run within the Same Window, so I have tried disabling all but the first WinWaitActive, that didn't work. I placed the title and text of the window within each command and that didn't work. The instalation just sits there, yet I can click on the Next button and the software installation will move to the next screen. I know it's something simple that I am missing, I just can't figure it out Run ( '\\aoofs\mis\streets\setup.exe' ) WinWaitActive("Microsoft Streets and Trips 2002 Setup") ControlClick("&Next>"," ","Button1") WinWaitActive("Microsoft Streets and Trips 2002 Setup") ControlClick("&Next>", "", "Button2") WinWaitActive("Microsoft Streets and Trips 2002 Setup") ControlClick("Full Installation>", "", "Button3") WinWaitActive("Microsoft Streets and Trips 2002 Setup") ControlClick("&Next>", "", "Button5") WinWaitActive("Microsoft Streets and Trips 2002 Setup") ControlClick("&Next>", "", "Button3") WinWaitActive("Microsoft Streets and Trips 2002 Setup") ControlClick("&Install>", "", "Button4") sleep (50000) WinWaitActive("Microsoft Streets and Trips 2002 Setup") ControlClick("&Finish>", "", "Button1")
MHz Posted October 15, 2004 Posted October 15, 2004 ControlClick ( "title", "text", "classnameNN" [, button] [, clicks]] ) Look at the manual closer at ControlClick. i.e. ControlClick("&Next>"," ","Button1") &Next> is not the title of the window? etc.
Guest tygran Posted October 15, 2004 Posted October 15, 2004 Hello, you should use the command like this: ControlClick("WindowTitle", "WindowText", "Button1", "Mousebutton") ControlClick("WindowTitle", "", "&Next >", $primary) The Windowtitle is "Microsoft Streets and Trips 2002 Setup" in your example. You can use some Windowtext or just use "". The third argument has to be the button e.g. button1 or the exact name of the button e.g. "&Next >". The fourth argument is the Mousebutton e.g. "right", "middle", "left" or as in the help file "primary" or "secondary"(using the function MouseButtonCheck()). For the Windowtitle or -text you have to use the exact form with all spaces (e.g.: "Microsoft Streets and Trips 2002 Setup ")!!
mrrlg Posted October 15, 2004 Author Posted October 15, 2004 Thanks for the help, I am now able to begin the installation. There is a large amount of files to be downloaded to the local machine. The time it will take will vary from machine to machine. Is there a command within AutoIt that will pause the script while the files are being downloaded, or would I be better served by putting a sleep command in for 10 minutes and telling the user to go get coffee?
emmanuel Posted October 15, 2004 Posted October 15, 2004 I think that Larry's working on a GetMyCoffee() function... There is so much that could do what you want... You just need to figure out what you're waiting for... put up a splashtexton before the filecopy or download part of your script, with the splashtextoff after it... like this, for what I was doing: SplashTextOn("cgp prep", "prepping CGP for DR", 250, 100) DirCreate("c:\dr\cgp") DirCopy("\\sgendstx\clntadm_Traders\tools\autoit\cgp_install_src\ORACLE_SRC", "c:\dr\ORACLE_SRC") FileCopy("\\sgendstx\clntadm_Traders\tools\autoit\cgp_install_src\Install CGP for DR.exe", "C:\dr\cgp\*.*", 1) FileCopy("\\sgendstx\clntadm_Traders\tools\autoit\cgp_install_src\Uninstall CGP for DR.exe", "C:\dr\cgp\*.*", 1) FileCreateShortcut('"C:\dr\cgp\Uninstall CGP for DR.exe"', @DesktopCommonDir & '\Uninstall Caminus Gas.lnk') FileCreateShortcut('"C:\dr\cgp\Install CGP for DR.exe"', @DesktopCommonDir & '\Install Caminus Gas for Disaster Recovery.lnk') SplashOff() MsgBox(48, "DR Prep", "CGP prepped", 5) "I'm not even supposed to be here today!" -Dante (Hicks)
mrrlg Posted October 15, 2004 Author Posted October 15, 2004 I can certainly put up a splashtext screen warning the user that it will take a few minutes to download all the files. My problem is that there is no change in the active window when the files are finished downloading. It's still "Microsoft Streets and Trips 2002 Setup" and the user is then prompted to click "Finish". What I am trying to do is figure out a way other than the sleep command, to send that final keystroke to complete the installation.
emmanuel Posted October 15, 2004 Posted October 15, 2004 the user is then prompted to click "Finish". What I am trying to do is figure out a way other than the sleep command, to send that final keystroke to complete the installation.<{POST_SNAPBACK}>so, something does change, the finish button is there. so, wait for the finish button to exist, or use controlcommand's IsEnabled feature to wait for the button to be enabled until continuing.do sleep(10)until stringinstr( wingettext(title) , "Finish" )controlclick finish "I'm not even supposed to be here today!" -Dante (Hicks)
this-is-me Posted October 15, 2004 Posted October 15, 2004 Unfortunately, in most cases, the button is just hidden until needed. Try this: Func ControlWaitVisible($ttl, $txt, $cls) While ControlCommand($ttl, $txt, $cls, "IsVisible", "") = 0 Sleep(250) Wend EndFunc Who else would I be?
emmanuel Posted October 15, 2004 Posted October 15, 2004 Unfortunately, in most cases, the button is just hidden until needed.Try this:Func ControlWaitVisible($ttl, $txt, $cls) While ControlCommand($ttl, $txt, $cls, "IsVisible", "") = 0 Sleep(250) Wend EndFunc<{POST_SNAPBACK}>Yeah, it all depends on the software, though if it's visible, but just greyed out, yours wouldn't work... anywho, mrrlg, you can see there's many ways of doing this. "I'm not even supposed to be here today!" -Dante (Hicks)
mrrlg Posted October 15, 2004 Author Posted October 15, 2004 Ok, I need some more help. I went through all the function commands and I can't find any reference to ControlWaitVisable. I'm looking at the manual for 3.0.101. Is there a newer one?
Developers Jos Posted October 15, 2004 Developers Posted October 15, 2004 Ok, I need some more help. I went through all the function commands and I can't find any reference to ControlWaitVisable. I'm looking at the manual for 3.0.101. Is there a newer one?<{POST_SNAPBACK}>Check out the commands for :ControlCommand ( "title", "text", "classnameNN", "command", "option" ) 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.
this-is-me Posted October 15, 2004 Posted October 15, 2004 The Func before ControlWaitVisible means it is not a function intrinsic to autoit. I MADE IT UP. Who else would I be?
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