I’m trying to inspect a boolean value of a preference file. Pretty simple right, so
boolean “value” of preference “com.apple.dock”
Works great.
However if I nest it in some relevancy to check for existence like so:
if exist (name whose (it = “Mac OS X”) of Operating System) then (if (exists file “/Library/Preferences/com.apple.Dock”) then (if (exists boolean “value” of dictionary of file “/Library/Preferences/com.apple.Dock”) then (boolean “value” of preference “com.apple.dock” ) else “No Value”) else “No BFProperties”) else (“didn’t work”)
It returns a strange error:
The expression could not be evaluated: 23ExceptionCannotBeCopied
If remove the statement boolean “value” of preference “com.apple.dock” it works perfectly. Seems to be a bug, unless I’m missing something obvious.
has no meaning in relevance if it is not referencing some other object. Do you actually get a result from that Relevance if you run it by itself in QnA on a Mac?
That is you would need something like:
boolean “value” of key "com.apple.dock of of "
I don’t have the com.apple.Dock file in Mac OS X 10.6.3 … can you post it’s contents here?
I am unable to reproduce that error, however I do think I see some issues with your query.
Your if statement is looking for a specific file but then you are using the preferences inspector in the success branch. You are also looking at a file that will never exist (com.apple.dock will always have a trailing “.plist”). Finally, I’m guessing that you don’t want to be looking at the local library folder, but rather the user library, because that’s where dock preferences live.
So, try one of these options:
booleans “autohide” of dictionaries of files “com.apple.Dock.plist” of preferences folders of user domains
Or:
booleans “autohide” of preferences “com.apple.dock”
I didn’t include any of the if statements. You can add them back, or just use the plural form like I did and then you’ll either get a value (if everything exists as expected) or no value (e.g. if the file doesn’t exist).
No dice, I was using the dock as an example, but here is the exact query that I am using
if exist (name whose (it = “Mac OS X”) of Operating System) then (if (exists file “/Library/Preferences/edu.yale.BigFix.plist”) then (if (exists boolean “IsAuthentic” of dictionary of file “/Library/Preferences/edu.yale.BigFix.plist”) then (boolean “IsAuthentic” of dictionary of file “/Library/Preferences/edu.yale.BigFix.plist”) else “No Value”) else “No BFProperties”) else (“didn’t work”)
QnA returns “The expression could not be evaluated: 23ExceptionCannotBeCopied”. If I use
boolean “IsAuthentic” of dictionary of file “/Library/Preferences/edu.yale.BigFix.plist”
outside of the nested if statements, it works as expected.
Other ideas?
The plist is quite simple it is just a simple plist with one value, IsAuthentic, set to True. Additionally, I should note that it is a binary plist form if that should make a difference.
Your expression works for me, but probably because I don’t have the correct plist file. I’m guessing you have some permissions set on the file that is preventing QnA from reading it, or another process is preventing it from being read, or it’s malformed. If you want to send me a PM and attach the file I’ll take a look and see if I can reproduce it.
Q: (if (exists boolean “IsAuthentic” of dictionary of file “/Library/Preferences/edu.yale.BigFix.plist”) then (boolean “IsAuthentic” of dictionary of file “/Library/Preferences/edu.yale.BigFix.plist”) else “No Value”)
E: Incompatible types.
Just throw a string cast in there:
Q: if exist (name whose (it = “Mac OS X”) of Operating System) then (if (exists file “/Library/Preferences/edu.yale.BigFix.plist”) then (if (exists boolean “IsAuthentic” of dictionary of file “/Library/Preferences/edu.yale.BigFix.plist”) then ((it as string) of boolean “IsAuthentic” of dictionary of file “/Library/Preferences/edu.yale.BigFix.plist”) else “No Value”) else “No BFProperties”) else (“didn’t work”)
A: True
I’m not sure why QnA isn’t giving the correct error message with the full expression. I was able to reproduce your problem and I will file a bug to find out what’s going on.