Jump to content

Remove Programs - IF statemant?


wklw2005
 Share

Recommended Posts

I need to remove some software from a few machines. I was going to use the uninstall string key in the registry but I am having issues and the strange thing is the uninstall string in different on other machines. Since I know the software is installed on all machines I thought I could work backwards. Execute the exe and write the script to just remove the software, reg keys, and directories.

I was hoping someone could show me a way to add an IF statement. If the app is not there for some reason, I would like the script to skip and continue with the process. All together I have 10 apps to remove.

Thanks for all the past support and the furture support!

RunWait("ServenamepwxploreSetup.exe")
WinWaitActive("ProjectWise Explorer V8i (SELECTseries 2)","Welcome to the Setup Wizard for ProjectWise Explorer V8i (SELECTseries 2)")
Sleep (6000)
Send("{ENTER}")
WinWaitActive("ProjectWise Explorer V8i (SELECTseries 2) - Setup Wizard","")
send("{down}")
send("{down}")
Send("{ENTER}")
WinWaitActive("ProjectWise Explorer V8i (SELECTseries 2) - Setup Wizard","You have chosen to remove the program.")
Send("{ENTER}")
WinWaitActive("ProjectWise Explorer V8i (SELECTseries 2) - Setup Wizard","Setup Wizard Completed")
Send("{ENTER}")


RegDelete('HKLMSoftwarebentleyprojectwise')
RegDelete('HKLMSoftwarebentleyprojectwise Explorer')
RegDelete('HKLMSoftwarebentleyProjectWise iDesktop Integration')
RegDelete('HKLMSoftwarebentleyProjectWise Explorer Spatial Extension')
DirRemove('C:Program FilesBentleyProjectWise' ,1)
dirremove('C:ProgramDataBentleyProjectWise' , 1)
DirRemove(@AppDataDir &"BentleyProjectWise",1)
DirRemove('C:ProgramDataMicrosoftWindowsStart MenuProgramsBentleyProjectWise V8i (SELECTseries 2)', 1)

RunWait("servernameBentley Installspwclt081107443enDependencyServicesetup.exe")
WinWaitActive("ProjectWise Dependency Service V8i (SELECTseries 2)","")
send("{tab}")
send("{down}")
Send("{ENTER}")
WinWaitActive("ProjectWise Dependency Service V8i (SELECTseries 2)","Installation Complete")
Send("{ENTER}")
Edited by wklw2005
Link to comment
Share on other sites

I believe what you need is FileExists, also if it was me i would put each program into a function just to make it easier but maybe someone knows different example:

func prog1()
If FileExists("ServenamepwxploreSetup.exe]") Then
<runs code>
Else
prog2()
endif
endfunc

Func prog2
<see example above>
endfunc

FileExists: http://www.autoitscript.com/autoit3/docs/functions/FileExists.htm

Edited by Gotemp
Link to comment
Share on other sites

something like this? I tried this but it did not work.

func prog1()
If FileExists ('C:\BentleyDownloads\pwclt081107443en') Then
RunWait("C:\BentleyDownloads\pwclt081107443en")
WinWaitActive("ProjectWise Explorer V8i (SELECTseries 2)","Welcome to the Setup Wizard for ProjectWise Explorer V8i (SELECTseries 2)")
Sleep (6000)
Send("{ENTER}")
WinWaitActive("ProjectWise Explorer V8i (SELECTseries 2) - Setup Wizard","")
send("{down}")
send("{down}")
Send("{ENTER}")
WinWaitActive("ProjectWise Explorer V8i (SELECTseries 2) - Setup Wizard","You have chosen to remove the program.")
Send("{ENTER}")
WinWaitActive("ProjectWise Explorer V8i (SELECTseries 2) - Setup Wizard","Setup Wizard Completed")
Send("{ENTER}")

Else
endif
endfunc
Link to comment
Share on other sites

Close yes, you just need to add prog2() between "else" and "endif" then do program 2 in prog2 and follow suite. Im not sure if this is the best way but im sure someone will say when they check the thread im still learning myself.

Link to comment
Share on other sites

It also has uninstall switches i belive have a look here

http://communities.bentley.com/products/projectwise/content_management/w/wiki/5497.aspx

specifically this bit

  • Un-install of existing ProjectWise modules can be first accomplished by using the following example:

    msiexec /x <full path>pwxplore.msi /qn

    Where /x = uninstall, and /qn = quiet, with no user input

Link to comment
Share on other sites

Thank you so much for the support. I was able to get this to work. I owe somebody a Rum and coke muttley

If FileExists ('C:\BentleyDownloads\pwclt081107443en') Then
RunWait("C:\BentleyDownloads\pwclt081107443en")
WinWaitActive("ProjectWise Explorer V8i (SELECTseries 2)","Welcome to the Setup Wizard for ProjectWise Explorer V8i (SELECTseries 2)")
Sleep (6000)
Send("{ENTER}")
WinWaitActive("ProjectWise Explorer V8i (SELECTseries 2) - Setup Wizard","")
send("{down}")
send("{down}")
Send("{ENTER}")
WinWaitActive("ProjectWise Explorer V8i (SELECTseries 2) - Setup Wizard","You have chosen to remove the program.")
Send("{ENTER}")
WinWaitActive("ProjectWise Explorer V8i (SELECTseries 2) - Setup Wizard","Setup Wizard Completed")
Send("{ENTER}")
Else
endif
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...