Welcome to MacForumz.com!
FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log in/Register/PasswordLog in/Register/Password

Get Finder path name

 
   Macintosh computer (Home) -> Apple Scripts RSS
Related Topics:
path to application - Is there a simple technique in to get the path to an even when it is not running? If I do set the_app to (path to as string set to POSIX path of the_app it launches Bogus in..

getting path of parent directory - Does anyone have a very fast formula to obtain the path of the directory from a reference to a file or sub dir? e.g. in a folder action script: on adding folder items to set to the container of -- John

Variable for Documents path ? - Hello, Is there a system variable for to point to the current user document folder ? I mean : How to write the follong lines in a portable way : tell set to folder..

[newbie Q] how to get the path of the folder of a file? - This is an simple question that I cannot solve :-( Say I've got a path to a file: How do I then get the path of the folder that contains that file? That is, how do I get:..

Need contextual menu to see path of an item - Hi What do I need do to create an AS that shows me the exact path of an item and copies it to the when you highlight an item in the folder and then trigger the script via left mouse button menu) Thank you very much ..
Next:  Apple Scripts: automating Print Center  
Author Message
John B.

External


Since: Aug 22, 2003
Posts: 47



(Msg. 1) Posted: Sun Jun 13, 2004 2:20 am
Post subject: Get Finder path name
Archived from groups: alt>comp>lang>applescript (more info?)

Is there was way to get the path of a selected file or folder and store it
to the clipboard.

Pseudo code:

tell application "Finder"
set thePathName to the path of the selected item
end tell

set the clipboard to thepathName

 >> Stay informed about: Get Finder path name 
Back to top
Login to vote
Mark Schonewille3

External


Since: Jun 20, 2004
Posts: 40



(Msg. 2) Posted: Sun Jun 13, 2004 4:00 pm
Post subject: Re: Get Finder path name [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

John,

In MacOS 9:

tell application "Finder"
activate
set the clipboard to the selection as text
end tell

I guess it is the same in MacoS X?

Best,

Mark

John B. wrote:
 > Is there was way to get the path of a selected file or folder and store it
 > to the clipboard.
 >
 > Pseudo code:
 >
 > tell application "Finder"
 > set thePathName to the path of the selected item
 > end tell
 >
 > set the clipboard to thepathName
 >

--

eHUG coordinator
<a style='text-decoration: underline;' href="http://home.wandoo.nl/mark.sch" target="_blank">http://home.wandoo.nl/mark.sch</a>
<a style='text-decoration: underline;' href="http://www.ehug.info" target="_blank">http://www.ehug.info</a><!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: Get Finder path name 
Back to top
Login to vote
John B.

External


Since: Aug 22, 2003
Posts: 47



(Msg. 3) Posted: Sun Jun 13, 2004 5:38 pm
Post subject: Re: Get Finder path name -- side effect [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thanks Mark,

Works perfectly -- even when I have a file or folder selected in Find File!

A couple of problems though.

I installed the script in

Macintosh HD:Users:myUserName:Library:Scripts -- (see it works!)

.... so it's available in the Finder menu bar.


But when I run the script sometimes it opens folder containing the script,
bringing it the front of the Finder.

??? What causes that side effect?

Another problem: Aliases don't work with AppleScript's Library: Scripts
folder?

I want to keep a folder of my scripts in my documents area, rather than
storing them in the system folders! But I'm not having good luck with
aliases and the Scripts folder.

I copied an alias of the script to the Scripts folder It appears in the menu
-- and when I run it, it flashes the finder item -- but the clipboard is
empty. When put the original back in Scrips it works fine!

Similarly I placed an alias of my scrips folder into the Library: Scripts
folder. But the foldfer doesn't show in the menu.

If I move my original scripts folder into Library: Scripts everything
appears in the menu.

System 10.2.8

John

 > John,
 >
 > In MacOS 9:
 >
 > tell application "Finder"
 > activate
 > set the clipboard to the selection as text
 > end tell
 >
 > I guess it is the same in MacoS X?
 >
 > Best,
 >
 > Mark
 >
 > John B. wrote:
  >> Is there was way to get the path of a selected file or folder and store it
  >> to the clipboard.
  >>
  >> Pseudo code:
  >>
  >> tell application "Finder"
  >> set thePathName to the path of the selected item
  >> end tell
  >>
  >> set the clipboard to thepathName
  >><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Get Finder path name 
Back to top
Login to vote
Mark Schonewille3

External


Since: Jun 20, 2004
Posts: 40



(Msg. 4) Posted: Wed Jun 16, 2004 8:31 pm
Post subject: Re: Get Finder path name -- side effect [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi John,

Since I am a MacOS 9 user, I cannot figure out what causes your
problem, but you might check that there is a selection in the
Finder. I can imagine that the Finder gets confused if no file
is selected.

I don't know what's wrong with aliases. In MacOS 9, I can put
aliases in the Apple menu folder and they work fine. I expect
something similar to be possible in MacOS X.

Mark


John B. wrote:
 > Thanks Mark,
 >
 > Works perfectly -- even when I have a file or folder selected in Find File!
 >
 > A couple of problems though.
 >
 > I installed the script in
 >
 > Macintosh HD:Users:myUserName:Library:Scripts -- (see it works!)
 >
 > ... so it's available in the Finder menu bar.
 >
 >
 > But when I run the script sometimes it opens folder containing the script,
 > bringing it the front of the Finder.
 >
 > ??? What causes that side effect?
 >
 > Another problem: Aliases don't work with AppleScript's Library: Scripts
 > folder?
 >
 > I want to keep a folder of my scripts in my documents area, rather than
 > storing them in the system folders! But I'm not having good luck with
 > aliases and the Scripts folder.
 >
 > I copied an alias of the script to the Scripts folder It appears in the menu
 > -- and when I run it, it flashes the finder item -- but the clipboard is
 > empty. When put the original back in Scrips it works fine!
 >
 > Similarly I placed an alias of my scrips folder into the Library: Scripts
 > folder. But the foldfer doesn't show in the menu.
 >
 > If I move my original scripts folder into Library: Scripts everything
 > appears in the menu.
 >
 > System 10.2.8
 >
 > John

--

eHUG coordinator
<a style='text-decoration: underline;' href="http://home.wandoo.nl/mark.sch" target="_blank">http://home.wandoo.nl/mark.sch</a>
<a style='text-decoration: underline;' href="http://www.ehug.info" target="_blank">http://www.ehug.info</a><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Get Finder path name 
Back to top
Login to vote
Display posts from previous:   
   Macintosh computer (Home) -> Apple Scripts All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]