Command Line & Paths Question

Ken Ray kray at sonsothunder.com
Thu Feb 9 14:47:25 EST 2006


On 2/9/06 12:19 PM, "Garrett Hylltun" <garrett at paraboliclogic.com> wrote:

> 1.  On OSX, if I ask Finder to open a text file with another app, and
> then select my resulting compiled .app, there is nothing in 1$ at
> all.  And I can't drag and drop a text file on my .app.  But on
> Windows 1$ does contain the path and file name.
> 
> Q:  Am I doing something wrong?  Better yet, is there something
> special I need to do in order to get my .app to accept command line
> parameters?

You're not doing anything wrong - the $1 parameters are a Windows-only
thing; for Macintosh you get Apple Events whenever a document is opened by
an app. Put this in your standalone's stack script:

on appleEvent pClass,pID
  switch (pClass&pID)
  case "aevtodoc"
    request appleEvent data
    -- "it" now contains the path to the document so you can
    -- do something like:
    open stack it
    break
  pass appleEvent
end appleEvent


> Q:  Is there something special I need to do in order to allow my .app
> to be able to accept droped files on it in Finder and on the Dock?

Sorry, don't know this one...
 
> 2.  In Windows, the command line param is showing up, but it's
> coughing up the old 8.3 file naming.
> 
> Q:  Is this a issue with Windows and how command line data is sent,
> such as if it's in quotes, rock on, but if not, it's rock pounding in
> the stone age?

Good question - did you try putting quotes around the path to the document
file? If not, then it sounds like an OS thing. But you should be able to use
the longFilePath() function to get the long file name if you're only getting
8.3 naming.

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list