• 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
(no subject)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(no subject)


  • Subject: (no subject)
  • From: "Ernie" <email@hidden>
  • Date: Mon, 16 Sep 2002 23:46:32 -0400 (EDT)

Hi,

I am trying to port some AppleScript code that had been working correctly on older versions of the Mac OS to OS X. I do this:

set myfile to choose file with prompt "Select the file...."

I select a file, and it's value is something like:

/Users/ernie/Documents/Folder1/Folder2/thefile.txt

I parse the myfile variable, and replace the "thefile.txt" with "output.txt". I want to make sure there is no output.txt file from a previous run, so I want to delete this file. I have tried a zillion variations on the following:

tell application "Finder"
delete file myfile
end tell

No matter what, I get one of the following errors:

1. "Finder got an error. A descriptor type mismatch occurred. (-10001) 2. "AppleScript Error. File /Users/ernie/Documents/Folder1/Folder2/output.txt wasn't found. (-43)

For the first error, I have no idea what's it's trying to tell me, and I can't find an explanation anywhere. For the second error, I don't understand, because the file *IS* there.

I've tried using:

1. delete file (myfile as alias)
2. delete a reference to file myfile
3. delete ("Macintosh HD" & myfile)

and so many other combinations that I can't even remember them all. I always get one of the above errors. It seems like such a simple thing, but I can't get it to work.

Sorry if this is a dumb question, but how can I make this work so that no matter what file the users selects via "choose file", I can always delete another file in the same folder?

Thanks!

Ernie

------------------------------------------------
Changed your e-mail? Keep your contacts! Use this free e-mail change of address service from Return Path. Register now!
_______________________________________________
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: Mail.app (Sendername/Senderaddress)
  • Next by Date: Re: File-open wierdness in OS X 10.2
  • Previous by thread: Re: (no subject)
  • Next by thread: (no subject)
  • Index(es):
    • Date
    • Thread