http://support.myphonedesktop.com/entri ... on-plug-in
makes dialing, sending sms, etc. form LB a breeze!
i did a modification to the file, because i use it most of the time for phone numbers from websites. just to make things clear for myPhoneDesktop i delete all the "+ / ( )" etc. from the string
just duplicate the original script, rename it to something like "send phone number to myPhoneDesktop"
- Code: Select all
-- myPhoneDesktop and LaunchBar integration script
-- v1.0 (Beta 2, 03/11/2010)
-- Copyright © 2010 jProductivity, LLC
-- http://myphonedesktop.com
-- visit http://bit.ly/9jaCkG for instructions on how to install and use this script
-- This script is based on the snippets from:
-- http://codesnippets.joyent.com/posts/show/1124
-- http://daringfireball.net/2006/10/how_to_tell_if_an_app_is_running
-- http://www.macosxhints.com/article.php?story=20040204170653788
on handle_string(theString)
set AppleScript's text item delimiters to "!"
set theString to (text items of theString)
set AppleScript's text item delimiters to ""
set theString to (theString as string)
set AppleScript's text item delimiters to "+"
set theString to (text items of theString)
set AppleScript's text item delimiters to "00"
set theString to (theString as string)
set AppleScript's text item delimiters to "|"
set theString to (text items of theString)
set AppleScript's text item delimiters to ""
set theString to (theString as string)
set AppleScript's text item delimiters to "-"
set theString to (text items of theString)
set AppleScript's text item delimiters to ""
set theString to (theString as string)
set AppleScript's text item delimiters to "–"
set theString to (text items of theString)
set AppleScript's text item delimiters to ""
set theString to (theString as string)
set AppleScript's text item delimiters to "?"
set theString to (text items of theString)
set AppleScript's text item delimiters to ""
set theString to (theString as string)
set AppleScript's text item delimiters to "/"
set theString to (text items of theString)
set AppleScript's text item delimiters to ""
set theString to (theString as string)
set AppleScript's text item delimiters to ":"
set theString to (text items of theString)
set AppleScript's text item delimiters to ""
set theString to (theString as string)
set AppleScript's text item delimiters to ";"
set theString to (text items of theString)
set AppleScript's text item delimiters to ""
set theString to (theString as string)
set AppleScript's text item delimiters to "(0)"
set theString to (text items of theString)
set AppleScript's text item delimiters to ""
set theString to (theString as string)
set AppleScript's text item delimiters to "("
set theString to (text items of theString)
set AppleScript's text item delimiters to ""
set theString to (theString as string)
set AppleScript's text item delimiters to ")"
set theString to (text items of theString)
set AppleScript's text item delimiters to ""
set theString to (theString as string)
set AppleScript's text item delimiters to "#"
set theString to (text items of theString)
set AppleScript's text item delimiters to ""
set theString to (theString as string)
if canSendToMPD() then
set the clipboard to theString as text
sendToMPD(theString)
end if
end handle_string
on open (theFile)
try
if canSendToMPD() then
set isText to false
set isImage to false
tell application "Finder"
set theFile to theFile as alias
set theFileKind to kind of theFile
if theFileKind is in {"Plain text document", "Plain Text"} then
set isText to true
else if theFileKind is in {"JPEG image", "Portable Network Graphics image", "Graphics Interchange Format (GIF)"} then
set isImage to true
end if
end tell
if isText then
processTextFile(theFile)
else if isImage then
processImageFile(theFile)
end if
end if
on error error_message number error_number
if error_number is not -128 then display alert "myPhoneDesktop" message error_message as warning
end try
end open
on processTextFile(theFile)
set thePath to POSIX path of theFile
set file2send to (open for access (POSIX file thePath))
set txt to (read file2send for (get eof file2send))
close access file2send
set the clipboard to txt
--convert clipboard contents to plain text
set the clipboard to «class ktxt» of ((the clipboard as text) as record)
sendToMPD(theFile)
end processTextFile
on processImageFile(theFile)
tell application "System Events"
keystroke "c" using {command down}
delay 0.5
end tell
sendToMPD(theFile)
end processImageFile
on sendToMPD(data)
try
tell application "System Events"
key code 113 using {shift down, control down, option down, command down}
end tell
on error error_message number error_number
if error_number is not -128 then display alert "myPhoneDesktop" message error_message as warning
end try
end sendToMPD
on canSendToMPD()
return ensureMPDIsRunning() and isEnabledAccessForAssistiveDevices()
end canSendToMPD
on isEnabledAccessForAssistiveDevices()
set result to false
try
tell application "System Events" -- TODO: check if this TELL is still needed
if UI elements enabled then -- TODO: clarify me how it works? can't see any mention of "Enable access etc." option there
set result to true
else
tell application "System Preferences"
activate
set current pane to pane id "com.apple.preference.universalaccess"
display dialog "Before myPhoneDesktop can use its system-wide shortcuts, you need to make one small change to your system configuration." & return & return & "\"Preferences | Universal Access\" is already opened for you. Please turn ON the \"Enable access for assistive devices\" option, and then repeat your task." with title "Configure Universal Access" with icon 1 buttons {"OK"} default button 1
end tell
end if
end tell
on error error_message number error_number
if error_number is not -128 then display alert "myPhoneDesktop" message error_message as warning
end try
return result
end isEnabledAccessForAssistiveDevices
on ensureMPDIsRunning()
set appName to "myPhoneDesktop"
try
tell application "System Events"
set isRunning to (displayed name of processes) contains appName
end tell
if isRunning = false then
do shell script "open -a \"/Applications/myPhoneDesktop.app/\""
delay 10
tell application "System Events"
set isRunning to (displayed name of processes) contains appName
end tell
end if
on error error_message number error_number
if error_number is not -128 then display alert "myPhoneDesktop" message error_message as warning
end try
if isRunning = false then
display dialog "myPhoneDesktop is not running" with title "Unable to send data to myPhoneDesktop" with icon 1 buttons {"OK"} default button 1
end if
return isRunning
end ensureMPDIsRunning
Hope you like it...
