My action below does not have the expect outcome(end up with blank file):
parameter “filename” = “c:\temp\type10task.xml”
appendfile {(if (it contains " YOURCOMUTERNAME Local Event Logs") then " " & computer name & " Local Event Logs" else it as string) of lines of file (parameter “filename”)}
Command succeeded appendfile {(if (it contains " YOURCOMUTERNAME Local Event Logs") then " " & computer name & " Local Event Logs" else it as string) of lines of file (parameter “filename”)}
Command succeeded (file created) appendfile ÿþ<
Command succeeded appendfile ÿþ<
Command succeeded delete No ‘c:\temp\type10task.xml.bak’ exists to delete, no failure reported
The non-alphanumeric characters are throwing things off so you have to escape them by replacing them with their corresponding hex values. You could use the XML inspectors also but for something this simple replacing the symbol with hex might be easier.
http://ascii.cl/
has a table that shows you what converts to what.
Replace the above with this and post back if you still have problems.
parameter “filename” = “c:\temp\type10task.xml”
appendfile {(if (it contains " %3CSubject%3EYOURCOMUTERNAME Local Event Logs%3C%2FSubject%3E") then " " & computer name & " Local Event Logs" else it as string) of lines of file (parameter “filename”)}
appendfile {(if (it contains “%3CSubject%3EYOURCOMUTERNAME Local Event Logs%3C%2FSubject%3E”) then “%3CSubject%3E” & computer name & " Local Event Logs%3C%2FSubject%3E" else it as string) of lines of file (parameter “filename”)}
I see a relevance failure when I do not have the
"c:\temp\type10task.xml"
file in place. Are you sure that the file exists? If the placement of the file is in question then I would suggest adding a file check to your relevance to make sure the file exists (below). You can also add a check to your actionscript. If you want to do that just let me know and I can help you.
“appendfile” doesn’t loop through multiple results, it expects to receive a single string.
“lines of file” returns multiple results. You need to concatenate them back together, using whatever end-of-line marker is appropriate for your OS. For Windows/DOS, the sequence is “Carriage Return / Line Feed”, represented as “%0d%0a”.
I don’t think the < or > symbols need to be escaped. In ActionScript itself, only { or } should need to be escaped; and inside the Relevance Evaluation, I think only the % character needs to be escaped (as it’s otherwise used to represent unprintables like CR, LF, quote symbols, etc.) along with quotes that would otherwise terminate the string.
try this:
appendfile {concatenation “%0d%0a” of (if (it contains " YOURCOMUTERNAME Local Event Logs") then " " & computer name & " Local Event Logs" else it as string) of (lines of file (parameter “filename”) as string)}