Jump to content

newbie help on automating installs


mmancini
 Share

Recommended Posts

ok, I tried both recorders with minimal luck. so I mad this script to automate the install of Malware Bytes and while it launches the setup it crashes and I don't know why. I am obviously missing something big.

Run("c:\twistedtech-temp\mbam-setup.exe")

sleep(3000)

Send("+{TAB}")

Send ("{enter}")

Send ("{enter}")

Send("!a")

Send ("{enter}")

Send ("{enter}")

Send ("{enter}")

Send ("{enter}")

Send ("{enter}")

Send ("{enter}")

sleep(10000)

Send ("{enter}")

Sleep(10000)

Send ("{enter}")

sleep(10000)

send("!n")

sleep(10000)

Send("{TAB}")

Send("{TAB}")

Send ("{SPACE}")

send("!n")

sleep(10000)

Link to comment
Share on other sites

Most are not going to install MalwareBytes just to test your script. So you need to describe your symptoms more clearly than "...while it launches the setup it crashes and I don't know why."

To make install scripts in general more reliable, use things like WinExists() to make sure windows have been created before trying to interact with them, and ControlSend()/ControlClick() to be sure inputs are going where you want them.

More specific help from the forum will require a more specific description of the issue.

;)

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

ok, I tried both recorders with minimal luck. so I mad this script to automate the install of Malware Bytes and while it launches the setup it crashes and I don't know why. I am obviously missing something big.

Here is my solution:

GUICtrlSetData($info, "Malwarebytes Antispyware 1.31.0.0 is installing")
            Run(@tempdir&"\TechFaves\Spyware Removal\mbam-setup.exe")
            GUICtrlSetData($info, "waiting for ""Select Setup Language"" screen")
            Do
                sleep($timedelay)
                if WinExists("Select Setup Language") Then
                    WinActivate("Select Setup Language")
                    GUICtrlSetData($info, "send ""Enter""")
                    sleep($timedelay)
                    send("{ENTER}")
                    GUICtrlSetData($info, "waiting for ""Welcome"" screen")
                EndIf
                if WinExists("Setup - Malwarebytes' Anti-Malware","This will install Malwarebytes") Then
                    WinActivate("Setup - Malwarebytes' Anti-Malware","This will install Malwarebytes")
                    GUICtrlSetData($info, "send ""Enter""")
                    sleep($timedelay)
                    send("{ENTER}")
                    GUICtrlSetData($info, "waiting for ""License Agreement"" screen")
                EndIf
                if WinExists("Setup - Malwarebytes' Anti-Malware","Please read the following important information before") Then
                    WinActivate("Setup - Malwarebytes' Anti-Malware","Please read the following important information before")
                    GUICtrlSetData($info, "select ""Accept"" tab (send ""Tab"")")
                    sleep($timedelay)
                    send("{TAB}")
                    GUICtrlSetData($info, "check ""Accept"" tab (send ""Up"")")
                    sleep($timedelay)
                    send("{UP}")
                    GUICtrlSetData($info, "send ""Enter""")
                    sleep($timedelay)
                    send("{ENTER}")
                    GUICtrlSetData($info, "waiting for ""Information"" screen")
                EndIf
                if WinExists("Setup - Malwarebytes' Anti-Malware","When you are ready to continue") Then
                    WinActivate("Setup - Malwarebytes' Anti-Malware","When you are ready to continue")
                    GUICtrlSetData($info, "send ""Enter""")
                    sleep($timedelay)
                    send("{ENTER}")
                    GUICtrlSetData($info, "waiting for ""Destination Location"" screen")
                EndIf
                if WinExists("Setup - Malwarebytes' Anti-Malware","If you would like to select a different folder") Then
                    WinActivate("Setup - Malwarebytes' Anti-Malware","If you would like to select a different folder")
                    GUICtrlSetData($info, "send ""Enter""")
                    sleep($timedelay)
                    send("{ENTER}")
                    GUICtrlSetData($info, "send ""Select Start Menu Folder"" screen")
                EndIf
                if WinExists("Folder Exists") Then
                    sleep($timedelay)
                    send("{ENTER}")                 
                EndIf                   
                if WinExists("Setup - Malwarebytes' Anti-Malware","Setup will create the program's shortcuts") Then
                    WinActivate("Setup - Malwarebytes' Anti-Malware","Setup will create the program's shortcuts")
                    GUICtrlSetData($info, "send ""Enter""")
                    sleep($timedelay)
                    send("{ENTER}")
                    GUICtrlSetData($info, "waiting for the ""Select Additional Tasks"" Screen")
                EndIf
                if WinExists("Setup - Malwarebytes' Anti-Malware","Select the additional tasks you would like") Then
                    WinActivate("Setup - Malwarebytes' Anti-Malware","Select the additional tasks you would like")
                    GUICtrlSetData($info, "send ""Enter""")
                    sleep($timedelay)
                    send("{ENTER}")
                    GUICtrlSetData($info, "waiting for the ""Ready to Install"" screen")
                EndIf
                if WinExists("Setup - Malwarebytes' Anti-Malware","Click Install to continue with the installation") then
                    WinActivate("Setup - Malwarebytes' Anti-Malware","Click Install to continue with the installation")
                    GUICtrlSetData($info, "send ""Enter""")
                    sleep($timedelay)
                    send("{ENTER}")
                    GUICtrlSetData($info, "waiting for the ""Completing"" screen")
                    WinWait("Setup - Malwarebytes' Anti-Malware","Setup has finished installing Malwarebytes")
                    ProcessClose("mbam-setup.exe")
                    ProcessClose("mbam-setup.tmp")
                    GUICtrlSetData($info, "updating (may take a little while)")
                    ExitLoop
                EndIf
            until 1=2
            Run(@ProgramFilesDir&"\Malwarebytes' Anti-Malware\mbam.exe /updateshowdialog")
            Do
                if WinExists("Malwarebytes' Anti-Malware","The latest version of Malwarebytes' Anti-Malware has been downloaded") then send("{ENTER}")
                if winexists("Malwarebytes' Anti-Malware","Congratulations") then
                    send("{ENTER}")
                    ProcessClose("mbam.exe")
                    Do
                    until not ProcessExists("mbam.exe")
                    Run(@ProgramFilesDir&"\Malwarebytes' Anti-Malware\mbam.exe /updateshowdialog")
                    if WinExists("Malwarebytes' Anti-Malware","The latest version of Malwarebytes' Anti-Malware has been downloaded") then 
                        msgbox(0,"","done")
                        send("{ENTER}")
                    EndIf
                EndIf
                if WinExists("Malwarebytes' Anti-Malware","error") then 
                    send("{ENTER}")
                EndIf
                if WinExists("Malwarebytes' Anti-Malware","You have the latest database version") then 
                    send("{ENTER}")
                    ExitLoop
                EndIf
            until 1=2
        GUICtrlSetData($info, "Malwarebytes installation is complete")

$info is just an Edit box (could be a Label or whatever else you want) that I send status info to, omit that if you want.

Enjoy

Ian

My projects:

  • IP Scanner - Multi-threaded ping tool to scan your available networks for used and available IP addresses, shows ping times, resolves IPs in to host names, and allows individual IPs to be pinged.
  • INFSniff - Great technicians tool - a tool which scans DriverPacks archives for INF files and parses out the HWIDs to a database file, and rapidly scans the local machine's HWIDs, searches the database for matches, and installs them.
  • PPK3 (Persistent Process Killer V3) - Another for the techs - suppress running processes that you need to keep away, helpful when fighting spyware/viruses.
  • Sync Tool - Folder sync tool with lots of real time information and several checking methods.
  • USMT Front End - Front End for Microsoft's User State Migration Tool, including all files needed for USMT 3.01 and 4.01, 32 bit and 64 bit versions.
  • Audit Tool - Computer audit tool to gather vital hardware, Windows, and Office information for IT managers and field techs. Capabilities include creating a customized site agent.
  • CSV Viewer - Displays CSV files with automatic column sizing and font selection. Lines can also be copied to the clipboard for data extraction.
  • MyDirStat - Lists number and size of files on a drive or specified path, allows for deletion within the app.
  • 2048 Game - My version of 2048, fun tile game.
  • Juice Lab - Ecigarette liquid making calculator.
  • Data Protector - Secure notes to save sensitive information.
  • VHD Footer - Add a footer to a forensic hard drive image to allow it to be mounted or used as a virtual machine hard drive.
  • Find in File - Searches files containing a specified phrase.
Link to comment
Share on other sites

While you both (Volly and 987learner) are right, sometimes that option is a pain. Spybot caused me a lot of wasted effort because using their commandline switches in a multi-installer, timing what was going on by looking for running processes and is it still running, did the next thing go, etc was a pain in the butt. Knowing how to do a solid automation can be very useful (and no matter how many times I see it I LOVE watching it go by itself!! ;) )

Ian

My projects:

  • IP Scanner - Multi-threaded ping tool to scan your available networks for used and available IP addresses, shows ping times, resolves IPs in to host names, and allows individual IPs to be pinged.
  • INFSniff - Great technicians tool - a tool which scans DriverPacks archives for INF files and parses out the HWIDs to a database file, and rapidly scans the local machine's HWIDs, searches the database for matches, and installs them.
  • PPK3 (Persistent Process Killer V3) - Another for the techs - suppress running processes that you need to keep away, helpful when fighting spyware/viruses.
  • Sync Tool - Folder sync tool with lots of real time information and several checking methods.
  • USMT Front End - Front End for Microsoft's User State Migration Tool, including all files needed for USMT 3.01 and 4.01, 32 bit and 64 bit versions.
  • Audit Tool - Computer audit tool to gather vital hardware, Windows, and Office information for IT managers and field techs. Capabilities include creating a customized site agent.
  • CSV Viewer - Displays CSV files with automatic column sizing and font selection. Lines can also be copied to the clipboard for data extraction.
  • MyDirStat - Lists number and size of files on a drive or specified path, allows for deletion within the app.
  • 2048 Game - My version of 2048, fun tile game.
  • Juice Lab - Ecigarette liquid making calculator.
  • Data Protector - Secure notes to save sensitive information.
  • VHD Footer - Add a footer to a forensic hard drive image to allow it to be mounted or used as a virtual machine hard drive.
  • Find in File - Searches files containing a specified phrase.
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...