Results 1 to 2 of 2
  1. #1

    Member Since
    Apr 27, 2008
    MBP 2.5 Intel Core 2 Duo, 2GB 667 MHz DDR2, 17" Hi-Res Display ; iPhone 3G 2.1
    Geektool script forces mail to stay open
    I am running a script in geektool to display my current number of unread mail messages on my desktop. I found this script on a website somewhere:

    echo 'tell application "Mail" to return unread count of mailboxes of accounts' | osascript | perl -e "@a=split ',',<STDIN>; foreach (@a) {\$n += \$_}; print \"\$n\n\";"

    The problem is that every time it updates it forces mail to open, which is causing problems when shutting down, and also sometimes i just dont want mail to be open.

    Is there a way to modify this script so that it checks to see if mail is already open, and if it isnt end the script?
    "Sure, I could compare PCs to Macs. But I make it a point to never argue about religion."

  2. #2

    Member Since
    Sep 27, 2009
    well, i'm not sure about editing it, but here's a script I made:
    tell application "System Events" to set iCalIsRunning to (name of processes) contains "Mail"
    set finalText to ""
    if iCalIsRunning then
    	tell application "Mail"
    		set unreadCount to unread count of inbox
    		if (unreadCount is greater than or equal to 1) then
    			return (unreadCount as string) & " new messages"
    			set finalText to "No new Mail"
    		end if
    	end tell
    	set finalText to "Mail not open"
    end if
    Hope this helps!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Geektool won't open geeklets?
    By la_bell in forum OS X - Apps and Games
    Replies: 1
    Last Post: 09-23-2012, 07:39 PM
  2. Mail: why do deleted e-mail addresses stay in the memory!!
    By Sofisticat in forum OS X - Apps and Games
    Replies: 3
    Last Post: 01-30-2010, 03:06 PM
  3. Shell Script in GeekTool trouble ...
    By TattooedMac in forum OS X - Development and Darwin
    Replies: 13
    Last Post: 11-13-2009, 06:16 PM
  4. SuperDrive will not stay open
    By 64bit in forum Apple Desktops
    Replies: 1
    Last Post: 01-15-2007, 05:32 AM
  5. Programs Stay Open, Even After You X Them Out?
    By Vetteman in forum Switcher Hangout
    Replies: 40
    Last Post: 04-05-2005, 01:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts