Relevance to Check for the Verison of a Desktop Shortcut on WinXP and Higher

I have the following relevance that seems to work ok, but is not very straight forward to read. Is there a better way to write this relevance so that it would be more intuitive?

sha1 of file "Time Entry.url" of folder "Desktop" of ((folder "Users\Public" of folder (value of variable "SystemDrive" of environment)) | (folder (value of variable "AllUsersProfile" of environment))) as string | "not exist" != "72d4fe1dae848b8bd070d21858b18fe92114c342"

I’m not clear exactly what you are trying to do as far as which folders to check. You should use plurals and semi-colons instead of pipes to check multiple folders at once. You should always use plural relevance, unless you can’t for comparison reasons.


(folders "Desktop" of it; folders "Links" of it) of folders of folders "Users" of root folders of drives of system folders

files "Time Entry.url" whose("72d4fe1dae848b8bd070d21858b18fe92114c342" = sha1 of it) of (folders "Desktop" of it; folders "Links" of it) of folders of folders "Users" of root folders of drives of system folders

Related:

I am trying to check for the existence of a file in the “AllUsers Desktop” for both Windows XP and Windows 7 in one relevance statement.

Can you provide the typical absolute path for both? (without the relevance)

XP is c:\Documents and Settings\All Users\Desktop and Win7 is c:\Users\Public\Desktop.

This registry also returns the common desktop.

(value "Common Desktop" of key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" of registry as folder)

This seems to work.

not exists file "Time Entry.url" whose(sha1 of it = "72d4fe1dae848b8bd070d21858b18fe92114c342") of (value "Common Desktop" of key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" of registry as folder)
1 Like

You can also do it this way:

files "Time Entry.url" of folders "Desktop" of (folders "c:\Documents and Settings\All Users"; folders "c:\Users\Public")

If I’m using the registry location, I typically do it something like this:

files "Time Entry.url" of (folder it) of unique values of (it as string) of values "Common Desktop" of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" of (x64 registries; x32 registries)

I prefer to preserve the right-to-left reading of relevance when possible.

Why did you have to add unique values?

I didn’t have to, but I am checking both the x64 registry and the x32 registry, which could result in 2 returned values instead of one if the value exists in both.