New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Apps and Games Discussion of applications and games available for Mac OS X.

Geektool script forces mail to stay open


Post Reply New Thread Subscribe

 
Thread Tools
jmullenberg

 
Member Since: Apr 27, 2008
Posts: 92
jmullenberg will become famous soon enough
Mac Specs: MBP 2.5 Intel Core 2 Duo, 2GB 667 MHz DDR2, 17" Hi-Res Display ; iPhone 3G 2.1

jmullenberg is offline
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."
QUOTE Thanks
Emeraldscorpion

 
Member Since: Sep 27, 2009
Posts: 1
Emeraldscorpion is on a distinguished road

Emeraldscorpion is offline
well, i'm not sure about editing it, but here's a script I made:
Code:
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"
		else
			set finalText to "No new Mail"
		end if
	end tell
	
else
	set finalText to "Mail not open"
end if
Hope this helps!
QUOTE Thanks

Post Reply New Thread Subscribe


« Rosetta Stone | Videos in iPhoto and iMovie »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
SuperDrive will not stay open 64bit Apple Desktops 1 01-15-2007 05:32 AM
eMac drive tray keeps popping open, won't stay shut unless off zachrocksx2 OS X - Operating System 2 10-22-2006 06:39 PM
iMac & iBook Mail keeps closing on open after setting up .Mac Sync Cross OS X - Apps and Games 1 08-21-2006 03:18 PM
OS X Mail and messenger apps. won't stay connected dglenn OS X - Operating System 2 04-25-2005 12:56 PM
Programs Stay Open, Even After You X Them Out? Vetteman Switcher Hangout 40 04-05-2005 01:37 PM

All times are GMT -4. The time now is 06:30 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?