Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Connnection is invalid -609

I sporadically get the following error when an AppleScript runs, The script always runs despite the error. What I was trying to do is: if the error (pic below) exists, say "OK" so the error goes away.


Here is the script (with much help from others)


tell application "Contacts"

set the clipboard to (vcard of people) as text

do shell script "pbpaste >~/Desktop/BAKUP/alllate.vcf"

quit "contacts"

end tell



Thanks


Posted on Sep 6, 2019 10:39 AM

Reply

Similar questions

6 replies

Sep 6, 2019 11:02 AM in response to APPLEAL

Instead of quit "contacts" use the following:


tell application "Contacts" to if it is running then quit


If you programmed your AppleScript to display its on error condition in a dialog, then you can also add the optional clause, giving up after n, where after n seconds, the dialog will automatically dismiss itself. See the display alert example in the AppleScript Language Guide.


Here is how I implement my own error handler:

set val to "A"

try
	set val to val as number
on error errmsg number errnbr
	my error_handler(errnbr, errmsg)
	return
end try
return

on error_handler(nbr, msg)
	return display alert "[ " & nbr & " ] " & msg as critical giving up after 10
end error_handler



If you didn't do the above, then AppleScript has stopped all processing and is waiting for you to click (return) that OK button. Nothing will happen until you do, so there is means to dismiss that dialog programmatically.

Sep 6, 2019 1:27 PM in response to APPLEAL

Still getting the problem with error 609 after adding: tell application "Contacts" to if it is running then quit Unfortunately, my understanding of

applescript is too remedial to invoke the specific language for error handling for this script :(( Was hoping to to have AppleScript click the "ok"box in this particular error and make it go away since the script otherwise runs.

Sep 6, 2019 2:38 PM in response to APPLEAL

Interesting. since this happens for me only in 10.14.6, but never happens in 10.13.6 There is no "simple" additional script within this script that will just make the box go away by clicking the OK button? The script ALWAYS runs correctly, but sporadically gets the -609. If the script just clicked the OK button if the -609 showed up, I think the problem would be solved.

I appreciate your patience with me.

Sep 6, 2019 3:01 PM in response to APPLEAL

On your Mojave machine, did you check System Preferences : Software Update to see if there is an Aug 29 10.14.6 Supplemental Update waiting to be applied?


As I mentioned before, AppleScript has a one-tracked mind. When it pops that dialog box, it simply will not allow any application interaction with that button. It must be pressed by you because AppleScript will not process anything until you do.


Based on that short amount of code, I cannot see any cause, or solution to that -609 dialog issue, as I cannot reproduce it here.

Connnection is invalid -609

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