Re: Importing to Excel and Finding a Path
Re: Importing to Excel and Finding a Path
- Subject: Re: Importing to Excel and Finding a Path
- From: kai <email@hidden>
- Date: Fri, 15 Aug 2003 23:12:04 +0100
on Thu, 14 Aug 2003 22:51:30 +0100, John Delacour wrote:
>
At 4:19 pm -0500 14/8/03, Courtney Moore wrote:
>
>
>I know that there is an applescript you can use to get a
>
>path of a file but I can't seem to find where I put the article. Are you
>
>familiar with how to script finding a path?
>
>
In Excel
>
>
tell application "Microsoft Excel"
>
Path of Workbook 1
>
end tell
>
>
gives you a Mac path string.
For a more general method, simply use 'choose file' or 'choose folder' and
coerce the resulting alias to a string:
-----------------------
(choose file) as string
-----------------------
The following example copies the result to the clipboard, ready to paste:
-------------------------------------------------------
(Any wrapped lines abutting the left edge of the window
should be reconnected to the end of the previous line)
-------------------------------------------------------
--=====================
property itm : "File"
to chooseItem()
set p to "Choose a f" & itm's text 2 thru -1 & " whose path you wish
to copy"
if itm is "File" then return choose file with prompt p
choose folder with prompt p
end chooseItem
set itm to (display dialog "Copy the path of a file or a folder?"
buttons {"Cancel", "File", "Folder"} default button itm with icon 1)'s
button returned
set the clipboard to "\"" & chooseItem() & "\""
--=====================
---
kai
_______________________________________________
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.