-->

AppleScriptTask throwing an error 5 - invalid proc

2019-06-03 15:47发布

问题:

I'm facing a problem on Mac 2016 Powerpoint. In my VBA module I need to run an applescript. As we cannot use MacScript anymore I followed RonDeBruin's explanation to use AppleScriptTask. My Applescript is working fine on his own but when I try to call it like this :

AppleScriptTask("hello.scpt", "myhandler", "hello")

With in my apple script

on myhandler(paramString)
say paramString
End myhandler

It gives me an error 5 - Invalid procedure call or argument

my script is placed in Library/Application Scripts/com.microsoft.Powerpoint is this path alright?

Thank you for your help

回答1:

I did get that error originally but now it works for me with your stated folder location but only after I rebooted my Mac and tried the same script with Excel:mac 2016 (I'm not sure which action is responsible for the success). Interestingly, I thought that since Microsoft is very protective of their trademarks that I originally thought that the folder name needed to be "com.microsoft.PowerPoint" but that did't work.



回答2:

I know this is an old thread but I was receiving this error and the issue was the location of my AppleScript.

I originally had it under /Library/Application Scripts/com.microsoft.Excel and I should have had it under my Library /Users/username/Library/Application Scripts/com.microsoft.Excel