wesley Posted September 2, 2008 Share Posted September 2, 2008 hi guys hopefully you could help me out before i made the first script, i followed the tutorial (notepad) and it worked beautiful. so i want to install 7zip with autoit (to practice making script for big and complex installation for anti-virus and office 2007 upgrade from office 2003 etc) but for some reason it wont work. Run("7z457.exe") WinActivate("7-Zip 4.57 Setup" ,"&Install") Send("!i") it wont send (install) button see the screenshot pls. thanks Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 2, 2008 Share Posted September 2, 2008 hi guys hopefully you could help me out before i made the first script, i followed the tutorial (notepad) and it worked beautiful. so i want to install 7zip with autoit (to practice making script for big and complex installation for anti-virus and office 2007 upgrade from office 2003 etc) but for some reason it wont work. Run("7z457.exe") WinActivate("7-Zip 4.57 Setup" ,"&Install") Send("!i") it wont send (install) button see the screenshot pls. thanks Your WinActivate() is being attempted immediately after kicking off the .exe. The window probably doesn't exist yet. Try: Run("7z457.exe") WinWait("7-Zip 4.57 Setup" ,"&Install") WinActivate("7-Zip 4.57 Setup" ,"&Install") Send("!i") And welcome to AutoIt. 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...
Bert Posted September 2, 2008 Share Posted September 2, 2008 Also look at using controlsend. It is more stable. You can get the ID of the button using the AutoIt Window Info tool The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
herewasplato Posted September 2, 2008 Share Posted September 2, 2008 Like PsaltyDS said: Welcome to AutoIt. Also, like PsaltyDS said...Run("7z457.exe") WinWait("7-Zip 4.57 Setup", "&Install") WinActivate("7-Zip 4.57 Setup", "&Install") WinWaitActive("7-Zip 4.57 Setup", "&Install") Send("!i")...but with one extra line just in case... ...or, you could use the /S switch on 7-Zip for a silent install - unless you have a reason/need to interact with the install process. ...and then there is ControlSend like Volly mentioned. So many options :-) [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
wesley Posted September 2, 2008 Author Share Posted September 2, 2008 hello guys thank you for warm welcome lol managed got it working at the end. controlsend.....is it same as send? i had a look at the documentation but i still cant get the concept of the different between them two. how would i make same script for this 7zip but use controlsend codes? cheers Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 2, 2008 Share Posted September 2, 2008 hello guys thank you for warm welcome lol managed got it working at the end. controlsend.....is it same as send? i had a look at the documentation but i still cant get the concept of the different between them two. how would i make same script for this 7zip but use controlsend codes?cheers With Send() you are simply simulating key strokes, with no control over where they are sent to. The text goes to whatever control has edit focus in whatever window currently has focus. With ControlSend() you specify the exact window and control you want the sent data to go to. This can be done even to a window that is minimized or has lost focus and is buried under other windows on the desktop. That is what makes ControlSend() preferable to Send(). 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...
herewasplato Posted September 3, 2008 Share Posted September 3, 2008 ... how would i make same script for this 7zip but use controlsend codes? ...Run("7z457.exe") WinWait("7-Zip 4.57 Setup", "&Install") ControlSend("7-Zip 4.57 Setup", "&Install", "Button2", "{ENTER}") WinWait("7-Zip 4.57 Setup", "&Finish") ControlSend("7-Zip 4.57 Setup", "&Finish", "Button2", "{ENTER}")oÝ÷ ÙK¶¢gjgªê-ëh"Õ¢Ú0"wèªê-¶âÛazv¦zíæî¶Ú'rí®h~)íz·¬µ'¶i¹ÚçjºB¢{k¢Z®¢Ü"¶§¶¶%J¶)±¬"Ú0Â)e²0ºî¶Ø^nëm¢x§¶Â)Ý£¬jº+^æÊÚz¬çX¢é¢pj{m¢f¤zØ^±Êâ¦Ü×è®ØZµ»¶í¡·«y§rjëh×6Run("7z457.exe") WinWait("7-Zip 4.57 Setup", "&Install") Do Sleep(9) Until ControlCommand("7-Zip 4.57 Setup", "&Install", "Button2", "IsEnabled", "") ControlSend("7-Zip 4.57 Setup", "&Install", "Button2", "{ENTER}") WinWait("7-Zip 4.57 Setup", "&Finish") Do Sleep(9) Until ControlCommand("7-Zip 4.57 Setup", "&Finish", "Button2", "IsEnabled", "") ControlSend("7-Zip 4.57 Setup", "&Finish", "Button2", "{ENTER}") Or you can put the full path to the exe and that same /S into a txt file. Then change the ".txt" extension to ".bat" and run that without compiling it. :-) [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
herewasplato Posted September 3, 2008 Share Posted September 3, 2008 ... how would i make same script for this 7zip but use controlsend codes? ...Run("7z457.exe") WinWait("7-Zip 4.57 Setup", "&Install") ControlSend("7-Zip 4.57 Setup", "&Install", "Button2", "{ENTER}") WinWait("7-Zip 4.57 Setup", "&Finish") ControlSend("7-Zip 4.57 Setup", "&Finish", "Button2", "{ENTER}")oÝ÷ ÙK¶¢gjgªê-ëh"Õ¢Ú0"wèªê-¶âÛazv¦zíæî¶Ú'rí®h~)íz·¬µ'¶i¹ÚçjºB¢{k¢Z®¢Ü"¶§¶¶%J¶)³§v,²0ºî¶Ø^nëm¢x¬jº+^æÊÚz¬çX¢é¢pj{m¢f¤zØ^±Êâ¦Ü×è®ØZµ»¶í¡·«y§rjëh×6Run("7z457.exe") WinWait("7-Zip 4.57 Setup", "&Install") Do Sleep(9) Until ControlCommand("7-Zip 4.57 Setup", "&Install", "Button2", "IsEnabled", "") ControlSend("7-Zip 4.57 Setup", "&Install", "Button2", "{ENTER}") WinWait("7-Zip 4.57 Setup", "&Finish") Do Sleep(9) Until ControlCommand("7-Zip 4.57 Setup", "&Finish", "Button2", "IsEnabled", "") ControlSend("7-Zip 4.57 Setup", "&Finish", "Button2", "{ENTER}") Or you can put the full path to the exe and that same /S into a txt file. Then change the ".txt" extension to ".bat" and run that without AutoIt. :-) [size="1"][font="Arial"].[u].[/u][/font][/size] 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