Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can an applescript "tell" call execute without visibly launching the application?

I have a Mail rule set up to launch 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 mail rule executes, it launches address book. Its not activated, but it suddenly shows up on my desktop. My question is, can tell blocks be instructed to launch the application silently, and quit when complete?

like image 518
eykanal Avatar asked Feb 17 '11 19:02

eykanal


1 Answers

AppleScript can't control an application without it running. That's just the way it works. There are other methods you might use to access the Address Book database without launching the application, but if you're using AppleScript to get data from your Address Book database the application has to launch. My recommendation would be to simply add a quit command as suggested by Fábio.

like image 58
Chuck Avatar answered Sep 30 '22 01:09

Chuck