Name

Apple Data Detectors

Syntax

(* 
Identify detector in Script Editor Description window with the 
package::detector-name syntax as in Apple::Email Address  for the Email 
Address Internet Address Detector.
*)
Apple::Email Address  -- Name of detector to handle
New OutLook Express Message Recipient  (* string that will appear in 
contextual menu *)
(*
end of Script Editor Description Window phrases
*)
(*
define the handle detection routine ; it has a parameter of data type 
record that contains the detected text
*)
on handle detection theDetector
   --actual script with 'handle detection' handler, statements, and code ...
end handle detection

Dictionary commands

handle detection (from the Apple Data Detectors Scripting osax)

This event is fired when the user chooses the action containing this routine in the contextual menu. For example, the user might select and Control-click the text “user@hersite.com.” The resulting contextual menu may have a submenu displaying the title “New OutLook Express Message Recipient.” If the user chooses this title in the contextual menu, then the script action associated with that title is executed and it calls its handle detection routine. This routine stores the detector instance, an object of type record, in the handle-detection routine’s parameter. An example code snippet is: on handle detection theDetector...end handle detection (theDetector is the parameter or detector instance). For example, an email-related script could find out the selected email address ...

Get AppleScript in a Nutshell 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.