• 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: Importing to Excel and Finding a Path
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: Scripting copy and paste commands in FileMaker
  • Next by Date: Re: Scripting copy and paste commands in FileMaker
  • Previous by thread: Re: Mixing Apple Script, Excel and a network
  • Next by thread: Extract Folder Name from Full Path
  • Index(es):
    • Date
    • Thread