Silverel Posted November 10, 2008 Share Posted November 10, 2008 Hey there. Love these forums, they've helped me out tons in the past weeks as I've been learning AutoIt. I'm writing a script to uninstall a handful of programs. Upon initial testing with some client PC's, we found one of the uninstallers was broken, and I need a way to bypass the whole section of code and report it when the script finishes. Ideally, something to add to each section for the same functionality would be great. I've been digging through the forums and the help file trying to find a way, hopefully asking a question here will net quicker results. CODE; Uninstalls Enterprise Provisioning Suite Direct! runas ($sUserName, @ComputerName, $sPassword, 0, "C:\Program Files\InstallShield Installation Information\{332C4D4B-E595-405D-9C32-26AC38464BC3}\setup.exe") WINWAITactive ("InstallShield Wizard", "&Next >") send ("r") send ("{ENTER}") winwaitactive ("Confirm File Deletion", "OK") send ("{ENTER}") winwaitactive ("Shared File Detected", "&Yes") send ("{ENTER}") winwaitactive ("InstallShield Wizard", "Finish") send ("{down}") send ("{ENTER}") runas ($sUserName, @ComputerName, $sPassword, 0, "rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,1") WinWaitActive ("System Properties", "Network Identification") send ("r") send ("{TAB}{TAB}{TAB}") send($domain) send("{ENTER}") Winwaitactive ("Domain Username And Password", "&Name:") send($domuser) send("{TAB}") send($dompass) send("{ENTER}") WinWaitActive ("Network Identification", "Welcome") send ("{ENTER}") WinWaitActive ("Network Identification", "reboot") send("{ENTER}") WinWaitActive ("System Properties", "Network Identification") send ("{TAB}{TAB}{ENTER}") _FileCreate($sFilePath) WinWaitActive ("System Settings Change", "&No") send("y") There are other uninstalls that I left out to save on space, and stay relevant. The second section is the end of the script which changes the domain and restarts the PC. The FileCreate simply drops a 0k text file as an identifier for another script that needs to run afterwards. Another aspect would be to identify which uninstalls were bypassed, and log them to a text file. Just more things that I'm not familiar with. I'd imagine the first step would be to create $Paths for them, but I'm not sure how I would use them to accomplish my goals. Help is much appreciated. Link to comment Share on other sites More sharing options...
Bert Posted November 10, 2008 Share Posted November 10, 2008 Several things may help:You can find uninstall info in the registry, which gives you a path to the uninstall string to use for the app you trying to uninstall.You can also see if the uninstaller has command line switches to make the whole thing MUCH easier to automate. InstallShield commonly uses switches. To see what switch to use, run the uninstall with /?. Many times it will give you a GUI with the list of available switches.Look at using controlsend instead of send. Makes things more stable.Good work on what you have done so far. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Silverel Posted November 10, 2008 Author Share Posted November 10, 2008 Several things may help:You can find uninstall info in the registry, which gives you a path to the uninstall string to use for the app you trying to uninstall.You can also see if the uninstaller has command line switches to make the whole thing MUCH easier to automate. InstallShield commonly uses switches. To see what switch to use, run the uninstall with /?. Many times it will give you a GUI with the list of available switches.Look at using controlsend instead of send. Makes things more stable.Good work on what you have done so far.Thanks All the uninstall strings are pulled from the registy. I'm not sure how I would parse that information from within AutoIt, but the code works so far. It's just an error with the app uninstall, not the code.Only 2 of the programs use InstallShield, and those are indeed done with switches.Ah... Whats the difference between ControlSend and Send? Would I be able to just replace the Send commands with ControlSend with the current code? Link to comment Share on other sites More sharing options...
Bert Posted November 10, 2008 Share Posted November 10, 2008 Controlsend will send to the window you want, no matter if it is active or not. This will make it more stable in that if your current script loses focus to the window you want to command to be sent to, the thing would still work. Currently, you lose window focus, the script breaks. To parse the information to AutoIt, use RegRead to get the info, then use run with the correct string. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Silverel Posted November 10, 2008 Author Share Posted November 10, 2008 I'm not exactly sure how If statements work in AutoIt, but would this bit of code work? CODErunas ($sUserName, @ComputerName, $sPassword, 0, "C:\Program Files\InstallShield Installation Information\{332C4D4B-E595-405D-9C32-26AC38464BC3}\setup.exe") if WINactive ("InstallShield Wizard", "&Next >") Then send ("r") send ("{ENTER}") winwaitactive ("Confirm File Deletion", "OK") send ("{ENTER}") winwaitactive ("Shared File Detected", "&Yes") send ("{ENTER}") winwaitactive ("InstallShield Wizard", "Finish") send ("{down}") send ("{ENTER}") else _FileCreate ($EPSDFail) EndIf I would test it if I could... Link to comment Share on other sites More sharing options...
Bert Posted November 10, 2008 Share Posted November 10, 2008 I fixed it up a bit, and added a sleep to allow for the app to open. runas ($sUserName, @ComputerName, $sPassword, 0, "C:\Program Files\InstallShield Installation Information\{332C4D4B-E595-405D-9C32-26AC38464BC3}\setup.exe") sleep(5000) ;allows for app to open if there. You may want to look at ProcessExist if WinActive ("InstallShield Wizard", "&Next >") Then send ("r") send ("{ENTER}") winwaitactive ("Confirm File Deletion", "OK", 30) send ("{ENTER}") winwaitactive ("Shared File Detected", "&Yes", 30) send ("{ENTER}") winwaitactive ("InstallShield Wizard", "Finish", 30) send ("{down}") send ("{ENTER}") else _FileCreate ($EPSDFail) EndIf The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Silverel Posted November 10, 2008 Author Share Posted November 10, 2008 Ah, Thanks much. I thought something was missing. This will still leave the initial uninstall process running in the background though. I guess I'll need to find out what the process is called and add ProcessClose as part of the Else, right? 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