Mac OS X help!

(imported topic written by nberger91)

Can anyone assist with me with converting ‘Patches for Mac OS X’ fixlet ID39 - SECURITY: No password Required on Wake From Sleep or Screen Saver to a Retrieved Property.

If (name of operating system does not contain “Mac”) then “N/A” else if ((name of operating system = “Mac OS X”) AND (system version >= “10.2”)) AND ((not exists file whose (name of it contains “com.apple.screensa” and name of it contains “.plist”) of folder “ByHost” of folder “Preferences” of folder “Library” of folder whose (name of it is name of current user) of users folder) OR ((not exists integer “askForPassword” of it OR integer “askForPassword” of it is not equal to 1) of dictionary of file whose (name of it contains “com.apple.screensa” and name of it contains “.plist”) of folder “ByHost” of folder “Preferences” of folder “Library” of folder whose (name of it is name of current user) of users folder)) then “True” else “False”

Its returning ‘Singular expression refers to a non-unique object’ on one particular host, and im assuming this is occuring due to multiple users being logged in ??. My Mac skills are extremely limited as you can probaly tell.

Any help appreciated.

(imported comment written by NoahSalzman)

Q: file whose (name of it contains “com.apple.screensa” and name of it contains “.plist”) of folder “ByHost” of folder “Preferences” of folder “Library” of folder whose (name of it is name of current user) of users folder

A: /Users/noah/Library/Preferences/ByHost/com.apple.screensaver.001b631d95df.plist

E: Singular expression refers to non-unique object.

Q:

files

whose (name of it contains “com.apple.screensa” and name of it contains “.plist”) of folder “ByHost” of folder “Preferences” of folder “Library” of folder whose (name of it is name of current user) of users folder

A: /Users/noah/Library/Preferences/ByHost/com.apple.screensaver.001b631d95df.plist

A: /Users/noah/Library/Preferences/ByHost/com.apple.screensaver.slideshow.001b631d95df.plist

(imported comment written by nberger91)

I’m still getting the same, appreciate if you could point me in the right direction.

If (name of operating system does not contain “Mac”) then “N/A” else if ((name of operating system = “Mac OS X”) AND (system version >= “10.2”)) AND ((not exists files whose (name of it contains “com.apple.screensa” and name of it contains “.plist”) of folder “ByHost” of folder “Preferences” of folder “Library” of folder whose (name of it is name of current user) of users folder) OR ((not exists integer “askForPassword” of it OR integer “askForPassword” of it is not equal to 1) of dictionary of files whose (name of it contains “com.apple.screensa” and name of it contains “.plist”) of folder “ByHost” of folder “Preferences” of folder “Library” of folder whose (name of it is name of current user) of users folder)) then “True” else “False”

(imported comment written by NoahSalzman)

So, the problem with that relevance is that “dictionary of” expects a single file. There is an additional problem in that askForPassword may be in the file /Library/Preferences/com.apple.screensaver.plist which is not checked by that Relevance.

I’ll look into this and get back to you later.

(imported comment written by nberger91)

thanks for your help !

(imported comment written by NoahSalzman)

I’m not sure if my lone Mac is representative of all the 10.6.x Mac’s out in the world… so please test this Relevance before assuming it will work with all variants of OS X. My askForPassword setting is in /Users/noah/Library/Preferences/com.apple.screensaver.plist, which is not the way the aforementioned Fixlet was written. Based on that you can try this for your property:

Q: If (name of operating system does not contain “Mac”) then “N/A” else if ((name of operating system = “Mac OS X”) AND (system version >= “10.2”)) AND ((not exists file whose (name of it contains “com.apple.screensaver.plist”) of folder “Preferences” of folder “Library” of folder whose (name of it is name of current user) of users folder) OR ((not exists integer “askForPassword” of it OR integer “askForPassword” of it is not equal to 1) of dictionary of file whose (name of it contains “com.apple.screensaver.plist”) of folder “Preferences” of folder “Library” of folder whose (name of it is name of current user) of users folder)) then “True” else “False”

A: False

Here is the same thing but testing a value of 0 instead of 1 to show that the Relevance works (at least on my box):

Q: If (name of operating system does not contain “Mac”) then “N/A” else if ((name of operating system = “Mac OS X”) AND (system version >= “10.2”)) AND ((not exists file whose (name of it contains “com.apple.screensaver.plist”) of folder “Preferences” of folder “Library” of folder whose (name of it is name of current user) of users folder) OR ((not exists integer “askForPassword” of it OR integer “askForPassword” of it is not equal to 0) of dictionary of file whose (name of it contains “com.apple.screensaver.plist”) of folder “Preferences” of folder “Library” of folder whose (name of it is name of current user) of users folder)) then “True” else “False”

A: True

And, just for the record, here is the way to confirm this information from the Mac command line:

noah$ defaults read com.apple.screensaver askForPassword

1

(imported comment written by nberger91)

Works great, thanks. Will you be updating the fixlet with this new relevance ?

(imported comment written by NoahSalzman)

I logged it as bug 38631. We’ll fix it… but the end result will likely look different than what I posted.