• 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: get path of selected file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: get path of selected file


  • Subject: Re: get path of selected file
  • From: Paul Berkowitz <email@hidden>
  • Date: Wed, 03 Apr 2002 12:50:30 -0800

On 4/3/02 12:27 PM, "Matt Binkowski" <email@hidden> wrote:

> i used to have a handly little script that could retrieve the path of any
> selected file or folder but I seem to have lost it in the transition to os
> X...and to make matters worse, i cannot seem to remember how to write it
> again. i want to run the script from the script menu (like osa menu in 9) on
> a file that is selected in the finder. can anyone please help? even just
> hints on the syntax?


try
tell application "Finder" to set pathToFile to (item 1 of (get
selection)) as alias as string

on error
beep
display dialog "There's nothing selected in the Finder." buttons {"OK"}
default button 1 with icon 2
return
end try

-- display dialog pathToFile

----

You can display it in a dialog or do whatever you want with it. I have a
script set up in Script Debugger's script menu to type it into any script
I'm writing where the cursor is. You can do exactly the same thing in Smile.

--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: get path of selected file
      • From: Camilla <email@hidden>
    • Re: get path of selected file
      • From: Matt Binkowski <email@hidden>
    • Re: get path of selected file
      • From: Matt Binkowski <email@hidden>
References: 
 >get path of selected file (From: Matt Binkowski <email@hidden>)

  • Prev by Date: get path of selected file
  • Next by Date: Re: get path of selected file
  • Previous by thread: get path of selected file
  • Next by thread: Re: get path of selected file
  • Index(es):
    • Date
    • Thread