image ResEx Logo
App Makeovers
Boot Images
Boot Panels
Cell Phone Themes
Clocks
Desktop Pictures
Desktop Snapshots
Dock Poofs
Growl Styles
Icons
iTunes Skins
Links List
Login Panels
Mac OS X Mods
Mac OS X Themes
Mighty Mouse Cursors
Photoshop Goodies
REALbasic
Safari Stuff
Screen Savers
Software Archive
Software Reviews
Splash Screens
System Level Icons
Unix & The Terminal
Uploads
Users Forum
Widgets & Widgets

Homepage



Finder Scripts
These are scripts for icon positioning, application switching, and Finder control.

Contents:
Delete Temporary Items
Open an application's folder
Arrange Icons Method #1
Arrange Icons Method #2
Quit Processes script
Control the Application Switcher
Toggle the App Switcher's visibility
Modify Finder Preferences
Add Trash Can to App Switcher
Hide Drives and Folders on the Classic Desktop


Want to simulate the bare desktop of MacOS X when booted into Classic? These Applescripts by Edward O'Rourke willl do it for you! the first one, X-Drives, tricks the Finder into hidding the mounted drives and trash by moving them to location -2000!

But what about any folders and files on the desktop? The second script, Desktop Cleanup will select ALL files and FOLDERS on the desktop and move them to a dated folder inside a folder named Desktop Archives inside the Startup Drive.

Once the items are hidden, use your favorite desktop dock to launch and open files and folders.

Download and stick both of these in the Startup Items folder and restart to see the effect. Want your drves back where they belong? Select Clean Up from the Finder View menu.

Vic Wertz sent this Applescript for the Temporary Items Folder.

I massively modified the script by Rams, originally posted on 1/26, so that it moves items from Temporary Items directly into the Trash. If you save this as an app and place it in the Startup or Shutdown Items folder, you need not ever worry about the Temporary Items folder again.

    set x to "Macintosh HD:Temporary Items:"
    -- Change "Macintosh HD" to match the name of your startup disk.
    tell application "Finder"
    if (count of (list folder x)) < 1 then return
    repeat with i in list folder x
    move alias (x & i) to trash
    end repeat
    end tell

This handy Applescript by John Crossley will open the folder containing the frontmost application.

    tell application "Finder"
    set currentApps to every process whose frontmost is true
    -- This list will be empty if Finder is frontmost
    if (count of currentApps) > 0 then
    reveal file of item 1 of currentApps
    activate -- Finder
    end if
    end tell

I wrote this because I was testing a beta version of a favorite program. I wasn't sure, however, if the copy in memory was launched from the beta or the previous release. So this script tells the finder to reveal the application file of the frontmost application.

Richard submitted a script that allows you to reposition icons on the desktop/in windows for MacOS 9 without having to turn "Snap to Grid" off, as was previously thought necessary.

tell application "Finder"
set theItem to a reference to trash

try
-- use position to get a desktop item's position
set {x1, y1} to theItem's position

-- set the position with bounds,
-- adding 2 dummy coordinates to the position value
set theItem's bounds to {x1, y1, 0, 0}

-- don't base the position on bounds,
-- it's value is off by one horizontal pixel
-- to correct it, add 1 to the x value, eg, {x2 + 1, y2}
set {x2, y2} to theItem's bounds
set theItem's bounds to {x2 + 1, y2, 0, 0}

-- demonstration of bounds bug (or animation made simple):
repeat 16 times
set theItem's bounds to theItem's bounds
end repeat

delay 1 -- let it sink in
-- restore the icon's former position, er, bounds, whatever
set theItem's bounds to {x1, y1, 0, 0}


-- these are errors one might get when doing it the wrong way

-- set theItem's position to {x1, y1}
-- Error -15274: This window is the wrong kind (e.g. pop-up vs.
normal)
-- to use this command

-- set theItem's bounds to {x1, y1}
-- Error -1700: Finder got an error: Can't make some data into
the expected type.

on error errTxt number errNum
log "Error " & errNum & ": " & errTxt
end try
return theItem's position
end tell

Brady Winchell submitted an alternate method of arranging icons that switches the "snap to grid" option off and back on.

tell application "Finder"
activate
set spatial view arrangement of desktop to not arranged
select startup disk
set position of selection to {736, 28}
set spatial view arrangement of desktop to snap to grid
end tell

Here's an AppleScript by Michael Askew that demonstates a lot of simple coding techniques. This script will quit all applications, except hidden processes, the Finder, and any programs in the "Excluded" list:

property excludedApps : {"VersaTile Pro"}

--The Finder and background processes are
--not affected because their file

type is not APPL

tell application "Finder"
set theProcs to every process whose (file type is "APPL" and name is not in excludedApps)
end tell

repeat with x in theProcs
set appName to name of x
tell application appName to quit
end repeat

Victor Nystad submitted a few more simple AppleScript examples to demonstate control of the Application Switcher.

on run
tell application "Application Switcher"
set visible of palette to true
set orientation of palette to vertical
set button ordering of palette to alphabetical
set frame visible of palette to true
set names visible of palette to true
set position of palette to upper right
set icon size of palette to small
end tell
end run

on run
tell application "Application Switcher"
set visible of palette to true
set orientation of palette to horizontal
set button ordering of palette to reverse launch order
set frame visible of palette to false
set names visible of palette to false
set position of palette to lower right
set icon size of palette to small
end tell
end run

You can find all the applicable commands by using the Script Editor to open the dictionary of the Application Switcher' extension.

I have customized this script and stuck a copy in my Apple Menu and Startup Folder to keep that panel how I want it! Often after playing a game that switches the monitor resoulution, the Application pallete is in a wacky part of the screen in a funky configuration.

José Benitez from Italy sent this nifty Applescript to toggle the visibility of the Application Switcher.

    -- hide & show Application Picker on fly
    on run
    tell application "Application Picker"
    if visible of palette is false then
    set visible of palette to true
    else if visible of palette is true then
    set visible of palette to false
    end if
    end tell
    end run

You can use it with OSA Menu (place it in Universal Scripts folder) or as an Application (in Apple Menu)

Larry wrote two Applescripts for ResEx readers. The first will delete your Finder preferences & reboot your computer.

The second script will open the Finder preferences & set them to what is showing below; if you prefer something else change the "true" to "false" . If you would prefer NOT to have the preference window open, then delete the line "open Finder preferences" & "close window of Finder preferences" .

Long time contributor Donald Tipton sent this surprisingly simple Applescript for you to download, that does something way-cool. It adds a Trash icon to the Application Switcher. Drag an icon on to the icon, and it is moved to the trash.

This behavor emulates a NeXT/Linux dock function.

    -- remove the "--" from the beginning of the following lines to make the
    -- Application Switcher appear similar to the row of minimized icons in OpenStep

    --tell application "Application Switcher"
    -- run
    -- set visible of palette to true
    -- set frame visible of palette to false
    -- set button ordering of palette to alphabetical
    -- set names visible of palette to false
    -- set icon size of palette to large
    -- set orientation of palette to horizontal
    -- set anchor point of palette to upper left
    -- set position of palette to lower left
    --end tell

    on open (thefiles)
    tell application "Finder"
    delete thefiles
    end tell
    end open

Back to the Archive

Maintained by the Staff of ResExcellence. This entire site ©1997-2006 ResExcellence
Privacy Statement? Sure we gotta Privacy Statement.