Hele with some relevence

(imported topic written by okole91)

I need to work out how to check for relevance for the statements below:

exists

%SYSTEMDRIVE%\ABCD

OR

%ALLUSERSPROFILE%\Application Data\ABCD

AND

not exitsts

c:\120409.txt

If either of the 2 dirs are present and the file is missing I need the relevance to report as true.

If niether dir is present then false.

if file is present then false

(imported comment written by NoahSalzman)

I think this should work:

if ((exists folder “%SYSTEMDRIVE%\ABCD”) or (exists folder “%ALLUSERSPROFILE%\Application Data\ABCD”)) then (if exists file “c:\120409.txt” then False else True) else False

(imported comment written by NoahSalzman)

Oops… Ben correctly pointed out to me that we can’t use windows globals such as %SYSTEMDRIVE% (I hadn’t actually run that relevance, clearly).

(imported comment written by SystemAdmin)

You can use them, it just takes a bit more typing:

value of variable “ALLUSERSPROFILE” of environment

You could use the same technique with SYSTEMDRIVE, but this takes a bit less typing:

name of drive of system folder

(imported comment written by jessewk)

Anytime you find yourself writing ‘if Something then True else False’, you can rewrite your query to be more succinct by removing the if clause. So instead of this:

if ((exists folder “%SYSTEMDRIVE%\ABCD”) or (exists folder “%ALLUSERSPROFILE%\Application Data\ABCD”)) then (if exists file “c:\120409.txt” then False else True) else False

Try this:

if ((exists folder “%SYSTEMDRIVE%\ABCD”) or (exists folder “%ALLUSERSPROFILE%\Application Data\ABCD”)) then (exists file “c:\120409.txt”) else False

But better yet:

exists folder ( name of drive of system folder & “\ABCD”) AND exists folder (value of variable “ALLUSERSPROFILE” of environment & “\Application Data\ABCD”) AND not exists file “c:\120409.txt”

(imported comment written by jessewk)

Oops, should be:

exists folder ( name of drive of system folder & “\ABCD”) OR exists folder (value of variable “ALLUSERSPROFILE” of environment & “\Application Data\ABCD”) AND not exists file “c:\120409.txt”