Action script with concatenation

Hey all, I’m trying to create an uninstaller for Notepad++ that handles both x86 & x64 installs but I’m running into some issues.

Current iteration:

if {exists key "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\Notepad++" of x32 registries)}  
	wait (value "UninstallString" of key "Notepad++" of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries) as string & " /S")
else
	wait (value "UninstallString" of key "Notepad++" of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of (x64 registries) as string & " /S")
endif

I believe my issue is the wait command and how I am passing values to this. So I have tried switching to a defined parameter instead:

if exists key "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\Notepad++" of x32 registries)
	parameter "uninstall_string" =  (value "UninstallString" of key "Notepad++" of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries) as string & " /S")
else
	parameter "uninstall_string" =  (value "UninstallString" of key "Notepad++" of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of (x64 registries) as string & " /S")
endif

wait "{parameter "uninstall_string"}"

This also does not work. I feel like I am close but this is hard to troubleshoot using Q&A. Any suggestions?

EDIT: Examining my logs it looks like actually for the parameter it doesn’t like the concatenation. :\

You are using relevance substitution in your action but you haven’t wrapped it between { and }, eg

wait {(value "UninstallString" of key "Notepad++" of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of (x64 registries) as string & " /S")}

1 Like

also:

are you testing on a 64-bit client?

If so, you may well benefit from adding

action uses wow54 redirection {not x64 of operating system}

near the top of the script

Yup that was it. Duh. Thank you!

Also @trn I think I’m ok because it is directly passing it the filepath. However I can see that being useful in other cases and will play around with it. Thank you as well!