Issues with Action Script where file path contains { }

I have having an odd issue with evaluation of Action Script with a file path that contains the { } characters. Normally with registry values you can just do the double {{ to escape but it doesnt seem to work the same way with file paths.

Basically I have multiple possible locations for the same file but they are all buried in a similar fashion. The script that I am working with is below. The statement in the if statement works in QnA but does not seem to work in actionscript. Running the second statement in QnA does work properly. In theory the code below should check the existance in the if/elseif statement and than run the statement afterwards to uninstall.

if (exists file “C:\ProgramData\Package Cache\{96a8b90c-0a91-4e76-ab34-730c23923d11}\vs_community.exe”)
waithidden “C:\ProgramData\Package Cache\{{96a8b90c-0a91-4e76-ab34-730c23923d11}\vs_community.exe” /uninstall /quiet
elseif (exists file “C:\ProgramData\Package Cache\{79b486b9-c5f0-4096-a00c-8351f59587c2}\vs_community.exe”)
waithidden “C:\ProgramData\Package Cache\{{79b486b9-c5f0-4096-a00c-8351f59587c2}\vs_community.exe” /uninstall /quiet

q: (exists file “C:\ProgramData\Package Cache\{96a8b90c-0a91-4e76-ab34-730c23923d11}\vs_community.exe”)
A: False
T: 0.202 ms

q: (exists file “C:\ProgramData\Package Cache\{79b486b9-c5f0-4096-a00c-8351f59587c2}\vs_community.exe”)
A: True
T: 0.209 ms

q: (exists file “C:\ProgramData\Package Cache\{{96a8b90c-0a91-4e76-ab34-730c23923d11}\vs_community.exe”)
A: False
T: 0.153 ms

q: (exists file “C:\ProgramData\Package Cache\{{79b486b9-c5f0-4096-a00c-8351f59587c2}\vs_community.exe”)
A: False
T: 0.178 ms

Maybe it was lost in copy/paste, but your “if” condition should have the curly brackets for relevance substitution and have escaped brackets as well…

‘if {exists folder “c:\folder{subdirectory}}”}’

1 Like

Thanks Jason, that was it. I tried so many combinations but never tried the second closing curly bracket in the folder path.

Glad to hear it.

When in a non-relevance-substitution part of action script, double open curly brackets means “literal bracket, not the start of relevance substitution”.

When inside a relevance substitution, double close brackets means “literal close bracket, not the end of relevance substitution.”

1 Like