vipin Posted July 31, 2010 Posted July 31, 2010 Hi,I am creating my addon for the first time and currently I am facing problem in writing a good working script for it. I am using SciTE v1.79 and AutoITI am writing script for Winamp, the download link is : http://download.nullsoft.com/winamp/client/winamp5581_lite_en-us.exe (Just 3 MB)Or choose the lite version from http://www.winamp.com/media-player/enNow, my problem is that the script doesn't works well.Firstly, the problem occurs at "C:\Program Files\Winamp" it never enters it that way. It just types "C:\Prog" and runs away like it is racing with something.Then, the next option of choose "Lite" doesn't works well too. And then the whole script goes wrong and out of order.Please help... This is my script:Run ( "Winamp5.exe" );WelcomeWinWaitActive ("Winamp Installer", "Welcome to the Winamp installer")ControlClick ("Winamp Installer", "", "Button2");License AgreementWinWaitActive ("Winamp Installer", "License Agreement")ControlClick ("Winamp Installer", "", "Button2");Choose Install LocationWinWaitActive ("Winamp Installer", "Choose Install Location")Send ( @ProgramFilesDir & "\Winamp" )ControlClick ("Winamp Installer", "", "Button2");Choose ComponentsWinWaitActive ("Winamp Installer", "Choose Components")Send ( "(L)" )ControlClick ("Winamp Installer", "", "Button2");Choose Start OptionsWinWaitActive ("Winamp Installer", "Choose Start Options")Send ( "(TAB)" )Send ( "(TAB)" )Send ( "(TAB)" )Send ( "(DOWN)" )Send ( "(SPACE)" )Send ( "(DOWN)" )Send ( "(SPACE)" )ControlClick ("Winamp Installer", "", "Button2");Removing AdvertisementsWinWaitActive ("Winamp Installer", "Get the Most Out of Winamp")Send ( "(TAB)" )Send ( "(TAB)" )Send ( "(DOWN)" )Send ( "(SPACE)" )Send ( "(DOWN)" )Send ( "(SPACE)" )Send ( "(DOWN)" )Send ( "(SPACE)" )ControlClick ("Winamp Installer", "", "Button2");Finishing InstallationWinWaitActive ("Winamp Installer", "Installation Complete")ControlClick ("Winamp Installer", "", "Button4")ControlClick ("Winamp Installer", "", "Button2")
mlowery Posted July 31, 2010 Posted July 31, 2010 Is this an AutoHotKey script? Because the SENDs are not in AutoIt syntax. You need curly braces around special keys like {ENTER}, but not around basic letter keys, though you may need a modifier like {ALTDOWN}...{ALTUP}. After you fix that, try ending your "SEND" strings with keystrokes ({TAB}, {ENTER}, etc.) instead of ControlClick() or add a SLEEP delay to ensure that the SEND has completed before the ControlClick executes.
vipin Posted July 31, 2010 Author Posted July 31, 2010 Hi,I have done some changes to the above code. I am a beginner in scripting. I have followed an installation video tutorial by a member of MSFN forums.I am trying to automate the installation of Winamp which I expect to later use as an addon to my nLite Automatic XP SP3 disc.I followed the video tutorial from this article: http://www.msfn.org/board/topic/63596-how-to-create-your-own-add-ons-zcworld-video/ as posted by a member "rado354"His video tutorial appeared to be the easiest to follow for writing automatic software installation script, so I followed that.This is my new modified code and it seems to be working for me right now:Run ( "Winamp5.exe" );WelcomeWinWaitActive ("Winamp Installer", "Welcome to the Winamp installer")ControlClick ("Winamp Installer", "", "Button2");License AgreementWinWaitActive ("Winamp Installer", "License Agreement")ControlClick ("Winamp Installer", "", "Button2");Choose Install LocationWinWaitActive ("Winamp Installer", "Choose Install Location")Send ( @ProgramFilesDir & "\Winamp" )Sleep (10000) ControlClick ("Winamp Installer", "", "Button2");Choose ComponentsWinWaitActive ("Winamp Installer", "Choose Components")ControlClick ("Winamp Installer", "", "Button2");Choose Start OptionsWinWaitActive ("Winamp Installer", "Choose Start Options")ControlClick ("Winamp Installer", "", "Button5")ControlClick ("Winamp Installer", "", "Button6")ControlClick ("Winamp Installer", "", "Button2");Removing AdvertisementsWinWaitActive ("Winamp Installer", "Get the Most Out of Winamp")ControlClick ("Winamp Installer", "", "Button5")ControlClick ("Winamp Installer", "", "Button6")ControlClick ("Winamp Installer", "", "Button7")ControlClick ("Winamp Installer", "", "Button2");Finishing InstallationWinWaitActive ("Winamp Installer", "Installation Complete")ControlClick ("Winamp Installer", "", "Button4")ControlClick ("Winamp Installer", "", "Button2")Can you possibly suggest what should be the right value for "Sleep (10000)". Earlier it was not entering "C:\Program Files\Winamp" properly, but now it is entering. But it is also making me wait. Also, please tell me if this new code is ok, or some improvement can be done in it.After finishing installation, Winamp, after launching for the first time, asks for some settings like which skin to use, which type of audio files to associate with it etc. Can they can also be scripted so that I don't have to enter those settings?thanks again
somdcomputerguy Posted July 31, 2010 Posted July 31, 2010 For the Sleep parameter; just lower it and run the script, if it works OK, lower it some more and run it again.. I'm sure you can use a value way lower than the 10 seconds you have in there. As low as 250, or even 100. And I'm am real sure that those further Winamp settings can be automated. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
smashly Posted August 1, 2010 Posted August 1, 2010 (edited) Hi, Add to the very top of your scriptOpt("SendKeyDelay", 0)Then Replace...Send ( @ProgramFilesDir & "\Winamp" ) Sleep (10000)With...ControlSend("Winamp Installer", "", "Edit1", @ProgramFilesDir & "\Winamp") Cheers Edit: I actually tried your script using ControlSend() instead of ControlClick() and WinWait() instead of WinWatActive() and it works for me. Note You'd need to change the Global $sWinAmpEXE to suite your own path. expandcollapse popupOpt("SendKeyDelay", 0) Global $sWinAmpEXE = @ScriptDir & "\winamp5581_lite_en-us.exe" Global $sInstallDir = @ProgramFilesDir & "\Winamp" Run($sWinAmpEXE) If Not @error Then Local $hWinAmp = WinWait("Winamp Installer") ;Welcome ControlSend ($hWinAmp, "", "Button2", "{ENTER}") ;License Agreement ControlSend ($hWinAmp, "", "Button2", "{ENTER}") ;Choose Install Location $hWinAmp = WinWait("Winamp Installer", "Choose Install Location") ControlSend($hWinAmp, "", "Edit1", $sInstallDir) ControlSend($hWinAmp, "", "Button2", "{ENTER}") ;Choose Components ControlSend($hWinAmp, "", "Button2", "{ENTER}") ;Choose Start Options ControlSend($hWinAmp, "", "Button5", "{SPACE}") ControlSend($hWinAmp, "", "Button6", "{SPACE}") ControlSend($hWinAmp, "", "Button2", "{ENTER}") ;Removing Advertisements ControlSend($hWinAmp, "", "Button5", "{SPACE}") ControlSend($hWinAmp, "", "Button6", "{SPACE}") ControlSend($hWinAmp, "", "Button7", "{SPACE}") ControlSend($hWinAmp, "", "Button2", "{ENTER}") ;Finishing Installation $hWinAmp = WinWait("Winamp Installer", "Installation Complete") ControlSend($hWinAmp, "", "Button4", "{SPACE}") ControlSend($hWinAmp, "", "Button2", "{ENTER}") EndIf Edited August 1, 2010 by smashly
vipin Posted August 1, 2010 Author Posted August 1, 2010 Is there a way to temporarily launch Winamp (after its installation) and let the script do those further settings? And after finishing these settings, also close Winamp automatically. I want my addon to do it all automatically so that after XP installation I just have winamp to launch directly rather than doing settings again and again. (Infact, I am learning this as a method because many softwares do this type of thing during their first launch after installation. Even Windows Media Player asks for entering some similar settings during its first launch)
vipin Posted August 1, 2010 Author Posted August 1, 2010 hello, thanks for your latest code. I was typing my last post and when I typed it out I found your edited post
smashly Posted August 1, 2010 Posted August 1, 2010 Hi, the same way you install winamp is the same way you can go through the settings window. eg; At the end of the install don't uncheck Launch WinAmp. Once winAmp setting window pops up do the ControlClick/ControlSend/ControlCommand to select your options. Once the options are finished and WinAmp starts you can close it with AutoIt as well. The only reason I didn't add the settings into the script is I don't know what settings are to be used..lol
vipin Posted August 1, 2010 Author Posted August 1, 2010 (edited) These are my settings:My script (which I tried) just stops once this first screen comes:In this second screen, I want Video Files NOT to be associated with Winamp.Also, please tell the code to close Winamp once it starts up.P.S.: Tried your code, but it is also running away like it is racing with something. Sleep function has to be used.This is my new code:I am not able to close winamp once it starts up.I am not able to disselect Video Files option.Run ( "Winamp5.exe" );WelcomeWinWaitActive ("Winamp Installer", "Welcome to the Winamp installer")ControlClick ("Winamp Installer", "", "Button2");License AgreementWinWaitActive ("Winamp Installer", "License Agreement")ControlClick ("Winamp Installer", "", "Button2");Choose Install LocationWinWaitActive ("Winamp Installer", "Choose Install Location")Send ( @ProgramFilesDir & "\Winamp" )Sleep (5000)ControlClick ("Winamp Installer", "", "Button2");Choose ComponentsWinWaitActive ("Winamp Installer", "Choose Components")ControlClick ("Winamp Installer", "", "Button2");Choose Start OptionsWinWaitActive ("Winamp Installer", "Choose Start Options")ControlClick ("Winamp Installer", "", "Button5")ControlClick ("Winamp Installer", "", "Button6")ControlClick ("Winamp Installer", "", "Button2");Removing AdvertisementsWinWaitActive ("Winamp Installer", "Get the Most Out of Winamp")ControlClick ("Winamp Installer", "", "Button5")ControlClick ("Winamp Installer", "", "Button6")ControlClick ("Winamp Installer", "", "Button7")ControlClick ("Winamp Installer", "", "Button2");Finishing InstallationWinWaitActive ("Winamp Installer", "Installation Complete");ControlClick ("Winamp Installer", "", "Button4")ControlClick ("Winamp Installer", "", "Button2")Sleep (500);Winamp SetupWinWaitActive ("Winamp Setup", "Choose the look and feel for your Winamp")ControlClick ("Winamp Setup", "", "Button5")WinWaitActive ("Winamp Setup", "Select the file types you want to be associated with Winamp");SEND ( "(DOWN)" );SEND ( "(DOWN)" );SEND ( "(SPACE)" )ControlClick ("Winamp Setup", "", "Button4")ControlClick ("Winamp Setup", "", "Button3")ControlClick ("Winamp Setup", "", "Button5")WinWaitActive ("Winamp Setup", "Let us know more about you so we can continue to improve Winamp")ControlClick ("Winamp Setup", "", "Button4")ControlClick ("Winamp Setup", "", "Button6")SLEEP ( 1000 )SEND ( "(ALT) (F4)" ) Edited August 1, 2010 by vipin
smashly Posted August 1, 2010 Posted August 1, 2010 (edited) Hi, Adjust it to your needs, eg; sleep() and whatnot expandcollapse popupOpt("SendKeyDelay", 0) Global $sWinAmpEXE = @ScriptDir & "\winamp5581_lite_en-us.exe" Global $sInstallDir = @ProgramFilesDir & "\Winamp" Run($sWinAmpEXE) If Not @error Then Local $hWinAmp = WinWait("Winamp Installer") ;Welcome ControlSend($hWinAmp, "", "Button2", "{ENTER}") ;License Agreement ControlSend($hWinAmp, "", "Button2", "{ENTER}") ;Choose Install Location $hWinAmp = WinWait("Winamp Installer", "Choose Install Location") ControlSend($hWinAmp, "", "Edit1", $sInstallDir) Do Sleep(10) Until ControlGetText($hWinAmp, "", "Edit1") = $sInstallDir ControlSend($hWinAmp, "", "Button2", "{ENTER}") ;Choose Components $hWinAmp = WinWait("Winamp Installer", "Choose Components") ControlSend($hWinAmp, "", "Button2", "{ENTER}") ;Choose Start Options $hWinAmp = WinWait("Winamp Installer", "Choose Start Options") ControlSend($hWinAmp, "", "Button5", "{SPACE}") ControlSend($hWinAmp, "", "Button6", "{SPACE}") ControlSend($hWinAmp, "", "Button2", "{ENTER}") ;Removing Advertisements $hWinAmp = WinWait("Winamp Installer", "Get the Most Out of Winamp") ControlSend($hWinAmp, "", "Button5", "{SPACE}") ControlSend($hWinAmp, "", "Button6", "{SPACE}") ControlSend($hWinAmp, "", "Button7", "{SPACE}") ControlSend($hWinAmp, "", "Button2", "{ENTER}") ;Finishing Installation $hWinAmp = WinWait("Winamp Installer", "Installation Complete") ControlSend($hWinAmp, "", "Button2", "{ENTER}") ;---Winamp Setup ;Skin $hWinAmp = WinWait("Winamp Setup") ControlSend($hWinAmp, "", "Button5", "{ENTER}") ;Associations $hWinAmp = WinWait("Winamp Setup", "Select the file types you want to be associated with Winamp.") ControlTreeView($hWinAmp, "", "SysTreeView321", "Select", "Video Files") ControlSend($hWinAmp, "", "SysTreeView321", "{SPACE}") ControlSend($hWinAmp, "", "Button3", "{SPACE}") ControlSend($hWinAmp, "", "Button4", "{SPACE}") ControlSend($hWinAmp, "", "Button5", "{ENTER}") ;User Feedback $hWinAmp = WinWait("Winamp Setup", "Let us know more about you so we can continue to improve Winamp.") ControlSend($hWinAmp, "", "Button4", "{SPACE}") ControlSend($hWinAmp, "", "Button6", "{ENTER}") ;Wait $hWinAmp = WinWaitActive("[CLASS:Winamp v1.x]") WinClose("[CLASS:Winamp v1.x]") EndIf Cheers Edited August 1, 2010 by smashly
vipin Posted August 1, 2010 Author Posted August 1, 2010 Hi, thanks for your new code. I have made changes as given by you in my code. But Winamp is not closing. Please help in that.It is not closing in your code as well as the code that I have written. Please help in that.My code (after making changes by taking help from your code):Run ( "Winamp5.exe" );WelcomeWinWaitActive ("Winamp Installer", "Welcome to the Winamp installer")ControlClick ("Winamp Installer", "", "Button2");License AgreementWinWaitActive ("Winamp Installer", "License Agreement")ControlClick ("Winamp Installer", "", "Button2");Choose Install LocationWinWaitActive ("Winamp Installer", "Choose Install Location")Send ( @ProgramFilesDir & "\Winamp" )Sleep (2500)ControlClick ("Winamp Installer", "", "Button2");Choose ComponentsWinWaitActive ("Winamp Installer", "Choose Components")ControlClick ("Winamp Installer", "", "Button2");Choose Start OptionsWinWaitActive ("Winamp Installer", "Choose Start Options")ControlClick ("Winamp Installer", "", "Button5")ControlClick ("Winamp Installer", "", "Button6")ControlClick ("Winamp Installer", "", "Button2");Removing AdvertisementsWinWaitActive ("Winamp Installer", "Get the Most Out of Winamp")ControlClick ("Winamp Installer", "", "Button5")ControlClick ("Winamp Installer", "", "Button6")ControlClick ("Winamp Installer", "", "Button7")ControlClick ("Winamp Installer", "", "Button2");Finishing InstallationWinWaitActive ("Winamp Installer", "Installation Complete");ControlClick ("Winamp Installer", "", "Button4")ControlClick ("Winamp Installer", "", "Button2")Sleep (500);Winamp SetupWinWaitActive ("Winamp Setup", "Choose the look and feel for your Winamp")ControlClick ("Winamp Setup", "", "Button5")WinWaitActive ("Winamp Setup", "Select the file types you want to be associated with Winamp")ControlTreeView ( "", "Select the file types you want to be associated with Winamp", "SysTreeView321", "SELECT", "Video Files" );SEND ( "(DOWN)" );SEND ( "(DOWN)" );SEND ( "(SPACE)" )ControlClick ("Winamp Setup", "", "Button4")ControlClick ("Winamp Setup", "", "Button3")ControlClick ("Winamp Setup", "", "Button5")WinWaitActive ("Winamp Setup", "Let us know more about you so we can continue to improve Winamp")ControlClick ("Winamp Setup", "", "Button4")ControlClick ("Winamp Setup", "", "Button6");Sleep (5000)WinClose ( "Winamp 5.581", "Winamp v1.x" )Seems like WinClose is not working out.
somdcomputerguy Posted August 1, 2010 Posted August 1, 2010 Perhaps this UDF, Winamp Library [on pure AutoIt] - AutoIt Forums, will help out with this project.. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
madasraka Posted August 1, 2010 Posted August 1, 2010 i did a ton of those Each time you sending a key, you better confirm each step is performed by reading control values or wait for windows to exist. Because each step of the window might change window title, then when ever you send button to go next step make sure next step windows is loaded befor sending another command. otherwise you end up sending commands to windows which has not yet loaded. Also if all setup windows have same name at all times, then check for text in those windows. be unique to text you pick. Winwaitactive ("windowname","agreement") Winactivate ("windowname") Send ("{key}") is the best reproach (or something like that) I hope that helps.
vipin Posted August 3, 2010 Author Posted August 3, 2010 Hi, I am not able to close Winamp once it is launched. Please help in that regard. Also, I have .au3 file and .EXe file with me, how can I make it as a final addon that I can supply to nLite for installing along with my XP CD. thanks
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