Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

An AppleScript to toggle 'Calculate folder sizes' Desktop
Quite a simple hint which toggles the Finder's list view option to Show folder sizes using an AppleScript. By saving the script as an application and adding it to the toolbar, you get a simple and fast method to switch on and off "Calculate all sizes" for the frontmost window. Simply paste the following text in the Script Editor and save it as Application (with no startup screen).
tell application "Finder"
 if calculates folder sizes of the list view options ¬
 of the front window is true then
  set calculates folder sizes of the list view options ¬
  of the front window to false
 else
  set calculates folder sizes of the list view options ¬
  of the front window to true
 end if
end tell
There are many ways to enhance this script:
  • Add a nice looking icons (anyone? ;-)
  • Implement it as a Finder script somehow, to circumvent starting the Applescript as an application
  • switch to list view if view is not selected yet
[robg adds: I tested it, and it works as described.]
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[12,541 views]  

An AppleScript to toggle 'Calculate folder sizes' | 13 comments | Create New Account
Click here to return to the 'An AppleScript to toggle 'Calculate folder sizes'' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
How to toggle sort by size versus name?
Authored by: macslut on May 13, '04 12:50:58PM

Great tip!

Does anybody know off hand how to toggle the view to size versus name? In other words, when I click on the AppleScript, I'd like it to switch to Size view, I'm not so concerned what it does when I click on it again...either it could switch to Name view or possibly switch to whatever it was before (but I don't think that's easily possible).



[ Reply to This | # ]
How to toggle sort by size versus name?
Authored by: magir on May 13, '04 03:21:43PM

Well, there are several way to enhance the script. I was simply too lazy to do it :-) I'll take a look whether I can improve it and post a refined version if possible.



[ Reply to This | # ]
works great
Authored by: alec kinnear on May 13, '04 03:59:24PM

i added it as an ikey menu item. fantastic. may add it as a keyboard shortcut.



[ Reply to This | # ]
An AppleScript to toggle 'Calculate folder sizes'
Authored by: amos on May 13, '04 04:04:00PM
This version will change the view of the frontmost window to list view before activating the option to view the folder size

tell application "Finder"
	set current view of Finder window 1 to list view
	if calculates folder sizes of the list view options ¬
		of the front window is true then
		set calculates folder sizes of the list view options ¬
			of the front window to false
	else
		set calculates folder sizes of the list view options ¬
			of the front window to true
	end if
end tell
Andrea

[ Reply to This | # ]
An AppleScript to toggle 'Calculate folder sizes'
Authored by: macslut on May 13, '04 10:34:34PM
Ok, I answered my own question and updated the latest script:


tell application "Finder"
	set current view of Finder window 1 to list view
	if calculates folder sizes of the list view options ¬
		of the front window is true then
		set calculates folder sizes of the list view options ¬
			of the front window to false
		set sort column of list view options of the front window to name column		
	else
		set calculates folder sizes of the list view options ¬
			of the front window to true
		set sort column of list view options of the front window to size column
	end if
end tell
This now switches to list view and sorts by size and then toggles back to sorting by name.

[ Reply to This | # ]
An AppleScript to toggle 'Calculate folder sizes'
Authored by: swedentom on May 14, '04 11:06:36AM
One-liner: tell application "Finder" to set calculates folder sizes of the list view options of the front window to not (calculates folder sizes of the list view options of the front window)

[ Reply to This | # ]
An AppleScript to toggle 'Calculate folder sizes'
Authored by: osxpounder on May 14, '04 12:13:23PM

The one-liner script does nothing for me, but Andrea's script is working great.

---
--
osxpounder



[ Reply to This | # ]
An AppleScript to toggle 'Calculate folder sizes'
Authored by: blackxacto on May 15, '04 01:03:57AM

your one line is dead. Nothing happens. Thanks, Andrea. Yours works beautifully. jr



[ Reply to This | # ]
An AppleScript to toggle 'Calculate folder sizes'
Authored by: Faux Plastic on May 14, '04 02:50:24PM

Kind of an odd, naive question, but where do you save this script so that it's easily accessible? I don't really like having the script menu in the menubar because it's full of a lot of crap that I don't need. I guess I could empty it out of the scripts I don't use.

But what I'd really like to do is add it to the folder action pulldown button in the Finder toolbar.

Does anyone know if this is possible and how I would do it?



[ Reply to This | # ]
An AppleScript to toggle 'Calculate folder sizes'
Authored by: macslut on May 14, '04 04:17:37PM

You know you can put it in the toolbar to the right or left of the Actions button. You can put anything there, just drag, hold and drop.



[ Reply to This | # ]
Script Menu
Authored by: BulbVivid on May 15, '04 12:16:58PM

You can remove those scripts from the menu bar script menu by choosing "hide library scripts" from the pulldown menu.

You may need to put a "scripts" folder in your user library. You can put scripts in there, hide the library scripts, and then your user scripts are the only ones that show up.

Jason



[ Reply to This | # ]
An AppleScript to toggle 'Calculate folder sizes'
Authored by: hahnebembel on Nov 06, '04 12:47:43PM

for fast access, you might just drag the script / programm onto the toolbar of your finder windows. just make sure you choose a significant icon like "MB" "2002" a clock or someting.



[ Reply to This | # ]
Make it nice
Authored by: Dale Mox on May 15, '04 07:19:20PM

Save as an application bundle.
Right-click the application, click show package contents, enter Contents, open Info.plist in an editor, insert:
<key>NSUIElement</key>
<string>1</string>
before the end of the last </dict>
Move the app to the desktop, then move it back (complicated reason)

Now, when you open it, nothing shows and it just switches on it's own.
As icons I used a discrete screenshot of 'MB'.

Also I switched 'calculates folder sizes' with 'uses relative dates' for the relative dates option, and used a screenshot of '2004' as icon. fun fun fun.

Now to understand how to set it to 'all' folders, not this folder... boh! ;-)



[ Reply to This | # ]