• 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: New scripter Q: calling upon a generic file name?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New scripter Q: calling upon a generic file name?


  • Subject: Re: New scripter Q: calling upon a generic file name?
  • From: admin <email@hidden>
  • Date: Fri, 28 Feb 2003 08:32:33 -0600

Ok, I don't know what the error code means, but here is the first thing I would try:

duplicate (((file whose name begins with "Heinz List") of folder whose name[NOBREAK]
begins with "Heinz List") of item drvName) to file "Macintosh HD:Heinz F" with replacing

Specifying file vs item may help, duplicate vs copy may make a difference, and with replacing ensures that if the file already exists that it will be, well, replaced. I didn't test this, since I'd have to make too many changes, but the

duplicate <file(s)> to <file(s)> with replacing

is known to work. Assuming that the file can be found with (((file whose name begins with "Heinz List") of folder whose name begins with "Heinz List") of item drvName) this could work.

HTH,

al

On Friday, February 28, 2003, at 12:00 AM, email@hidden wrote:

Subject: New scripter Q: calling upon a generic file name?
To: email@hidden

Hi:

There is an issue, however minor, that I have with calling upon a recurring
file by a "generic" name. The only difference is that each week the disk's
numbers -- disk, folder and file -- increase by a factor of one.

If one has a CD-ROM with a name that changes only by number from week to
week, but retains its' "first name" I am able to script access to the disk
without problems. However, if I need to access a file within a folder that
possesses the same name there are hang-ups. For example, if I get a disk
named "Heinz 57" I can open the disk by calling upon it as:

tell application "Finder"
activate
set drvName to (name of every disk whose name begins with "Heinz")
open drvName
end tell

But when I need to open/copy a file named "Heinz 57 List" that sits in a
folder named "Heinz 57 List" on the disk named "Heinz 57" I get only a
message stating that "an error of the type 13579 has occurred." No
explanation for this is given. An example of the script I wrote is as follows:

tell application "Finder"
activate
set drvName to (name of every disk whose name begins with "Heinz")
copy (((file whose name begins with "Heinz List") of folder whose name
begins with "Heinz List") of item drvName) to item "Macintosh HD:Heinz F"
end tell

Please note that no matter where I place the parentheses this error code
appears. I'm wondering, first of all, if this error code is legit. Secondly,
can someone explain to me why this is happening, and is there a workaround?
(Mac OS 8.6)
_______________________________________________
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: Script for auto mounting a remote server volume?
  • Next by Date: Re: Property immutability
  • Previous by thread: New scripter Q: calling upon a generic file name?
  • Next by thread: Re: applescript-users digest, Vol 3 #1390 - 13 msgs
  • Index(es):
    • Date
    • Thread