Addressbook Plugin in Applescript doesn't work anymore since 10.9.2

We use a small plugin for the Apple Addressbook.app which enables teh user to dial the selected number on his SNOM VoIP phone. The plugin is written in Applescript and worked quiet fine until the last system update (security patch). Now the plugin operation doesn't show up anymopre in the context menu when clicking on a phone number in Addressbook.

Has there been a change in security policy which doesn't allow "simple" Applescript scripts to use the plugin interface? Surprisingly 2 older plugins which handle teh dialing of Skype calls and which are implemented in ObjC still work.

What can be done to enable Applescript plugins again in context with Addressbook?


Ursus Minor

Macbook Pro 17", Mac OS X (10.6.6)

Posted on Mar 5, 2014 7:12 AM

Reply
10 replies

Mar 5, 2014 7:52 AM in response to ursusminor

I'm not sure if this is related to your problem but the 10.9.2 update has been reported to cause problems with applescripts that call


application "Contacts"


due a problem with the launch services database. One way round that is to change "Contacts" or "Address Book" to the


application id "com.apple.AddressBook"



identifier. Another way is to update the launch services database. I've detailed the procedure here.


(note: this is a link to my own website and is not endorsed by Apple in any way)

Mar 6, 2014 1:22 AM in response to softwater

Thanks for this help. Indeed, the launch service database seemed to be corrupt leading to the same error you described in your ls repair description when calling


tell application "Contacts"

activate

end tell


After the fixing such scripts work fine now ... but my VoIP phone Dial-Up script still doesn't show up in the context menu when clicking on a phone number in Contacts. OK, now it compiles without errors due to the ls database rebuild, but there seems to something more in the 10.9.2 update which leads to the ignoring of the plug-in.


After inspecting the system log I detected the follwoing entry quiet after starting the Contacts.app:


06.03.14 10:11:48,930 Finder[606]: AppleEvents/sandbox: Returning errAEPrivilegeError/-10004 and denying dispatch of event misc/curd from process 'osascript'/0x0-0x38b38b, pid=38792, because it is not entitled to send an AppleEvent to this process.


Obviously there seems to be a problem with sandbox permissions and the call to the script. Any ideas how to solve this issue?

Mar 6, 2014 4:53 AM in response to ursusminor

It's hard to say without seeing the script. If you want me to take a look at the script email me through my website, or post it here if you don't mind the world having a peek.


One thing that does stand out is why that error is being reported by Finder. You're not trying to call osascript from withing a Finder tell block are you? 'do shell script' calls should be outside of all application tell blocks.


Alternatively, it could be that your'e trying to use osascript to call the user's instance of Finder from another- or super- user's shell.


Like I said, hard to say without seeing the script, but those are my best guesses from what you've told us.

Mar 6, 2014 5:09 AM in response to softwater

I Have attached the script. In the meantime I cannot see osascript sandbox erros in the log anymore. Maybe there was a different cause of this. But the problem with Contacs remains: the context menu entry is not showing up when clicking on a phone numer. I've found a similar request here:

http://macscripter.net/viewtopic.php?id=42032

It seems to be a Mavericks 10.9.2 issue.


(*

Automatic SNOM Dialer v0.3

based on Torsten Uhlmann, tuhlmann@agynamix.de

based on Automatic Vonage Dialer by Aaron Freimark, abf@mac.com, March 16, 2004

Bernd Wild, bwild@intarsys.de


Put this script into your "Address Book Plugins" folder in your ~/Library folder.

*)


property mySnomLogin : ""

property mySnomPassword : "<mypassword>"

property mySnomPhoneAddress : "<mysnomURL>"


using terms from application "Contacts"

on action property

return "phone"

end action property


on action titleforperswithfone

return "Wählen mit SNOM"

end action title


on should enable actionforperswithfone

if label of fone contains "fax" then return false

return true

end should enable action


on perform actionforperswithfone

set numToDial to (value of fone) as string



--Erase everything that's not a digit from the phone number

set numToDial to CleanTheNumber(numToDial)

display dialog "Ich wähle dann folgende Nummer:" default answer numToDial buttons {"OK", "Abbrechen"} default button 1

if button returned of result = "OK" then

set numToDial to text returned of the result


set theURL to "https://" & mySnomLogin & ":" & mySnomPassword & "@"

set theURL to theURL & mySnomPhoneAddress & "/command.htm?number=" & numToDial



-- Use curl to hit the URL and dial the number

set errorCode to do shell script "curl -k \"" & theURL & "\""



beep


-- display dialog "Info: Wählen der Nummer " & numToDial buttons {"OK"}



--If there was an error, return a message.

if (characters 1 thru 3 of errorCode) as string is not equal to "000" then

display dialog "Fehler: " & errorCode buttons {"OK"}

end if

end if


end perform action


end using terms from


on CleanTheNumber(numToDial) -- remove punctuation from a string, leaving just the number

set theDigits to {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}

set cleanedNumber to ""

repeat with i from 1 to length of numToDial

set j to (character i of numToDial)

if j = "+" then set cleanedNumber to cleanedNumber & "00"

if j is in theDigits then set cleanedNumber to cleanedNumber & j

end repeat

set precode to (text 1 thru 4 of cleanedNumber)

if precode = "0049" then set cleanedNumber to "0" & (text 5 thru -1 of cleanedNumber)

return cleanedNumber

end CleanTheNumber

Mar 9, 2014 1:41 PM in response to ursusminor

Im having the same issue but with a Handbreak convering applescript ever since I updated to 10.2.9. I dont see the script calling 'Contacts' so Im not sure where the problem is. Can you take a look at the script and let me know?


--on adding folder items to this_folder after receiving these_items

with timeout of (720 * 60) seconds

tell application "Finder"


--Get all AVI and MKV files that have no label color yet, meaning it hasn’t been processed

set allFiles to every file of entire contents of ("Macintosh HD:users:vhaghiri:desktop:converting" as alias) whose ((name extension is "ts" or name extension is "mkv" or name extension is "avi" or name extension is "ts" or name extension is "flv" or name extension is "wmv") and label index is 0)


--Repeat for all files in above folder

repeat with i from 1 to number of items in allFiles

set currentFile to (itemi of allFiles)

try


--Set to gray label to indicate processing

set label index of currentFile to 7


--Assemble original and new file paths

set origFilepath to quoted form of POSIX path of (currentFile as alias)

set newFilepath to (characters 1 thru -5 of origFilepath as string) & "m4v'"


--Start the conversion

set shellCommand to "nice /Applications/HandBrakeCLI -Z Normal -i " & origFilepath & " -o " & newFilepath & ""


do shell scriptshellCommand


--Set the label to green in case file deletion fails

set label index of currentFile to 6


--Remove the old file

set shellCommand to "rm -f " & origFilepath


do shell scriptshellCommand

on error errmsg


--Set the label to red to indicate failure

set label index of currentFile to 2

end try

end repeat

end tell

end timeout

--end adding folder item

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Addressbook Plugin in Applescript doesn't work anymore since 10.9.2

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.