Re: Properties and Address Book Plug-Ins
Re: Properties and Address Book Plug-Ins
- Subject: Re: Properties and Address Book Plug-Ins
- From: Axel Luttgens <email@hidden>
- Date: Wed, 30 May 2012 23:22:23 +0200
Le 30 mai 2012 à 18:21, Christian Boyce a écrit :
> Howdy. I've made a plug-in for Address Book that gives directions to whichever address is clicked on.
> [...]
> So, the property works the way I want it to until Address Book is quit and re-launched. That's what it boils down to. Is there a way to make the property survive across relaunches? I'd appreciate any help on this. This is my first time with Properties and maybe I'm doing something wrong. Thanks a lot.
> [...]
Hello Christian,
When running a script within such a context (an Address Book plugin), one doesn't benefit of the usual "run-time machinery", the one that cares of storing the value of properties and other global entities back into the script file.
IIRC, the same holds for folder actions scripts.
There are possibly other ways, but you could consider something along the following lines to store and read persistent values:
on ReadStartingPoint()
try
return do shell script "defaults read com.christianboyce.mapdirection the_starting_point"
on error
return ""
end try
end ReadStartingPoint
on WriteStartingPoint(startingpoint)
do shell script "defaults write com.christianboyce.mapdirection the_starting_point " & quoted form of startingpoint
end WriteStartingPoint
This will read (and create if needed) file ~/Library/Preferences/com.christianboyce.mapdirection.plist.
It should then be possible to replace statements such as
if the_starting_point is "" then
by
if ReadStartingPoint() is "" then
and
set the_starting_point to clean_it_up(the_starting_point)
by
WriteStartingPoint(clean_it_up(the_starting_point))
HTH,
Axel
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden