Re: applescript and graphics programs
Re: applescript and graphics programs
- Subject: Re: applescript and graphics programs
- From: email@hidden (Michael Sullivan)
- Date: Wed, 12 Jun 2002 13:43:44 -0400
- Organization: Society for the Incurably Pompous
>
On Tuesday, June 11, 2002, at 03:49 PM, garbanzito wrote:
>
> at 2002 06 11, 09:25 -0400, they whom i call Erik Price wrote:
>
>> 1. read all files in a folder into an array of new "GraphicFile"
>
>> objects
>
>> 2. for each object, determine the app to use from the creator code
>
>> (or my own hash key system, though unsure yet if AS has this
>
>> ability)
>
>> and set as an attribute of the object somehow
>
>> [...]How does this sound? Feasible? I don't know how to create
>
>> objects in AppleScript but I am armed with "AppleScript in a
>
>> Nutshell", curiosity, and a helpful mailing list. If I am going about
>
>> this the wrong (or even the right) way, please feel free to comment on
>
>> my approach!
>
> unless you need your GraphicFile objects to respond to
>
> messages, i would not bother with objects, but instead
>
> create a list of records. there are no arrays in
>
> AppleScript. determining AppToUse is a simple test. from
>
> your description, you'd simply default to GraphicConverter
>
> unless a file has an XPress creator code. a hash table would
>
> be overkill, and is not a native data structure. (a few
>
> people have fooled around with creating hash tables; search
>
> the archives if you really want to use one.)
That was actually macscrpt, IIRC. At least my recent attempt.
Well, I guess a number of folks have done this with osaxen before that.
>
Well, I don't really need a hash table -- if AS supported it then I
>
would use it, but it's not like I need that kind of functionality. And
>
if I were a more experienced scripter I might try it for pedagogical
>
reasons, but at this time I just need to find a solution.
I actually created a hash table in vanilla AS that works fine, but it
doesn't outpace a simple associative array implementation until you need
1000 entries or so. RealSoonNow[tm], I'll be cleaning up a few things
and putting it on Applemods. I don't expect it to be all that useful
though. For small data, plain old double list or string based methods
are faster (see Arthur's AssociativeLib or has's AssociativeArrayLib),
and for really big data, a scriptable database starts to make more
sense.
>
However, it seemed to me that going with objects would be a great way to
>
store information about these files, since there are several different
>
attributes of each file that I need to store and eventually write to the
>
file. If AS supports multidimensional lists (is there such a thing?
>
I'm thinking of an AS analogue to multidimensional arrays), there's no
>
reason I couldn't use those too: one list of lists, each secondary list
>
containing the file information (name, size, etc).
lists of lists work just fine, though at some deep recursion level you
might run in to stack overflow problems.
Michael
--
Michael Sullivan
Business Card Express of CT Thermographers to the Trade
Cheshire, CT email@hidden
_______________________________________________
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.