• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Execution Error when quitting mail
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Execution Error when quitting mail


  • Subject: Execution Error when quitting mail
  • From: Horst Brinker <email@hidden>
  • Date: Tue, 1 Oct 2002 20:36:37 -0500

Hello List,

I'm relatively new to appleScript ( having done a few simple scripts in
Xtension ). I found that I wanted to use Jaguar's mail app for spam
filtering ( works really well! ).

I'm stuck with a dialup internet connection and found that, with os X,
the internet applications no longer wait for a connection to be
established after you launch them. ( network control panel, PPP
options - connect automatically when needed ) They used to do that
under OS 9 ( guess it was the cooperative multitasking that made it
work )

Anyway, after a bunch of head scratching and RTFMing, I came up with
the following stay open script:

on idle
set {time:thetime, weekday:theday} to current date
if theday = Saturday or theday = Sunday then
set rerun to 2 * hours
else
set rerun to 1 * hours -- 5pm -> midnight
if thetime < 17 * hours then set rerun to 30 * minutes -- 5:30 am ->
5 pm
if thetime < 5.5 * hours then set rerun to 2 * hours -- midnight ->
5:30 am
end if
tell application "Internet Connect"
get the state of status of current configuration
set initial_connect_stat to result
repeat until state of status of current configuration = 4
if state of status of current configuration = 0 then
connect
end if
end repeat
end tell
tell application "Mail"
check for new mail
repeat until background activity count = 0
end repeat
check for new mail
repeat until background activity count = 0
end repeat
delay 1
if initial_connect_stat !A 4 then
-- ignoring application responses <--- WHY do I need this here???
quit application
-- end ignoring
end if
end tell
if initial_connect_stat !A 4 then
tell application "Internet Connect"
disconnect
quit
end tell
end if
return rerun
end idle

on quit
display dialog "Sure you want to quit"
continue quit
end quit

It works quite well, but I can't understand why I need the "Ignoring
application responses" around the "quit" command for Mail. If I take
them out as in the example, the script stops with an execution error
and the message is "Mail got an error: Connection is invalid". I
tried just a simple script the does nothing but tell mail to quit and
it works well. The "delay 1" was a failed attempt to work around the
problem.

Thanks,
Horst
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Adding a message to a mailbox in Mail
  • Next by Date: Re: Regex on OS X
  • Previous by thread: RE: Need Help
  • Next by thread: Re: MacOS 8.6 question
  • Index(es):
    • Date
    • Thread