Help locating Action Script Typo

I either need new glasses or im going mad… I cut and pasted the below in the QNA and ran it with no problems but no matter what I do, including creating a new task and pasted the actionscript in, I keep getting and the reprot of “action script contains a syntax error.” but I cant see where it is…
The “Failed” Marker is at the 2nd line "If exists running application… "

Any help would be appreciated.

 // check to see if Putty is running and if so , then kill 
 if exists running application "PuTTY.exe" 
 waithidden {"taskkill.exe /f /im putty.exe"} 
 endif 
 // Check for .exe installed version and if so, uninstall 
 if {exists value "UninstallString" whose (it as string contains "unins000.exe") of keys whose (value "DisplayName" of it as string contains "PuTTY") of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of registry} 
 override wait 
 hidden=true 
 completion=job 
 wait cmd.exe /C DEL /Q "C:\Program Files (x86)\PuTTY\putty.exe" 
 wait CMD.EXE /C "C:\Program Files (x86)\PuTTY\unins000.exe" /VERYSILENT /SUPPRESSMSGBOXES /SP- 
 endif 
 // Check for msi installed version and if so, uninstall 
 if {{value "UninstallString" of keys whose (value "DisplayName" of it as string as lowercase contains "PuTTY" as lowercase ) of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of registry as string contains "MsiExec.exe"} 
 override wait 
 hidden=true 
 completion=job 
 wait msiexec.exe /X { name of keys whose( (exists values "DisplayName" whose(it as string as lowercase starts with "PuTTY" as lowercase) of it) AND (exists values whose(it as string as lowercase starts with "msiexec") of it) ) of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of ( x64 registries; x32 registries ) } /qn 
 endif 
 // Go fetch V.71 and install 
 prefetch 4b6e4742d61c59e24e7739be1e7a0c1c5492957d.msi sha1:4b6e4742d61c59e24e7739be1e7a0c1c5492957d size:3030016 https://the.earth.li/~sgtatham/putty/0.71/w32/putty-0.71-installer.msi sha256:2c6c5dcb250f78d9946402279ffe9c7f468e862c23b5e489b1ea9a9a81d44178 
 override wait 
 hidden=true 
 completion=job 
 wait msiexec /i "__Download\4b6e4742d61c59e24e7739be1e7a0c1c5492957d.msi" /qn 
 // Delete the old Desktop Link 
 delete "{{value of variable "PUBLIC" of environment}\Desktop\PuTTY.lnk"

Perhaps you’re missing the relevance braces around exists running application "PuTTY.exe" in that line? :grinning:

2 Likes

D’oh… Thank you … Getting an error in the MsiExec area too… Again its prob the Curly brackets.

Yeah you double {{ this which means its not relevance so you probably meant it to be :slight_smile:

Same here, don’t think you meant to escape the {

Thanks all… Still on this one… I have the 1st part working well but this part keeps failing with a “syntax error” Yet the whole thing works well in the QnA Action tester.

// Check for msi installed version and if so, uninstall
Failed if {values “UninstallString” of keys whose (value “DisplayName” of it as string as lowercase contains “PuTTY” as lowercase and value “UninstallString” of it as string as lowercase contains “MsiExec” as lowercase) of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of (x32 registries ; x64 registries)}
override wait
hidden=true
completion=job
wait msiexec.exe /X “{name of keys whose((exists values “DisplayName” whose(it as string as lowercase starts with “PuTTY” as lowercase) of it) AND (exists values whose(it as string as lowercase starts with “msiexec”) of it) ) of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of (x32 registries ; x64 registries)}” /qn
endif

Try

if {exists values “UninstallString” of keys whose (value “DisplayName” of it as string as lowercase contains “PuTTY” as lowercase and value “UninstallString” of it as string as lowercase contains “MsiExec” as lowercase) of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of (x32 registries ; x64 registries)}

The If statement is expecting Boolean but your relevance statement is returning a string value

1 Like

Thanks SLB… That fixed it… I was playing with exactly that when I looked back at your message…

My brain hurts… and I need more coffee :slight_smile:

1 Like

Hey Pete or maybe someone else that might know. I’m needing to do the same thing and I’m getting failed in the same spot. I attempted to implement SLB’s fix but am still getting the issue. So what I have is:

// check to see if Putty is running and if so , then kill

if (exists running application “PuTTY.exe”)
waithidden {“taskkill.exe /f /im putty.exe”}
endif

// Check for .exe installed version and if so, uninstall

if {exists value “UninstallString” whose (it as string contains “unins000.exe”) of keys whose (value “DisplayName” of it as string contains “PuTTY”) of keys “HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall” of registry}
override wait
hidden=true
completion=job
wait cmd.exe /C DEL /Q "C:\Program Files (x86)\PuTTY\putty.exe"
wait CMD.EXE /C “C:\Program Files (x86)\PuTTY\unins000.exe” /VERYSILENT /SUPPRESSMSGBOXES /SP-
endif

// Check for msi installed version and if so, uninstall

if {exists values “UninstallString” of keys whose (value “DisplayName” of it as string as lowercase contains “PuTTY” as lowercase and value “UninstallString” of it as string as lowercase contains “MsiExec” as lowercase) of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of (x32 registries ; x64 registries)}
override wait
hidden=true
completion=job
wait msiexec.exe /X { name of keys whose( (exists values “DisplayName” whose(it as string as lowercase starts with “PuTTY” as lowercase) of it) AND (exists values whose(it as string as lowercase starts with “msiexec”) of it) ) of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of ( x64 registries; x32 registries ) } /qn
endif

When I threw your code in the fixletdebugger I noticed it failed at both IF statements because of smart quotes. After replacing the quotes, it completed for me.

1 Like

Thank you for the quick response. I haven’t had much experience the using the Fixlet Debugger. When running the fixlet it shows all steps complete but doesn’t uninstall PuTTy and returns a “Failed” status. When I run just the uninstall portion in the Debugger get an evaluation error: "Relevance clauses must be surrounded by {and} guards. What I don’t get is my current working uninstaller uses the same code.

wait msiexec.exe /X { name of keys whose( (exists values “DisplayName” whose(it as string as lowercase starts with “PuTTY” as lowercase) of it) AND (exists values whose(it as string as lowercase starts with “msiexec”) of it) ) of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of ( x64 registries; x32 registries ) } /qn

when I copied just that section to my debugger and ran it, I got the same error. there are smart quotes in that section too. I replaced the smart quotes and then it uninstalled putty from my machine.

You’ll also get the same error if you just run the uninstall section of the action when putty isn’t installed on the machine.

What is your applicability relevance and success criteria for the task?

wait msiexec.exe /X { name of keys whose( (exists values "DisplayName" whose(it as string as lowercase starts with "PuTTY" as lowercase) of it) AND (exists values whose(it as string as lowercase starts with "msiexec") of it) ) of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of ( x64 registries; x32 registries ) } /qn

1 Like

So the long story is I have an installer, uninstaller, and an updater fixlet for Putty that all work. The problem I ran into was if someone installed Putty on their own and used the .exe or x64 versions it breaks my uninstaller and patch fixlet. I figure if I get Pete’s patching fixlet working then It will solve all those issues. My updating fixlet relevance in this case looks for Windows OS version and if Putty is installed, that the version is <0.73.

It seems to me that you keep finding the issue being related to smart quotes. I don’t understand how to address this issue. I see them in my text pasted above but don’t see them in the fixlet. How do I identify the smart quotes and convert them to the straight quotes?

Thanks again!

When you past any of the test in here into the QNA debugger tool ,as installed on a Console operators machine, (not the command line qna) , You will see all the “problem areas” highlighted in red if you past it into the QnA tab, not the action tab.

Then its a simple task of copying the bad “ , then ctrl F and pasting the bad " into the find field and then entering the good " … do the same for the leading and trailing "

Dont forget the { will show as bad in the QnA tab but is necessary in the Actionscript tab or task.

Ok it looks like I figured it out. I just installed Putty 0.62 exe and it successfully uninstalled it and install the 0.73 msi.

Thanks so much for your help!