Can an application “speak” a call without visibly launching the application?

I have a mail rule configured to run the following applescript:

using terms from application "Mail"
    on perform mail action with messages theMessages for rule theRule
        tell application "Mail"

            - do stuff, including ...
            CheckAddressBook (theName, theAddress)

        end tell
    end perform mail action with messages
end using terms from

on CheckAddressBook (theName, theAddress)
    tell application "Address Book"
        - do stuff
    end tell
end CheckAddressBook

Whenever this email rule is executed, it starts the address book. It is not activated, but it suddenly appears on my desktop. My question is, can teams tell me to start the application silently and exit after completion?

+5
source share
2 answers

AppleScript cannot control the application without running it. This is how it works. There are other methods that you can use to access the address book database without starting the application, but if you are using AppleScript to retrieve data from your address book database, the application should start. My recommendation would be to simply add the quit command suggested by Fábio.

+4

"Address Book.app", "", . Applescript, do shell script "/usr/bin/contacts Peter", .

+2

All Articles