• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: applescript and graphics programs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: applescript and graphics programs


  • Subject: Re: applescript and graphics programs
  • From: "Daniel A. Shockley" <email@hidden>
  • Date: Wed, 12 Jun 2002 09:18:28 -0400

Erik,

Take a look at your book for the section about records. It sounds like you're going to be just saving a bunch of data records to a list, and then processing each item from the list in order. If that is the case, what you should use is a list of records that would look something like this:

{{filename:"beaches23.jpg", filepath:"Macintosh HD:Graphics Folder:beaches23.jpg", imageheight:423, imagewidth:650}, {filename:"beaches27.jpg", filepath:"Macintosh HD:Graphics Folder:beaches27.jpg", imageheight:410, imagewidth:634}}

and so on. To add records to the end of a list, you'd do something like:

set newRecord to {filename:"beaches28.jpg", filepath:"Macintosh HD:Graphics Folder:beaches28.jpg", imageheight:379, imagewidth:578}

set mylist's end to newRecord

mylist

--> RETURNS {{filename:"beaches23.jpg", filepath:"Macintosh HD:Graphics Folder:beaches23.jpg", imageheight:423, imagewidth:650}, {filename:"beaches27.jpg", filepath:"Macintosh HD:Graphics Folder:beaches27.jpg", imageheight:410, imagewidth:634}, {filename:"beaches28.jpg", filepath:"Macintosh HD:Graphics Folder:beaches28.jpg", imageheight:379, imagewidth:578}}


Hope that helps with list of records.

Message: 6
Date: Tue, 11 Jun 2002 16:37:36 -0400
Subject: Re: applescript and graphics programs
Cc: email@hidden
To: garbanzito <email@hidden>
From: Erik Price <email@hidden>

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.)

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.

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).

Also, in a limited sense I will be using messages with these objects --
apart from simply storing the file information, I will also be writing
this information to a file. It would be easy to write a method to do
this. But again, the fact that I know nothing of how OO programming in
AS works is probably leading me to think I can do things I can't do. I'm a little more accustomed to OO languages like Java and Python, so
when I read that AS was object oriented, this seemed like a way to go.

--
----
Daniel A. Shockley
email@hidden
email@hidden
http://www.danshockley.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.

  • Follow-Ups:
    • Re: applescript and graphics programs
      • From: Erik Price <email@hidden>
  • Prev by Date: Re: Forcing NetScape 4.7x to load URL to a new window
  • Next by Date: Re: FileMaker Scripting (Text Formatting)
  • Previous by thread: Re: applescript and graphics programs
  • Next by thread: Re: applescript and graphics programs
  • Index(es):
    • Date
    • Thread