randle Posted July 3, 2007 Posted July 3, 2007 I have a very simple script which was compiled in AutoIT: Run("C:\WINDOWS\$NtUninstallwmp11$\spuninst\spuninst.exe /quiet /norestart") As I'm on an RM CC3 network installation/uninstallation needs to be done via msi's of which i have created a blank one just for this purpose but this is just ignored and a command to run the script is used instead. My problem is that although the above command removes wmp11 when allocated out to stations, it tries to run the command again when unallocated which then brings up an error window saying that it can't find the path. Obviously this is going to be the case as it's been removed by the install of this but needs user intervention to get rid of this window. If i add the commands: WinWaitActive("AutoIT Error") Send("{ENTER}") It just messes up the install as the script can't finish because this window doesn't appear at this stage so really i need to add an IF command so that this only happens if this window appears. Can anyone tell me whether this can be done and if so how?
mattx Posted July 3, 2007 Posted July 3, 2007 A bit messy but I would put a flag file [ copy over ] in the location of the folder where the spuninst.exe is. I would then have an 'If' statement before of after stating if the file is there to quit the script or run it.
plexer Posted July 3, 2007 Posted July 3, 2007 Either that or is there a way in autoit to check for the existence of a file/folder if it isn't there it's allready be unistalled so don't continue. Ben
randle Posted July 3, 2007 Author Posted July 3, 2007 The checking for the folders existence sounds ideal but what do i need to add to the script to do this?
michaelf Posted July 3, 2007 Posted July 3, 2007 The checking for the folders existence sounds ideal but what do i need to add to the script to do this? This should do the trick: IF FileExists ("PathOfSomeWP11File") Then Run("C:\WINDOWS\$NtUninstallwmp11$\spuninst\spuninst.exe /quiet /norestart") EndIf Alternatively, you could just specify a timeout on the WinWaitActivate command.
randle Posted July 3, 2007 Author Posted July 3, 2007 You absolute star. This works perfectly and helped me out of a rather large hole. I owe you a beer ;¬)
randle Posted July 10, 2007 Author Posted July 10, 2007 I have been using the above script for some time now which works fine although i need to add another command to it now. This time to remove the Windows media format run-times. I've added the exact same command but with a different path obviously to the bottom of the previous one but when run it only performs one of the commands!! To get this to perform the other it needs to be run again. Is there an AND command that i need to add or a timeout?
ajbritton Posted July 10, 2007 Posted July 10, 2007 The correct way to do this would be to author the MSI so that the script runs in installation only. To do this you need to add the 'NOT Installed' condition on the custom action.
randle Posted July 10, 2007 Author Posted July 10, 2007 I know that an msi is the correct way but i don't have a problem with it running on uninstall anymore. I just need it to run both commands now
nicholab Posted July 10, 2007 Posted July 10, 2007 Can't all that just be done in a batch file? You can make the RM application agent run batch scripts.
randle Posted July 10, 2007 Author Posted July 10, 2007 I don't know what syntax i would use in place of what i already have as I thought some of it is unique to AutoIt or am i wrong? Are you saying that you can point to a bat file using the "EXEFile=" entry? I thought this had to be an exe file or do you mean another way?
randle Posted July 10, 2007 Author Posted July 10, 2007 I think i may be ok. I've just added the "sleep(delay)" control to pause the script and let the first command run and think this may have worked!
nicholab Posted July 10, 2007 Posted July 10, 2007 "point to a bat file using the "EXEFile=" entry?" Yes that what I have done I then use that addcommand on the next line and pointed to the batch file again. I have created three packages this way one for java 6 and two for the smartboard. If the installer is in MSI format you can use the addcommand to directly add msi command line parameter. Another trick is to have two ini file a package which looks to the rm system like two packages this mean that you can to different installs form the same core files. When I am in work I will post the ini file for every one.
randle Posted July 11, 2007 Author Posted July 11, 2007 Ah. I didn't think about Two different ini files. I like that idea and would have worked a treat. I could have even made Two seperate scripts with that. The sleep control seems to work a treat but thanks for the help.
nicholab Posted July 11, 2007 Posted July 11, 2007 Note these are package ini file for an RM CC3 system. Smartboard ini file1: [Package] OS=5.WS Description=Smartboard Software version 9_5_91 EXEFile=notebook.bat AddCommand=notebook.bat UninstallEXEFile=note_un.bat UninstallCommand=note_un.bat Smartboard ini file2: [Package] OS=5.WS Description=Smartboard Software version 9_5_91 EXEFile=smart.bat AddCommand=smart.bat UninstallEXEFile=smart_un.bat UninstallCommand=note_un.bat Note both of the above use that same uninstall batch file. If you create ini file you have to update the RM package list. If you get duplication you need to go into active directory management and delete the package with a similar name. But I am guessing you may have done this all ready. Hope this helps people it took me months to grasp this stuff. :x
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