Jump to content

Help For Winamp 5 Lite Scrip


Recommended Posts

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 AutoIT

I 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/en

Now, 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" )

;Welcome

WinWaitActive ("Winamp Installer", "Welcome to the Winamp installer")

ControlClick ("Winamp Installer", "", "Button2")

;License Agreement

WinWaitActive ("Winamp Installer", "License Agreement")

ControlClick ("Winamp Installer", "", "Button2")

;Choose Install Location

WinWaitActive ("Winamp Installer", "Choose Install Location")

Send ( @ProgramFilesDir & "\Winamp" )

ControlClick ("Winamp Installer", "", "Button2")

;Choose Components

WinWaitActive ("Winamp Installer", "Choose Components")

Send ( "(L)" )

ControlClick ("Winamp Installer", "", "Button2")

;Choose Start Options

WinWaitActive ("Winamp Installer", "Choose Start Options")

Send ( "(TAB)" )

Send ( "(TAB)" )

Send ( "(TAB)" )

Send ( "(DOWN)" )

Send ( "(SPACE)" )

Send ( "(DOWN)" )

Send ( "(SPACE)" )

ControlClick ("Winamp Installer", "", "Button2")

;Removing Advertisements

WinWaitActive ("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 Installation

WinWaitActive ("Winamp Installer", "Installation Complete")

ControlClick ("Winamp Installer", "", "Button4")

ControlClick ("Winamp Installer", "", "Button2")

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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" )

;Welcome

WinWaitActive ("Winamp Installer", "Welcome to the Winamp installer")

ControlClick ("Winamp Installer", "", "Button2")

;License Agreement

WinWaitActive ("Winamp Installer", "License Agreement")

ControlClick ("Winamp Installer", "", "Button2")

;Choose Install Location

WinWaitActive ("Winamp Installer", "Choose Install Location")

Send ( @ProgramFilesDir & "\Winamp" )

Sleep (10000)

ControlClick ("Winamp Installer", "", "Button2")

;Choose Components

WinWaitActive ("Winamp Installer", "Choose Components")

ControlClick ("Winamp Installer", "", "Button2")

;Choose Start Options

WinWaitActive ("Winamp Installer", "Choose Start Options")

ControlClick ("Winamp Installer", "", "Button5")

ControlClick ("Winamp Installer", "", "Button6")

ControlClick ("Winamp Installer", "", "Button2")

;Removing Advertisements

WinWaitActive ("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 Installation

WinWaitActive ("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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Hi,

Add to the very top of your script

Opt("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.

Opt("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 by smashly
Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

These are my settings:

My script (which I tried) just stops once this first screen comes:

Posted Image

In this second screen, I want Video Files NOT to be associated with Winamp.

Posted Image

Posted Image

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" )

;Welcome

WinWaitActive ("Winamp Installer", "Welcome to the Winamp installer")

ControlClick ("Winamp Installer", "", "Button2")

;License Agreement

WinWaitActive ("Winamp Installer", "License Agreement")

ControlClick ("Winamp Installer", "", "Button2")

;Choose Install Location

WinWaitActive ("Winamp Installer", "Choose Install Location")

Send ( @ProgramFilesDir & "\Winamp" )

Sleep (5000)

ControlClick ("Winamp Installer", "", "Button2")

;Choose Components

WinWaitActive ("Winamp Installer", "Choose Components")

ControlClick ("Winamp Installer", "", "Button2")

;Choose Start Options

WinWaitActive ("Winamp Installer", "Choose Start Options")

ControlClick ("Winamp Installer", "", "Button5")

ControlClick ("Winamp Installer", "", "Button6")

ControlClick ("Winamp Installer", "", "Button2")

;Removing Advertisements

WinWaitActive ("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 Installation

WinWaitActive ("Winamp Installer", "Installation Complete")

;ControlClick ("Winamp Installer", "", "Button4")

ControlClick ("Winamp Installer", "", "Button2")

Sleep (500)

;Winamp Setup

WinWaitActive ("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 by vipin
Link to comment
Share on other sites

Hi,

Adjust it to your needs, eg; sleep() and whatnot

Opt("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 by smashly
Link to comment
Share on other sites

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" )

;Welcome

WinWaitActive ("Winamp Installer", "Welcome to the Winamp installer")

ControlClick ("Winamp Installer", "", "Button2")

;License Agreement

WinWaitActive ("Winamp Installer", "License Agreement")

ControlClick ("Winamp Installer", "", "Button2")

;Choose Install Location

WinWaitActive ("Winamp Installer", "Choose Install Location")

Send ( @ProgramFilesDir & "\Winamp" )

Sleep (2500)

ControlClick ("Winamp Installer", "", "Button2")

;Choose Components

WinWaitActive ("Winamp Installer", "Choose Components")

ControlClick ("Winamp Installer", "", "Button2")

;Choose Start Options

WinWaitActive ("Winamp Installer", "Choose Start Options")

ControlClick ("Winamp Installer", "", "Button5")

ControlClick ("Winamp Installer", "", "Button6")

ControlClick ("Winamp Installer", "", "Button2")

;Removing Advertisements

WinWaitActive ("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 Installation

WinWaitActive ("Winamp Installer", "Installation Complete")

;ControlClick ("Winamp Installer", "", "Button4")

ControlClick ("Winamp Installer", "", "Button2")

Sleep (500)

;Winamp Setup

WinWaitActive ("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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...