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

Re: [MacPerl] Open and open terms in MacPerl



At 08:12 1999-03-23 -0500, Paul J. Schinder wrote:
>On Tue, Mar 23, 1999 at 09:03:23AM +0000, Peter Westlake wrote:
>} Why does the AppleScript dictionary of MacPerl have
>} an "Open" in the Required suite, and an "open" in the
>} core suite? I've been having a lot of trouble with
>} AppleScript, and I wondered if this might be relevant.
>
>It's very hard to say, since you don't tell us what you're doing.
>However, the presence of two opens in the directory is unlikely to be
>the problem.  That I've seen before in other apps.  I don't think
>AppleScript is case sensitive, so they probably do the same thing.
>
>If you're having problems with AppleScript, it's likely to be
>AppleScript's fault.  What kind of problems?  My general advice is
>always to do as little as possible using AppleScript.  You're much
>better off if you can find a all MacPerl solution.

This is the same problem that I posted about a little while ago.
I have a source control program which is actually MacPerl 5.1.3r2
with an embedded script, which either puts up a window for interaction
or goes off and does something by itself depending on how it is
invoked. If a file is dropped onto the app, Perl puts the filename
into @ARGV and the script detects this and runs in batch mode. If
there isn't anything in @ARGV, it runs interactively. It works if
I drop a file onto the app's icon, and it works if I use MPW to
invoke the app by its path, with the filename as a parameter. But
life would be much simpler for me if I could just call this app
from a Perl script. MacPerl doesn't have system(), so I'm trying
to use AppleScript to call the app, using "launch" and "open file".
This is in a Perl script running in MacPerl 5.2.0r4, just to confuse
matters. Now, sometimes it works, but sometimes the app puts up its
interactive window, as if it hadn't been given a file to open.

Let's just check that I understand how all this is meant to work,
since I've never written a Mac program in my life! I gather that
dragging a file onto an application is implemented by the Finder
starting the application and sending it an 'odoc' AppleEvent.
If so, then I wonder if this could be a timing problem, with the
app sometimes getting to the ARGV code before the AppleEvent has
come in and set up @ARGV? But then how do MPW and the Finder manage
to get it right?

Peter.




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