• 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: Newbie to Applescript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie to Applescript


  • Subject: Re: Newbie to Applescript
  • From: Mr Tea <email@hidden>
  • Date: Wed, 14 Nov 2001 00:06:06 +0000

This from Chuck Lefebvre - dated 13/11/01 10.45 pm:

> I would like to duplicate an individual file, and it's not stored on the
> desktop. All of the example that I've seen, show you how to copy folder from
> the desktop.

The most compact way of defining the location of a file or folder in
AppleScript is to use a path, with each item separated by a colon and the
whole thing wrapped in double quotes.

So if you have a file called "My File" in a folder called "My Folder" on a
disk called, er, "My Disk" and you want to copy it to a folder called "My
Other Folder" on the same disk, it would look something like this:

tell application "Finder" to duplicate file "My Disk:My Folder:My File" to
folder "My Disk:My Other Folder:"

That should all be on one line, and note that when the final item in the
path is a folder, its name is followed by a colon.

A less economical way to define a path is demonstrated when you use the
Script Editor to record actions in the Finder, with this format:

file "My File" of folder "My Folder" of disk "My Disk"...

HTH

Mr Tea
--
Brew of the day: Breakfast Blend


References: 
 >Newbie to Applescript (From: Chuck Lefebvre <email@hidden>)

  • Prev by Date: Re: using tell with proc. serial numb. in OS X
  • Next by Date: Re: Scripting Palm Desktop
  • Previous by thread: Newbie to Applescript
  • Next by thread: Fwd: Newbie to Applescript
  • Index(es):
    • Date
    • Thread