Skip the navigation

Toggle sidebar visibility in all open Finder windows

By Rob Griffiths
November 20, 2009 02:24 PM ET

Macworld - When I publish hints here on Macworld, I usually try to walk through and explain how they work, so as to help you understand what's going on behind the scenes. Sometimes, though, I'll just present a solution without much of an explanation, such as with today's hint.

Today's hint is an AppleScript that will toggle the visibility of the sidebar in all open Finder windows. In 10.6, you can do this for any one window with the View -> Hide (or Show) Sidebar menu item, but it only applies to the current window. Using the script in today's hint, you can toggle the visibility in all open windows.

While the script works in both 10.5 and 10.6, it's most useful in 10.6, because the script can't completely hide the sidebar in 10.5 (instead, it just shrinks down to its minimum width).

Another advantage to using this script in 10.6 is that it can be created as a Service, and then run via either the Services menu, or if you prefer, a keyboard shortcut.

The following instructions assume you're running 10.6; if you're running 10.5, you can either enter the code in the Script Editor, and save it as an application, or possibly create it in Automator and save it as a Finder Plug-In (though I haven't tested that).

In 10.6, launch Automator, and when the template chooser window appears, click Service then click Choose to open a new workflow. Near the top of the window that opens, on the right, you'll see two pop-up menus. Set the rightmost of those to Finder, then set the leftmost to "no input." (If you set the leftmost one first, then the Finder will disappear from the rightmost pop-up.)

Next, in the search box on the left, type run apples, which should be enough text to find just one matching action, Run AppleScript. Drag that action into the work area on the right, and then delete all of the placeholder code that's in the text area (on run {input...etc).

Insert the following code in its place:

set Showsidebar to true

tell application "Finder"

activate

if exists window 1 then

set allwins to every window whose collapsed is false

set my_num to 0

repeat with onewin in allwins

set my_num to my_num + 1

tell application "System Events"

tell process "Finder"

set my_id to the name of onewin

tell application "Finder"

try

set my_test to get ¬

toolbar visible of window my_id

on error

set my_test to false

end try

end tell

if my_test then

tell application "Finder"

if window my_id is window 1 then

set the_place to get sidebar width of window my_id

if the_place = 0 then

set Showsidebar to true

else

set Showsidebar to false

end if

end if

Originally published on www.macworld.com. Click here to read the original story.
Reprinted with permission from Macworld.com. Story copyright 2010 Mac Publishing, LLC. All rights reserved.
Additional Resources
Forrester Consulting - Optimizing Users and Applications in a Mobile World
WHITE PAPER
Solving application issues over the WAN requires careful consideration. Based on their independent research, Forrester Consulting offers recommendations on how to tackle application performance issues, insufficient bandwidth and the inability to quickly restore users in a disaster.

Read now.

Security KnowledgeVault
WHITE PAPER
Security is not an option. This KnowledgeVault Series offers professional advice how to be proactive in the fight against cybercrimes and multi-layered security threats; how to adopt a holistic approach to protecting and managing data; and how to hire a qualified security assessor. Make security your Number 1 priority.

Read now.

Cut Communications Costs Once and for All
WHITE PAPER
New IP-based communications systems are being deployed by small and midsized businesses at a rapid rate. Learn how these organizations are enabling faster responsiveness, creating better customer experiences, speeding office or mobile interactions, and dramatically reducing existing communications costs.

Read now.

Operating Systems White Papers
VMware View Optimization Guide for Windows 7
This document provides guidelines for configuring a standard Windows 7 image to be used within a VMware View™ environment, providing administrators with the...
Watson - A System Designed for Answers. The future of workload optimized systems design
Watson is a workload optimized system designed for complex analytics, made possible by integrating massively parallel POWER7 processors and DeepQA technology. Read the...
Overcome Top 7 Admin Challenges of Active Directory
As Active Directory's role in the enterprise has drastically increased, so has the need to secure the data. Gain insight on creating repeatable,...
Insiders Can Ruin Your Company. Take Action.
Did you know that 80 percent of threats to an organization come from the inside? The threat from insiders is often overlooked in...
Top Solutions and Tools to Prevent Devastating Malware
Custom malware frequently goes undetected. According to Forrester Research, the best way to reduce risk of breach is to deploy file integrity monitoring...
All Operating Systems White Papers
Operating Systems Webcasts
Optimizing Networks for the Cloud
Join guest speaker, Rohit Mehra, IDC Director of Enterprise Communications Infrastructure, to explore current trends, discuss best practices for optimizing Data Center and...
Apps QuickStart Series Part 2: Designing and Deploying SQL Server on VMware vSphere
Download this webcast to learn about the design considerations for virtualizing SQL workloads, performance and scalability information and high-availability options, as well as...
Apps QuickStart Series Part 1: Designing and Deploying Exchange 2010 on VMware vSphere
Download this webcast to learn the virtual hardware design considerations for Exchange 2010, deployment using the building block approach, options for high-availability and...
Customer Spotlight: How IPC The Hospitalist Company Implemented Oracle on VMware
Have you been looking to hear about customer's experiences with the new VMware vCenter Site Recovery Manager product? View this webcast to learn...
Virtualize Business-Critical Applications with Confidence
Virtualizing business-critical applications has become a key focus for organizations as they move along their virtualization journey. With the launch of VMware vSphere®...
All Operating Systems Webcasts
Newsletter Sign-Up

Receive the latest news test, reviews and trends on your favorite technology topics

Choose a newsletter
  1. View all newsletters | Privacy Policy
IT Jobs