RE: Property impermanence
RE: Property impermanence
- Subject: RE: Property impermanence
- From: Joe Kelly <email@hidden>
- Date: Tue, 18 Dec 2001 14:55:29 -0800
There is no native preference handling in AS, outside of properties. For
simple things, you could use "open for access" and "read" and "write". You
find the preference folder with "path to preferences".
If you have lots of preferences, each with sub structures (like complicated
records), you might get brave enough to write out your prefs as xml using
one of the available xml scripting additions.
I default to storing my preferences as key value pairs, and writing those
out in a text file (e.g. H_PIXEL=27). When I load them back up I store them
in a list like this:
{
{theKey:"H_PIXEL", theValue:27},
{theKey:"V_PIXEL", theValue:102},
etc.
}
One of these days I'll sort the list on theKey, enabling me to do a binary
search (faster lookup) instead of a rote iteration, but my number of prefs
is fairly small at this time (< 20).
You might also check around -- someone by now surely has written a scripting
addition that handles preference lists. If not, I'll write one when I have
some free time : )
joe
>
-----Original Message-----
>
From: Harold Bert Martin [mailto:email@hidden]
>
Sent: Tuesday, December 18, 2001 7:53 AM
>
To: email@hidden
>
Subject: Re: Property impermanence
>
>
>
How do I create such a pref file?
>
--
>
Thanks,
>
H. Martin
>
email@hidden
>
>
> From: email@hidden
>
> Reply-To: email@hidden
>
> Date: Thu, 13 Dec 2001 14:25:28 -0800 (PST)
>
> To: email@hidden
>
> Subject: applescript-users digest, Vol 2 #1400 - 16 msgs
>
>
>
> Property impermanence. - Was Re: Bug or Feature?
>
And if you're planning on using AS Studio then you'd better
>
get used to
>
writing prefs out to disk.
>
From the documentation for AppleScript Studio... Regarding
>
properties in AS Studio applications.
>
>
> Script properties are not saved back into the application.
>
Their values
>
> therefore do not persist between launches. If you want persistent
>
> storage of values, write them to a preferences file.
>
>
--
>
Paul Skinner
>
>
>
On Thursday, December 13, 2001, at 12:25 PM, Joe Kelly wrote:
>
>
> Properties get stored in the script file itself. Since I've
>
had problems
>
> with properties remembering themselves, I just save my
>
persistent data
>
> in a
>
> preference file of my own creation.
>
>
>
> joe
>
>
>
>> -----Original Message-----
>
>> From: Gnarlodious [mailto:email@hidden]
>
>> Entity Joe Kelly spoke thus:
>
>>
>
>>> I've noticed that some of my scripts don't remember their
>
>>> properties --
>
>>> usually cutting and pasting the script's text into a new
>
>>> document and saving
>
>>> over the old one does the trick, but not always. I've
>
>>> resorted to saving my
>
>>> script preferences in a preference file.
>
>>
>
>> Are you saying that the variable PropertyName and value is
>
stored in
>
>> "Apple:System Folder:Preferences:AppleScript Preferences" ???
>
>>
>
>> Rachel http://www.gnarlodious.com
>
_______________________________________________
>
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.