Skip to content

Instantly share code, notes, and snippets.

@nerdEd
Created August 24, 2010 15:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nerdEd/547738 to your computer and use it in GitHub Desktop.
Save nerdEd/547738 to your computer and use it in GitHub Desktop.
(*
MODIFIED VERSION OF THIS SCRIPT TO REMOVE CONFIRMATIONS
Original Script: http://dougscripts.com/itunes/scripts/ss.php?sp=whackcurrenttrack
"Whack Current Track" for iTunes
written by Doug Adams
dougadams@mac.com
v1.5 nov 13, 2006
-- generally updated for modern iTunes
v1.0 may 23, '04
-- initial release (Actually, this was released probably as early as 2001, first as a SoundJam AppleScript, and then later modified for iTunes.)
Get more free AppleScripts and info on writing your own
at Doug's AppleScripts for iTunes
http://www.dougscripts.com/itunes/
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Get a copy of the GNU General Public License by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
or visit http://www.gnu.org/copyleft/gpl.html
*)
tell application "iTunes"
if player state is not stopped then
set ofi to fixed indexing
set fixed indexing to true
try
set dbid to database ID of current track
set cla to class of current track
try
set floc to (get location of current track)
end try
try
delete (some track of library playlist 1 whose database ID is dbid)
end try
if cla is file track then
my delete_the_file(floc)
end if
end try
set fixed indexing to ofi
end if
end tell
to delete_the_file(floc)
try
do shell script "mv " & quoted form of POSIX path of (floc as string) & " " & quoted form of POSIX path of (path to trash as string)
end try
end delete_the_file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment