When trying to access the ‘File/Save Attachments..’ menu from a script opened message, the menu item remains greyed out.
No amount of GUI clicking on the interface that I’ve tried has worked.
I really, really need that menu item activated, so I’m hoping that wiser heads than mine can advise me of a way (yes. it’s you lot I’m referring to).
I’ve tried the following (which I’ve also posted on the ‘Mail’ forum), but Mail no longer responds to clicks, it seems.
set SaveAttachmentsMenu to true
tell application "Mail"
activate
set WindowCount to count of windows
open item 1 of messages of mailbox "* items to store" # drafts mailbox
set x to 0
repeat # wait until the message is really open.
tell current application to delay 0.1
set x to x + 1
if x > 40 then exit repeat
if (count of windows) > WindowCount then exit repeat
end repeat
tell application "System Events" to tell process "Mail"
tell current application to delay 1
try
select scroll area 1 of window 1
click
end try
try
tell scroll area 1 of window 1
set {xPosition, yPosition} to position
set {xSize, ySize} to size
end tell
-- modify offsets if hot spot is not centered:
click at {xPosition + (xSize div 2), yPosition + (ySize div 2)}
display dialog xPosition & tab & yPosition as text
on error errmsg
display dialog errmsg
end try
tell current application to delay 0.2
if exists menu item "Save Attachments…" of menu 1 of menu bar item "File" of menu bar 1 then
keystroke "a" using command down
if not enabled of menu item "Save Attachments…" of menu 1 of menu bar item "File" of menu bar 1 then say"attachments disabled"
click menu item "Select All" of menu 1 of menu bar item "Edit" of menu bar 1
set x to 0
try
click menu item "Save Attachments…" of menu 1 of menu bar item "File" of menu bar 1
end try
repeat until exists sheet 1 of window 1
tell current application to delay 0.1
set x to x + 1
if x = 40 then
set SaveAttachmentsMenu to false
exit repeat
end if
end repeat
end if
end tell
end tell
SaveAttachmentsMenu