Maybe it is just me, but the /file commands are not returning to the script (EDIT: on fail only). Is there a way I can get a return value instead of the script aborting?
Same with script command ":resolve" on V3.X. OK on success. Aborts script on fail. Several of us need a return value on fail. I did not even realize it was failing until someone else on the forum brought it to my attention.
UPDATE: I found the reason my scripts with /file commands were failing. You cannot embed the /file get and find commands. You must use the 'find' parameter assigned to a variable, then check it. If it is valid, then you can use that variable in other file commands. If you use this
:global filecontents [/file get [/file find name=test.txt] contents]
and the file does not exist, then the script will abort.
With this
Code: Select all
:global files [/file find name=test.txt]
:if ([:len $files] > 0) do={
:global filecontents [/file get $files contents]
} else={
:log info "failed"
}
:resolve still a problem