• 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: Weird message saving to desktop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Weird message saving to desktop


  • Subject: Re: Weird message saving to desktop
  • From: Brian Christmas <email@hidden>
  • Date: Sun, 30 Sep 2012 20:14:13 +1000


On 30/09/2012, at 3:31 AM, koenig.yvan <email@hidden> wrote:


Hello

Now I think that I understand.

You are hitting the problem which pushed me to write a script applying force quit when I want to shutdown because from time to time, when applications (most often Mail) are supposed to quit, they remain in an odd state. Their menu item is grayed and they do nothing as checked in Activity Monitor.

In your case, as long as this problem strikes, the only workaround which I think of is to try to find an other scheme than the one which you use at this time :

tell application "System Events"
repeat while exists process "Mail"
try
tell application "Mail" to quit
end try
end repeat
repeat while not (exists process "Mail")
try
tell application "Mail" to activate
end try
end repeat
end tell


to get the menu item "Save Attachments…" enabled.

May you try to ask the script to open the message which you want to treat ?
I'm quite sure that doing that the menu item will be enabled.



G'day scripters, and  thanks once again Yvan.

The problem doesn't lie with getting the attachments, but with saving as an rtfd.

The following script boils it down, and should create an error.

Create a mailbox called "* items to shift" and put several emails in it. Run the script. Hopefully, if I'm not going mad, it will error.

Any thoughts on how to fix please?

Regards

Santa

property PrintDateTimeName : ""
property Cyclethroughmessages : {}

my SubRoutine1()

on SubRoutine1()
set tempstore to {}
set Cyclethroughmessages to {}
tell application "Mail"
activate
try
set tempstore to messages of mailbox "* items to shift" as list
end try
end tell
repeat with Cyclethroughmessages in reverse of tempstore
my resetMail()
tell application "Mail"
activate
set PrintDateTimeName to my dateTimeStamp()
set selected mailboxes of message viewers to mailbox "* items to shift"
set the selected messages of message viewers to Cyclethroughmessages
open Cyclethroughmessages
name of window 1
my SubRoutine2(result)
end tell
end repeat
end SubRoutine1


on SubRoutine2(tempWindowName)
tell application "Mail" to activate
tell application "System Events" to tell process "Mail"
try
tell window 1
keystroke "s" using {command down, shift down}
delay 1
try
keystroke "d" using {command down}
end try
delay 1
keystroke (PrintDateTimeName & "Z") as text
delay 1
try
if value of checkbox 1 of group 1 of sheet 1 = 0 then click checkbox 1 of group 1 of sheet 1
end try
tell group 1 of sheet 1
tell pop up button 1
click
repeat
try
name of menu item 1 of menu 1
exit repeat
on error
delay 0.1
end try
end repeat
click menu item 1 of menu 1
end tell
end tell
end tell
click button 1 of sheet 1 of window 1
keystroke return
end try
end tell --tell system events
tell application "Mail"
try
close window 1 --tempWindowName
end try
end tell
end SubRoutine2

--=====

on dateTimeStamp()
return (do shell script "date -u +%Y-%m-%d" & character id 160 & "%H%M%S")
end dateTimeStamp

on resetMail()
--return --<-- Doesn't work either
tell application "System Events"
repeat while exists process "Mail"
try
tell application "Mail" to quit
end try
end repeat
end tell
tell application "Dock"
activate
end tell
tell application "System Events"
tell process "Dock"
set frontmost to true
activate
tell list 1
click UI element "Mail"
end tell
end tell
repeat while not (exists process "Mail")
try
tell application "Mail" to activate
end try
end repeat
         end tell
end resetMail


 _______________________________________________
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

References: 
 >Re: Weird message saving to desktop (From: "koenig.yvan" <email@hidden>)
 >Re: Weird message saving to desktop (From: Brian Christmas <email@hidden>)
 >Re: Weird message saving to desktop (From: Brian Christmas <email@hidden>)
 >Re: Weird message saving to desktop (From: "koenig.yvan" <email@hidden>)

  • Prev by Date: Re: name of target of front window
  • Next by Date: re: name of target of front window
  • Previous by thread: Re: Weird message saving to desktop
  • Next by thread: Help Testing a Mail Script
  • Index(es):
    • Date
    • Thread