I have an ActionScript that I know will fail sometimes. As the action is sent out, I will input the number of times to try and over what time frame for that action. In the script, if some conditions are not met, I exit mid-script and the action is considered a failure. When that happens and the action is on its last retry, I want to kick off a different “IF” condition. Something like:
if {retry number of action >= retry allowed of action}
//do something else here
exit
endif
I know I could be tricky-tricky and write/read a temp file, but hoped there was a better way. There just has to be a way to keep all of this native to action script.
OK, I’m close, but I’m getting substituion errors.
//parameter "_fxfFileMail" = "{pathname of client folder of current site}/Action {id of action}.fxf"
//parameter "_fxfFile" = "{pathname of client folder of mailboxsite}/Action {id of action}.fxf"
parameter "_fxfFolder" = "C:\Program Files (x86)\BigFix Enterprise\BES Client\__BESData\mailboxsite"
parameter "_fxfFile" = "Action {id of action}.fxf"
parameter "_retryNum" = "{(it as trimmed string) of following text of first "action-retry-limit: " of lines of file "(parameter "_fxfFile")" of folder "(paramiter "_fxfFolder")"}"
wait cmd /c "echo {id of action} - {active count of action} of {paramiter "_retryNum"} >> c:/test.txt"
I get:
Command succeeded parameter “_fxfFolder” = “C:\Program Files (x86)\BigFix Enterprise\BES Client__BESData\mailboxsite” (action:433942)
Command succeeded parameter “_fxfFile” = “Action 433942.fxf” (action:433942)
Command failed (Relevance substitution failed) parameter “_retryNum” = "{(it as trimmed string) of following text of first “action-retry-limit: " of lines of file “(parameter “_fxfFile”)” of folder “(paramiter “_fxfFolder”)”}” (action:433942)
Besides the typ0, this may be a little easier… (if exist header "action-retry-limit" of it then (value of header "action-retry-limit" of it as string) else "0") of action
parameter "_retryNum" = "{(if exist header "action-retry-limit" of it then (value of header "action-retry-limit" of it as string) else "0") of action as integer}"
if { active count of action as integer >= (parameter "_retryNum" as integer + 1) }
wait cmd /c "echo {id of action} all done! >> c:/test.txt"
else
wait cmd /c "echo {id of action} - {active count of action} of {parameter "_retryNum"} >> c:/test.txt"
endif