• 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
Re: Mail navigation script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mail navigation script


  • Subject: Re: Mail navigation script
  • From: Brian Christmas <email@hidden>
  • Date: Sat, 03 Nov 2012 12:09:48 +1100


Pretty slack of me late last night, in that I didn't allow for a range of selected mailboxes. So this fixes it.

BTW, does anyone know how to expand a thread that's closed, using scripting? There doesn't appear to be anything in Mail's dictionary regarding threading.

Regards

Santa

property x : {}
on run
my setUpLoop()
end run

on setUpLoop()
tell application "Mail"
activate
set x to {}
set theflag to true
tell (some message viewer whose index is 1)
try
set AllMailBoxes to (get selected mailboxes)
repeat with eachMailBox in AllMailBoxes
my checkLoop(eachMailBox)
end repeat
on error errmsg number errnum
if errnum = -1730 then
display dialog "Please select a mailbox"
set theflag to false
end if
end try
end tell
if theflag then my MainLoop(1)
end tell
end setUpLoop

on checkLoop(eachMailBox)
tell application "Mail"
tell (some message viewer whose index is 1)
repeat with yy in messages of eachMailBox
set end of x to yy
end repeat
repeat with yy in mailboxes of eachMailBox
my checkLoop(yy)
end repeat
end tell
end tell
end checkLoop

on MainLoop(xx)
tell application "Mail"
activate
set theflag to true
repeat
if x = {} then
set theCount to (count of selected mailboxes of message viewers)
if theCount = 1 then
display dialog "The mailbox is empty."
else
display dialog "The mailboxes are empty."
end if
set theflag to false
exit repeat
else
set xxx to (item xx of x)
set selected mailboxes of message viewers to mailbox of xxx
set selected messages of message viewers to xxx
tell application "Finder"
activate
display dialog "Backwards or Forwards" buttons {"Backwards", "Select this one", "Forwards"}
end tell
set b to button returned of the result
if b = "Select this one" then exit repeat
if b = "Backwards" then
set xx to xx - 1
if xx < 1 then set xx to count of x
end if
if b = "Forwards" then
set xx to xx + 1
if xx > (count of x) then set xx to 1
end if
end if
end repeat
end tell
if theflag then my WaitLoop(xx)
end MainLoop

on WaitLoop(xx)
tell application "Finder"
activate
display dialog "Resume, Print, or Cancel" buttons {"Resume", "Print", "Cancel"}
set b to button returned of the result
if b = "Resume" then my MainLoop(xx)
if b = "Print" then
tell application "Mail" to activate
tell application "System Events" to tell process "Mail" to keystroke "p" using command down
my WaitLoop(xx)
end if
end tell
end WaitLoop
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Mail navigation script
      • From: Brian Christmas <email@hidden>
References: 
 >Mail navigation script (From: Dave C <email@hidden>)
 >Re: Mail navigation script (From: Brian Christmas <email@hidden>)
 >Re: Mail navigation script (From: Brian Christmas <email@hidden>)

  • Prev by Date: Re: Checking on the existence of a file
  • Next by Date: Re: Mail navigation script
  • Previous by thread: Re: Mail navigation script
  • Next by thread: Re: Mail navigation script
  • Index(es):
    • Date
    • Thread