Variables and If statements in an action script

(imported topic written by HVS5_Kenneth_Hockin)

I am trying to create an ifstatement inside an action script. I want it to copy a file only if a GUID of a registry key exists, and the file does not already exist.

I seem to be able to get the line to work with the following script

// defines fixlet variables

parameter “appname” = “CDBURNERXP_4.5.1.4003_x64_ML_1.1”

parameter “baseFolder” = “C:/Admin/Deploy/{parameter “appname”}”

parameter “UNINSTALL_DIR” = “C:/Admin/Apps_Uninstall”

if {(exists keys “HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall{4AF95967-2F46-4F4F-A1E3-0A403029DC1D}}” of native registry) AND NOT (exists file “C:/Admin/Apps_Uninstall/CDBURNERXP_4.5.1.4003_x64_ML_1.1_Uninstall.CMD”)}

move “{parameter “baseFolder”}/{parameter “appname”}_Uninstall.CMD” “{parameter “UNINSTALL_DIR”}/{parameter “appname”}_Uninstall.CMD”

endif

I’d like to be able to replace the two searches in the If Statement with parameters, but cannot seem to get it to work, can you use parameters in an If Statement? I’d love to have it work something like this (but either it cannot take variables or I am missing something).

// defines fixlet variables

parameter “appname” = “CDBURNERXP_4.5.1.4003_x64_ML_1.1”

parameter “baseFolder” = “C:/Admin/Deploy/{parameter “appname”}”

parameter “UNINSTALL_DIR” = “C:/Admin/Apps_Uninstall”

parameter “SUCCESS_REG” = “HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall{4AF95967-2F46-4F4F-A1E3-0A403029DC1D}”

if {(exists keys "{parameter “SUCCESS_REG}}” of native registry) AND NOT (exists file “{parameter “UNINSTALL_DIR”}/{parameter “appname”}_Uninstall.CMD”)}

move “{parameter “baseFolder”}/{parameter “appname”}_Uninstall.CMD” “{parameter “UNINSTALL_DIR”}/{parameter “appname”}_Uninstall.CMD”

endif

(imported comment written by MattPeterson)

The problem is you can’t use curly brackets within curly bracket statements. You can however query parameters that are already set. Your if statement would look something like this:

if {(
exists

key (parameter

“SUCCESS_REG”
)

of

native registry)

AND

NOT

(
exists

file ((parameter

“UNINSTALL_DIR”
)

&

“/”

&

(parameter

“appname”
)

&

“_Uninstall.CMD”
))}