[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Photoshop AE construction



Howdy,

I've got a little snag in a program I'm porting to MacPerl (from
Applescript) and was hoping that someone in the group might be able to offer
a suggestion.  I've been able to rewrite (and improve) all aspects of the AS
app with the exception of a call to Photoshop.  All I need to do is call a
PS action; the action knows what and where to do things, so there aren't any
variable parameters.  I'm currently getting by with a DoAppleScript call
(which happens in a foreach loop), but this often generates some warnings.
I can hide the errors from the users and the actual output doesn't seem to
be affected at all, but for consistency and overall improvement in the
process, I'd much rather have an AppleEvent call to drive the PS action.

As has been noted on this list in posts of yore, Photoshop is one of the
least scriptable apps, at least on its own.  However, all that's needed is
the PS action, which is something that can be scripted without outside
intervention.  Looking at the aete suite for PS leads me to think that
constructing an AppleEvent call to launch the action should be possible, but
I'm at a loss for some of the parameters needed.  Here's the relevant aete
information:

@SUITE "Photoshop Suite", "", 'misc'
@EVENT "do script", "Play the specified Action.", 'misc', 'dosc'
@REPLY 'null', "", REQ, SINGLE, NOENUM
@DIRECT 'TEXT', "name of Action", REQ, SINGLE, NOENUM, CHANGE

Following the macperlcat example for constructing an AE hash for this, we'd
have something like:
%hash = (
	target	=> '8BIM',
	class	=> 'misc',
	id	=> 'dosc'
	params	=> ["'----':obj {want:..., from:null(), form:...,
seld:TEXT(\@)}", $script_name]
);

I don't think it would be any more complex than that, but as I said, the
parameters are where I get stuck.  The from and seld are probably correct,
but I'm unclear as to the proper values for the want and form.  I've been
experimenting as best I can, but haven't had any success.  (I don't have my
notes with me, but I think I receive a -1700 error.)  It's probably
something quite obvious that I'm overlooking, and I'm be grateful for any
assistance in working out this call.  (I'm afraid that references to
Mac::Glue or AppleEvents::Simple won't be terribly helpful to me; I can't
get those modules to operate on my machine.  That may have to be a post for
another time.)

Thanks in advance for any responses.

James Lloyd
-- just a cog in some corporate machine --



# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org