AppleScriptは、アプリケーションを目視で起動せずに呼び出し実行を実行できますか?

StackOverflow https://stackoverflow.com/questions/5033447

  •  14-11-2019
  •  | 
  •  

質問

次の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
.

このメールルールが実行されるたびに、アドレス帳を起動します。アクティブ化されていませんが、突然デスクトップに表示されます。私の質問は、ブロックを黙って起動するようにブロックを指示することができ、完全なときに終了することができますか?

役に立ちましたか?

解決

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.

他のヒント

To read the Address Book Database without launching "Address Book.app" I´d suggest to have a look at the command line tool "contacts" available for free here. You would then run it from Applescript like do shell script "/usr/bin/contacts Peter" and handle the values returned.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top