MACSCRPT Archives

May 2003

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Joe Barwell <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Tue, 27 May 2003 17:18:51 +1300
Content-Type:
text/plain
Parts/Attachments:
text/plain (51 lines)
On Mon, 26 May 2003, Chip Griffin <[log in to unmask]> wrote:

>Seems like we should be able to use the entry in the dictionary as
>follows:
>
>Class item: An item
>Properties:
>        comment  Unicode text  -- the comment of the item, displayed
>in the
>ėGet Infoî window
>
>Thoughts?

Yes, in this and your preceding message on this thread you appear to
be confusing the Finder/desktop db item comment property (displayed
in a get info. window) with a thread that was discussing the embedded
JPEG/JFIF image comment.  They are quite different things.

The following is a snippet I threw together.  It will add a brief
comment to a JPEG/JFIF file (data fork) that does not already have
one.  Note that it does not allow/check for a file that already has a
comment.  It's just an illustration, but seemed to work when I tested
it... once (watch for email line-wraps):

set f to choose file of type {"JPEG", "JFIF"} with prompt "choose a
JPEG to which to add a comment"
set c to text returned of (display dialog "insert comment?:" default
answer "")
set l to length of c
set o to open for access f with write permission
set s to read o from 22
write ((ASCII character 254) & (ASCII character 0) & (ASCII character
(l + 2)) & c & (ASCII character 255) & s) to o starting at 22
close access o

I'd advise using the above only on duplicate files, at least for now.
I seem to be having difficulties figuring out a way to read a
JPEG/JFIF file to check if it already has a comment.  AS seems quite
happy to write ASCII character 255, but has difficulty recognizing it
(i.e. as a delimiter) when reading files.  (Yes, I'm betraying my
computing ignorance.)  Fortunately I'm able to take a break now, for
a wine tasting, but may return to the task later... or not.

Cheers!

Spjtter

Selected from Ambrose Bierce's "Devil's Dictionary":
EULOGY, n. -- Praise of a person who has either the advantages of
wealth and power, or the consideration to be dead.

ATOM RSS1 RSS2