iRemove .DS_Store files 1.0
Deletes the invisible .DS_Store files on all mounted Disks from all folders and application packages. For those of you who want to delete the .DS_Store files quickly without resorting to the Terminal, this AppleScript does the trick. TechTool Pro users can choose to mount the eDrive and clean the .DS_Store files from it. At the end of the run, the eDrive will be unmounted. PPC/Intel
published on Monday, the 7. April 2008, scriptbuilders
10.5: Set Time Machine disk via AppleScript
Like many users of Time Machine, I have a need to back up to different disks at different times. For instance, when my laptop is at home I want to back it up to an external drive for data security, but when I am on the road, I'd like to have it back up to a partition on the internal drive so I can use it as a way to "undo" file changes and quickly access deleted files. This normally requires manually setting the Time Machine preferences every time you want to switch drives. So I put together an AppleScript to do this, and launch it automatically when my external drive is mounted or unmounted (using the free utility Do Something When). The script uses GUI Scripting to set Time Machine to backup to a "primary drive" (the primarydrivena...
published on Wednesday, the 9. January 2008, macosxhints
Permanently delete files via AppleScript
Ever since switching to OS X from Windows, I've missed the convenience of being able to permanently delete files using Shift-Delete. In order to duplicate that functionality, I've written a short AppleScript that will delete the files selected in Finder instead of placing them in the trash. set frontAppPath to (path to frontmost application) as string if the frontAppPath ends with ":Finder.app:" then tell application "Finder" set selectionList to get selection as list set selectedCount to count items in selectionList if selectedCount > 0 then repeat with i from 1 to number of items in the selectionList set selectedItem to item i of the selectionList set selectedName to the name of sele...
published on Thursday, the 29. November 2007, macosxhints
Automatically remove a certain file from a given directory
Many of us have found a profiles.bin file in our home folders. Many think it is created by MS Office for some reason, but nobody knows for sure. Everybody hates it and tries to remove it, to no avail: the file will respawn the next time you open MS Office. The file is completely useless, as far as anybody can tell.I don't suggest a solution to the issue, nor an explanation; just a cool workaround to have that file delete itself every time you open its containing folder. It does so by means of a Folder Action. Folder Actions are pieces of AppleScript code to be executed automatically every time you open or close a folder, or add/remove items to/from it.Here's how to create the one we need. Open Script Editor (in Applications » AppleScript) and type the following script and then click Compile to test for (most) spelling mistakes:on opening folder tell application "Finder" to delete file "profiles.bin" of homeend opening folderSave the...
published on Monday, the 6. August 2007, macosxhints
A set of scripts to erase deleted files based on age
I have always wanted to have the ability to remove files from the trash which were deleted a long time ago. I have just written an AppleScript which renames files and/or folders after they have been put into the Trash to help with this task. Date and time are added to the original filename. So for example, if the file XYZ.txt has been deleted, then the script renames it to _@_YYYYMMDD-HHMMSS_XYZ.txt. This gives me the possibility to sort those files and folder by date and time. I had to put an identification string (_@_) at the beginning because the Repeat loop takes the newly renamed files into account, which produces a never-ending loop. Maybe somebody can find a better solution. I used Folder Actions (implemented on OS X 10.3 and newer) on the Trash folde...
published on Thursday, the 29. March 2007, macosxhints
Clear out missing files in iTunes
I've moved my iTunes library around from machine to machine for about four machines now, and in the process, many files get lost or missing. But iTunes keeps the references to those files around, resulting in the (to me) dreaded circle-exclamation-point icon, and the task of either finding the file or deleting the reference. So I sat down and worked out this AppleScript... tell application "iTunes" set thePlaylist to library playlist 1 set musicFiles to the file tracks of thePlaylist repeat with mf in musicFiles --the name of mf as string set hasLoc to "" if (the location of mf as string ¬ is equal to "missing value") then try set comment of mf to the comment of mf & "" on error number errNum delete mf end try end if end repeat end tell The script goes through the entire library looking for file tracks (stream tracks, for example) and first checks to see if t...
published on Thursday, the 15. March 2007, macosxhints
Make Command-Delete do more with Quicksilver
When an application does not have an uninstall option, I use a simple little (free) application called AppDelete to make sure that related files are removed from my system when I delete an application. But I occasionally forget to do this, because I always use Command-Delete to send things quickly to the trash.Using Quicksilver and AppleScript, I've set it up so that Command-Delete will do the following:Sends applications to AppDelete.Ejects volumes.Sends all other selected files to the trash.Read on for the script and implementation details... Here is the very simple script, which could certainly be improved upon:tell application "Finder" if frontmost then set selected_items to selection repeat with i in selected_items set one_item to i as alias set k to kind of (get info for one_item) if k = "App...
published on Thursday, the 25. January 2007, macosxhints
iTunes transliterate song titles Cyrillic to Latin 1.0
iTunes Applescript: Transliterate Cyrillic Song Titles to Latin This script requires the Cyrillic Additions for OS X available at http://www.applescript.ru/Addi... . For those with limited Russian, the 'Cyrillic AdditionsOSAX' file must be put in the /Library/ScriptingAdditions/ folder (either the system or the users' folder). This script should be placed in the /Library/iTunes/Scripts/ folder to work; it can then be selected from iTunes' script menu. Introduction - Song Title Transliteration Warning: this script will permanently change the song titles for any songs with Cyrillic song titles (it should have no effect on non-Cyrillic titles, but be careful). There is currently no known way to re-transliterate back into Russian. 1) Why would you do this I have no idea why you would do this, I can only tell you why I needed to do it. In my case, my Squeezebox would not play songs with Cyrillic titles (something to do with 16-bit unicode filenames). Other solutions were not attractive or feasible. In the end, the music is what counts, and I was willing to live with the imperfect solution of having readable, playable, latinized song titles. Perhaps other people will have some reason to do the same thing. 2) Can you control the transliteration preferences No. This file is reliant on the Cyrillic Additions, and I don't know how to modify it. If you can figure out how to hack that, all the more power to you. 3) Any other important notes on using the script -I had occasional problems if the order selection was 'down' rather than 'up'. By this I mean, in iTunes whichever column you have used to order your view should have its arrow pointing up. -The script will beep after every song title is transliterated to prove that it hasn't choked. The speed will vary depending on how quickly iTunes can save the info. If the beeping drives you crazy, turn your sound off or delete that line from the script. -The letters transcribed may not be perfect. That said, it's better than translating several hundred song titles by hand. 4) Can you use it to transliterate album names, artist names, text files, family names, computer files, etc., etc Not in the current form; I didn't need to do that. That said, this script is based on someone else's script (Doug Adams of Dougscripts.com), and I encourage you to shamelessly adapt this script, or borrow its working parts and create your own Frankenscripts. The transliteration vocabulary provided is relatively simple. 5) Any help available Not really. I don't really know what I'm doing, so asking questions at the usual sites would probably be more effective.
published on Thursday, the 14. December 2006, scriptbuilders
An AppleScript to create a size-limited trash can
As a recent Mac convert, I want a trash can I don't have to remember to empty. I searched high and low for a utility to mimick Windows' Recycle Bin, where a maximum limit can be set on the size of the bin, and the least recently trashed files are deleted to keep the bin under the limit. I found Compost, but it costs money :). So I wrote my very first AppleScript instead, which suits me fine. With this script added as a Folder Action on the user's ~/.Trash folder, trashed items' modification dates are updated to the time of trashination. Then the script checks if the total size of the Trash folder is under a certain limit, and if it's not, it starts deleting items until the trash is under the limit. This only works for the Trash folder in your home folder -- if ...
published on Tuesday, the 7. November 2006, macosxhints
Rotate Movie Right 1.1b
**This script is BETA, and has not had extensive testing. It is a modified version of Rotate Movie Right 1.0 to work with QT Pro 7. It now uses a dialogue box to allow the user to choose the target folder.** This script/applet will modify quicktime files by rotating them to the right (clockwise). To use, simply drop files or folders with quicktime (or other source types) onto the applet. A new quicktime file, with the same name but with the .mov file type, will be created. The original file is not deleted. This is intended primarily for use by digital camera owners, like me, who record movies vertically and forget that the camera is not intended to be operated like that. (I hope there are others who also make this mistake). Requires Quicktime Pro. Script written on basis of one of the Applescript example files. Version 1.1b, August 31, 2005. Provided free of charge but with no support or guarantees of any kind. USE AT OWN RISK. BACK UP YOUR FILES FIRST. Provided by Greg Alton (galton@mac.com). I would say 'written by' but there are only about two lines of 'new' code here, and a few tiny modifications - another testament to how simple Applescript is. Hence, this script can be freely used and modified. For those interested, the only important part of this script is the following line of code: rotate right track 'Video Track' of movie 1. By changing left to right in the appropriate place, one would have a script that would rotate a movie left (counterclockwise). I have not done so as I have no need for that. I consistently record movies by holding my camera in a certain way. Enjoy, and I hope this is useful.
published on Thursday, the 31. August 2006, scriptbuilders