Created
April 29, 2013 01:33
-
-
Save benwaldie/5479217 to your computer and use it in GitHub Desktop.
TUAW > Adding Copy to Clipboard Phone Number Rollover in Contacts App via AppleScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- "using terms from" is necessary to let AppleScript know that these event handlers are terminology that belongs to the Contacts app | |
using terms from application "Contacts" | |
-- This handler returns the Contacts property for which the plug-in should function | |
on action property | |
return "phone" | |
end action property | |
-- This handler returns the name of the plug-in to be displayed in the Contacts property popup menu | |
on action title | |
return "Copy to Clipboard" | |
end action title | |
-- This handler basically tells the Contacts app that this plug-in should be enabled for a given person | |
on should enable action with theProperty for thePerson | |
if theProperty is not equal to missing value then | |
return true | |
else | |
return false | |
end if | |
end should enable action | |
-- This handler runs when the plug-in is selected from the Contacts property popup menu | |
on perform action with theProperty for thePerson | |
-- Target the contact from where the plug-in was triggered | |
tell application "Contacts" | |
-- Retrieve the value of the property that triggered the plug-in | |
set theValue to value of theProperty | |
end tell | |
-- Copy the value to the clipboard | |
set the clipboard to theValue | |
end perform action | |
end using terms from |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment