RE: RE: Property impermanence
RE: RE: Property impermanence
- Subject: RE: RE: Property impermanence
- From: Joe Kelly <email@hidden>
- Date: Thu, 20 Dec 2001 11:20:36 -0800
Check out
http://osaxen.com/xml_tools.html
Throw XML Tools 2.3.2 in your scripting additions folder, and you can both
generate and parse xml from and to hierarchies of applescript records.
I see that as a really good way to store complex preferences (such as lists
of lists). I don't do much with xml myself, but that's about to change... my
software build script now has to set the externally generated version within
a bundle's info.plist file.
If you want and if I can find the time, I'll post the skeleton of my
scripting suite... it's pretty lightweight but provides preference
management, plus better trash management.
joe
>
-----Original Message-----
>
From: Harold Bert Martin [mailto:email@hidden]
>
Sent: Thursday, December 20, 2001 9:18 AM
>
To: email@hidden
>
Subject: Re: RE: Property impermanence
>
>
>
joe - I'm proficient in XML and some file writing in AS, but
>
I'm not sure I
>
understand what you mean to import this into AS. I'd really
>
appreciate any
>
examples. Thanks a ton for your help, I really need it!!
>
--
>
Thanks,
>
H. Martin
>
email@hidden
>
>
> From: Joe Kelly <email@hidden>
>
> Date: Tue, 18 Dec 2001 14:55:29 -0800
>
> To: 'Harold Bert Martin' <email@hidden>,
>
> email@hidden
>
> Subject: RE: Property impermanence
>
>
>
>
>
> 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.
>
_______________________________________________
>
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.