 |
 |
Need some Applescript Help
|
 |
|
 |
|
Addicted to MacNN
Join Date: Oct 1999
Location: The Tollbooth Capital of the US
Status:
Offline
|
|
I'm not sure how to move a specific folder or items in a specific folder to the trash using applescript.
|
|
"Evil is Powerless If the Good are Unafraid." -Ronald Reagan
Apple and Intel, the dawning of a NEW era.
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Oct 2000
Location: Midwest
Status:
Offline
|
|
This will move items in a selected folder to the Trash (delete), then empty the Trash.
Code:
tell application "Finder"
activate
set theItems to selection
if theItems is {} then set theItems to {target of front window}
repeat with theItem in theItems
if class of theItem is folder then delete every item in theItem
end repeat
empty trash
end tell
HTH
Craig
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Oct 1999
Location: The Tollbooth Capital of the US
Status:
Offline
|
|
Originally posted by suthercd:
This will move items in a selected folder to the Trash (delete), then empty the Trash.
Code:
tell application "Finder"
activate
set theItems to selection
if theItems is {} then set theItems to {target of front window}
repeat with theItem in theItems
if class of theItem is folder then delete every item in theItem
end repeat
empty trash
end tell
HTH
Craig
Great thanks. Question. So all I need to do is put the selected folder I want moved and deleted in the {}?
|
|
"Evil is Powerless If the Good are Unafraid." -Ronald Reagan
Apple and Intel, the dawning of a NEW era.
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Oct 2000
Location: Midwest
Status:
Offline
|
|
The first script assumes you have a folder selected before running the script. To have another way to select the folder targeted, you could modify the first four lines so you are presented with a Navigation Window from which you can slect the folder on which you want to act. Here it is:
Code:
set theFolder to choose folder as alias
tell application "Finder"
activate
set theItems to theFolder
repeat with theItem in theItems
if class of theItem is folder then delete every item in theItem
end repeat
empty trash
end tell
C-
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |