Automate Finder Window Size, View and Location

Others have access to a hard drive connected to my computer, and they keep moving and resizing the folder windows. Is there any way to create an Automator script that will occasionally reset the size, view and location of the eight main folders to my preferred default settings?

Mac OS X (10.4.8)

Posted on Mar 12, 2007 3:49 PM

Reply
1 reply

Mar 13, 2007 5:33 PM in response to Ratboy

There is a "Set Folder Views" action included in the standard Automator install but there isn't anything for setting the size and location of folders.

The whole thing can be accomplished through a "Run AppleScript" action. Just click on the link below. This will transfer it to the Script Editor where you can copy and paste it into a "Run AppleScript" action in Automator. Replace all of the text in the action and not just where it says to (* Your script goes here *.

Set up your eight windows in the Finder, run the workflow and select the "Save Window State" button. Then after the one of the users has messed with the windows you should be able to return them to their previous state by again running the Automator workflow and selecting the "Reinstate Window State" button.

click here to open this script in your editor <pre style="font-family: 'Monaco', 'Courier New', Courier, monospace; overflow:auto; color: #222; background: #DDD; padding: 0.2em; font-size: 10px; width:400px">property WindowProperties : {}

on run {input, parameters}
display dialog "Select your action" buttons {"Save Window State", "Reinstate Window State"} default button 2
if button returned of the result is equal to "Save Window State" then
set WindowProperties to {}
tell application "Finder" to set NumberOfWindows to count of every window
repeat with i from 1 to NumberOfWindows
set WindowProperties to WindowProperties & my GrabWindowProperties(i)
end repeat
else
tell application "Finder" to close windows
repeat with i from NumberOfWindows to 1 by -1
set theResult to my CreateNewWindows(item i of WindowProperties)
end repeat
end if
return input
end run

to GrabWindowProperties(thisWindow)
tell application "Finder"
tell window thisWindow
return {{target, bounds, current view, toolbar visible, statusbar visible}}
end tell
end tell
end GrabWindowProperties

to CreateNewWindows(WindowProperties)
tell application "Finder"
make new Finder window
set target of window 1 to item 1 of WindowProperties
set current view of window 1 to list view
set toolbar visible of window 1 to item 4 of WindowProperties
set statusbar visible of window 1 to item 5 of WindowProperties
set bounds of window 1 to item 2 of WindowProperties
set current view of window 1 to item 3 of WindowProperties
end tell
end CreateNewWindows</pre>


PowerBook 12" Mac OS X (10.4.8)

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Automate Finder Window Size, View and Location

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.