Action Script Help

(imported topic written by Steve91)

Chaps

I’m removing a product from some of our PC’s and this is the removal string below:

if {exists key whose ((exists value “DisplayName” whose (it as string as lowercase contains “ipass”) of it) AND (exists value “UninstallString” whose (it as string as lowercase contains “rundll32” AND it as string as lowercase contains “installshield”) of it) of it) of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of registry}

waithidden {(following text of first “LaunchSetup " of ((value “UninstallString” of it as string) of keys whose (value “DisplayName” of it as string as lowercase contains “ipass” AND value “UninstallString” of it as string as lowercase != “”) of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of registry)) & " -s -f1”}"{(pathname of client folder of current site) & “__Download\3.35.0.0\remove.iss”}"

endif

Returns…

“C:\Program Files\InstallShield Installation Information{AB6FFA58-F491-11D3-8951-000000024540}\setup.exe” -s -f1"C:\Program Files\BigFix Enterprise\BES Client__BESData\actionsite__Download\3.35.0.0\remove.iss"

The slight problem I have is after \setup.exe" there are 2 spaces before the “-s” switch

I’ve specified to add a space in my action above, but I’m finding that on some machines the registry string that I am parsing has an extra space on the end, thus leading to:

setup.exe" (two spaces) -s

as opposed to…

setup.exe" (one space) -s

Is there a way I can trim the trailing space from the registry string if it exists and ignore it if it doesn’t?

Cheers

Steve

(imported comment written by jessewk)

You can use the ‘as right trimmed string’ cast:

waithidden {(following text of first “LaunchSetup " of ((value “UninstallString” of it as string) of keys whose (value “DisplayName” of it as string as lowercase contains “ipass” AND value “UninstallString” of it as string as lowercase != “”) of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of registry)) as right trimmed string & " -s -f1”}"{(pathname of client folder of current site) & “__Download\3.35.0.0\remove.iss”}"

(imported comment written by Steve91)

Excellent, thanks