I’ve bypassed my previous request on addressing an already opened second Application by storing its unique build number when setting the Accessibility, and then bypassing my ‘set-accessibility’ routine if the second apps build number matches.
But I’ve struck a weird problem. The Mail addressing script below runs in about a second in Applescript, but is taking 20+ seconds in my ASObjC application. Anyone know of a fix, please. I’ve addressed the window by 'window 1’, and also its name, no effect.
on fileAndMailHandlingSubRoutine4_OpenUpMailFile()
try
my fordEvent()
tell application "Mail"
activate
open my currentMailItem
tell application "System Events" to tell process "Mail"
set tempName to name of window 1
try
tell window tempName
set x to 0
# Sheet opens straight away
keystroke "s" using {command down, shift down}
# These are as slow as a wet week
tell pop up button 1 of group 1 of sheet 1
click
try
click menu item 3 of menu 1
end try
end tell
set value of text field 1 of sheet 1 to (my printDateTimeName & ".eml" as text)
end tell
click button 1 of sheet 1 of window 1
try
keystroke return
end try
on error errmsg number errnum
set my attachmentMailFlag to "Errors found"
if errnum is not in {-1700, -1719} then tell application "System Events" to display dialog "Major Error: fileAndMailHandlingSubRoutine4, Saving email. Error number " & errnum & " Error " & errmsg as text giving up after 40
my mainLoopReturnEmpty()
end try
end tell
try
close every window
end try
end tell
my fileAndMailHandlingSubRoutine5_ZipAndSaveFile()
on error errmsg number errnum
set my attachmentMailFlag to "Errors found"
tell application "Mail"
try
close every window
end try
end tell
if errnum is not in {-1700, -1728} then
tell application "System Events" to display dialog "Loop Runner's fileAndMailHandlingSubRoutine4 . There is a 'Compressing Files' problem on the Mac in fileAndMailHandlingSubRoutine4 OpenUpMailFile. Error number " & errnum & " Error " & errmsg as text giving up after 40
set my errorMessage to my errorMessage & "There was a file compressing problem when saving the file to the Mac in fileAndMailHandlingSubRoutine4." & return
set my tryToSave to false
my mainLoopReturnEmpty()
else
my finishUpRunner()
end if
end try
end fileAndMailHandlingSubRoutine4_OpenUpMailFile