Re: Using Property List Tools and Variables
Re: Using Property List Tools and Variables
- Subject: Re: Using Property List Tools and Variables
- From: Walter Ian Kaye <email@hidden>
- Date: Tue, 20 Jul 2004 23:48:27 -0700
At 05:56p -0700 07/20/2004, SK didst inscribe upon an electronic papyrus:
I am running Panther and a copy of the .plist is at the bottom of
this message. If I run:
set vSystemValue to |System Sleep Timer| of |AC Power| of vPlist
instead of
set vSystemValue to |System Sleep Timer| of |vEnergyProfile| of vPlist
or
set vSystemValue to |System Sleep Timer| of vEnergyProfile of vPlist
it works fine. But I get the name of the Energy Profile from a popup
list I have constructed, so the user can pick the profile they are
using and I need to use a variable.
OK, you may need to use a construction like this:
if vEnergyProfile is "AC Power" then
set vSystemValue to |System Sleep Timer| of |AC Power| of vPlist
else if vEnergyProfile is "Battery Power" then
set vSystemValue to |System Sleep Timer| of |Battery Power| of vPlist
else
--unknown or unsupported profile
end if
...because there is no coercion between strings and variable names.
Er, well, not without using 'run script' (a speed hit) anyway.
-Walter
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.