I am trying to set up relevence that will look for a particular file, and will report back 1 of 2 returns, depending on the content of the file. If file does not exist, return n/a. I am drawing a blank. below is what I have so far.
q: if (exists file “C:\Program Files\Cisco Systems\VPN Client\vpnclient.ini”) AND (exists lines whose (it contains “howdy”) of file “C:\Program Files\Cisco Systems\VPN Client\vpnclient.ini”) then “Outdated” OR (exists lines whose (it contains “Doodie”) of file “C:\Program Files\Cisco Systems\VPN Client\vpnclient.ini” then “Current”) else “N/A”
Use two linked innter IF/THEN statements, with the else of the first containing the second test. The else of the second test contains your “N/A”.
The intial file test could say “N/A” as well, but I think its clearer to have a result showing there is not file, vs the file existing but with the wrong contents.
IF (exists file “c:\temp\linecheck.txt”) THEN (IF (exists lines whose(it contains “How-D”) of file “c:\temp\linecheck.txt”) THEN (“Outdated”) ELSE (IF(exists lines whose(it contains “Do-D”) of file “c:\temp\linecheck.txt”) THEN (“Current”) ELSE (“N/A”))) ELSE (“File does not exist”)
Probably could be done a bit cleaner with a single file test, but this works for me.
(if ((concatenation of lines of it) contains “howdy”) then “Outdated” else if (concatenation of lines of it contains “Doodle”) then “Current” else “N/A”) of file “C:\somefile.txt”
The “exists” part still needs to be thrown on the front of that.
Oh right! In version 8 you can ditch the Exists part and do this:
(
if ((concatenation of lines of it) contains
"howdy") then
"Outdated"
else
if (concatenation of lines of it contains
"Doodle") then
"Current"
else
"N/A") of file
"C:\somefile.txt" |
"File does not exist"