• 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: Path to app ...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Path to app ...


  • Subject: Re: Path to app ...
  • From: Christopher Nebel <email@hidden>
  • Date: Mon, 3 Dec 2001 21:01:43 -0800

On Monday, December 3, 2001, at 02:04 PM, Eric Schult wrote:

Can anybody explain to my why the following applet returns its path:

set myPath to ":" as alias
display dialog "You are in path:" default answer myPath

It's the magic of relative paths. Any path starting with a colon is considered to be relative to the current working directory. (Just a simple name -- no colons at all -- is also considered to be relative.) Since all you've got is the colon, you get the working directory itself, which in traditional Mac OS is normally the folder containing the application. (An application can change this any time it wants to, but very few do.)

The problem with this is that the default working directory isn't guaranteed to be anything in particular, and is in fact different in Mac OS X -- it's always the root of the file system. Using "path to me" much more reliable.

.. and further, how you accomplish the same feat with the front-most
application, or the front-most document of an application?

"path to" has a special selector "frontmost application", so you can just say "path to [the] frontmost application", and there you are. There isn't any general way to get the path of the frontmost document, because not all applications reveal the file associated with a document window. Consult the dictionary of your favorite application.


--Chris Nebel
AppleScript Engineering


  • Follow-Ups:
    • Window basics...
      • From: "Domains4Days.com" <email@hidden>
    • Re: Path to app ...
      • From: Paul Berkowitz <email@hidden>
References: 
 >Path to app ... (From: Eric Schult <email@hidden>)

  • Prev by Date: Alert on new FileMaker Record creation
  • Next by Date: Re: How do I change path punctuation?
  • Previous by thread: Re: <<event FNDRsope>> (WAS Re: Path to app ...)
  • Next by thread: Re: Path to app ...
  • Index(es):
    • Date
    • Thread