Apple Event Error

Hi, anyone has experienced with this error:

AppleEvents: received mach msg which wasn’t complex type as expected in getMemoryReference.

Xcode 9.2 and macOS 10.13.2 (High Sierra)

The message appears on a simple button that invokes Finder

on finestraPuliziaMostra_(sender)
		tell application "Finder"
			set numeroOriginali to count files in folder pPathOriginali
			set numeroAlteNormalizzate to count files in folder pPathAlteNormalizzate
			set numeroBasseNormalizzate to count files in folder pPathBasseNormalizzate
			set numeroGlobale to numeroOriginali + numeroAlteNormalizzate + numeroBasseNormalizzate
		end tell
		--pCounterOriginali's setStringValue:numeroOriginali
		--pCounterAlte's setStringValue:numeroAlteNormalizzate
		--pCounterBasse's setStringValue:numeroBasseNormalizzate
		--pCounterGlobale's setStringValue:numeroGlobale
		--pWindowMain's orderOut:me
		--pWindowPulizia's makeKeyAndOrderFront:me
	end finestraPuliziaMostra:

I have commented some line but error appear in the console.
Has anyone an idea? It’s a bug or can generate troubles when the app is running?

Thanks in advance


Model: MacBook Pro
Browser: Safari 604.4.7
Operating System: Mac OS X (10.13 Developer Beta 3)

I’ve seen reports of it, but I’m yet to hear of it causing problems.

Hi All,

I filed a bug months ago and eventually heard back that there were others filed on the issue. It’s still there. For me it is a problem because it fills up my logs - ok not life or death but it makes them much less readable. I also get complaints from users who worry about seeing this in console. I have substituted do shell script and OBJc methods in place of “tell application Finder” in most cases. But there is no substitute for “tell application someApp to do someThing.” I wonder if this is even on the slate to be fixed. Does Apple care about AppleScript issues these days?

But no, it doesn’t seem to cause any serious problems for me.

you could use something like:

set numOfFiles to do shell script "ls someDirectory | wc -l"

Cheers, Rob