O'Reilly logo

AppleScript in a Nutshell by Bruce W. Perry

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required