Re: Simply deleting a fil
Re: Simply deleting a fil
- Subject: Re: Simply deleting a fil
- From: Yvan KOENIG <email@hidden>
- Date: Fri, 17 Apr 2009 18:35:17 +0200
Le 17 avr. 2009 à 17:50, Luther Fuller a écrit :
On Apr 17, 2009, at 8:53 AM, Michelle Steiner wrote:
On Apr 17, 2009, at 2:04 AM, Tim Mansour wrote:
Why bother with POSIX paths? Why not just:
tell application "Finder" to delete alias ((path to documents folder
as text) & "__MACOSX")
That's what I was thinking. Or use System Events instead of
Finder. Using Finder puts the file into the trash; using System
Events deletes the file completely.
Interesting ... so I tried it. But, I found that System Events
works just like Finder.
The following script ...
path to desktop
tell application "Finder"
set folderAlias to (make new folder at the result)
end tell
delay 1
tell application "System Events"
delete folderAlias
end tell
simply puts the folder "untitled folder" into the trash.
Also, you may wonder why I told Finder to 'make new folder ...'
instead of System Events.
The 'make new ...' command in System Events seems to be broken.
It's because you are not working with the correct syntax and correct
items.
set p2d to path to desktop as text
tell application "System Events"
make new folder at end of folder p2d with properties
{name:"LutherFuller"}
set txtName to "YvanKoenig.txt"
make new file at end of folder p2d with properties {name:txtName}
display alert "look at your desktop then click a button"
delete disk item (p2d & txtName)
display alert "now, look in the trash if you find the file named “"
& txtName & "”"
end tell
You may check that I am polite, I delete YvanKoenig, not
LutherFuller ;-)
Yvan KOENIG (from FRANCE vendredi 17 avril 2009 18:35:14) _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden