It’s a general question: if I send an apple event to an app, before the app can finish the event, what will happen if I send in another one? Does this depend on the implementation of a particular app?
Paraphrase: if an app acts like a server, with a waiting loop listening to incoming requests, does it fork/make a new thread with each incoming request, or it queues the requests and doesn’t do the next until the last one is completed?
It depends a lot on the app in question and how you write your script.
Typically AppleScript waits for the application to respond to each command before continuing, so you don’t get to send a second event until the first one has finished.
This can change, however, by using the with timeout command, to control (or eliminate) the time AppleScript waits for the application to respond.
What happens if you send a second event is application-dependent. A database application, for example, may be able to execute multiple concurrent searches, but an image processing application may be more linear.
I downloaded MainEvents 1.3.1 and changed the sample script to script adobe acrobat.
It tells acrobat to show a dialogbox, this is a dialogbox of a plugin calls
“Enfocus Pitstop” wich we use to check PDF files. The script works till the dialogbox
show up, is it possible to script things in this dilaogbox with MainEvents??
tell application "Finder"
if exists items in folder "Dolf HD:Desktop Folder:PDFF:" then
set theFolderList to folder "Dolf HD:Desktop Folder:PDFF:"
set theNameList to ""
repeat with thisItem in theFolderList
set theNameList to (the name of thisItem)
tell application "Acrobat 5.0"
activate
open thisItem
end tell
exit repeat
end repeat
end if
end tell
tell application "Finder"
set targetApplication to application "Acrobat 5.0"
tell targetApplication
try
set menuListInfo to Query Menu List
end try
if (count of menuListInfo) is greater than 0 then
set menuListText to menu title of item 1 of menuListInfo
repeat with menuIndex from 2 to count of menuListInfo
set menuListText to menuListText & ", " & menu title of item menuIndex of menuListInfo
end repeat
end if
set menuInfo to Query Menu menu title "Certified PDF"
Select Menu Item menu title "Certified PDF" menu item text "Edit Properties..."
end tell
end tell