Considering/Ignoring

There are two kinds of considering/ignoring block. One is the “ignoring application responses” block, which affects the nature of Apple events targeting an application. The other affects the details of string comparisons.

Ignoring Application Responses

Recall from Section 4.1 that during interapplication communications, the sender of an Apple event may specify that it has no intention of waiting around for a reply. It doesn’t care what the result is; it doesn’t care if there’s an error. It just wants to send the Apple event and be done with it, proceeding immediately to its own next step. In AppleScript, here’s how to send such an Apple event:

ignoring application responses
        -- code
end ignoring

Within the block, only Apple events sent to other applications are affected. Apple events sent to scripting additions, for example, are sent in the normal way and receive whatever replies they normally receive.

For an example, see Section 1.4. The code that opens a URL from the clipboard is wrapped in an “ignoring application responses” block because I want the browser or mail client or whatever to open in the background and without my waiting for it; thus I can get on immediately with what I was doing.

Inside an “ignoring application responses” block, it is possible to override the block by embedding a “considering application responses” block. You might use this, for example, to ignore application responses from one application but not another.

String Considerations ...

Get AppleScript: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.