2

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

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
J Moda
  • 31
  • 5

2 Answers2

3

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

MikeK
  • 43
  • 4
0

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.

Jamie Garroch - MVP
  • 2,839
  • 2
  • 16
  • 24
  • I rebooted my Mac but nothing change. Still the same error and if it works for you i really don't understand what's wrong. I will try with excel to see if it changes anything – J Moda Feb 04 '16 at 13:53
  • I've rebooted my mac, i have tried with excel and com.microsoft.Excel file but it won't work either – J Moda Feb 04 '16 at 14:02
  • 1
    did you just save the script from the editor by specifying the name without the extension? I found that it doesn't work if you add .scpt to the file name when you save or afterwards in Finder. – Jamie Garroch - MVP Feb 04 '16 at 14:40
  • I saved it directly from the editor naming it just "hello" without adding an extension – J Moda Feb 04 '16 at 15:04
  • I'm desperate here i really don't know what i am doing wrong :( – J Moda Feb 04 '16 at 16:09
  • What version are you running? Mine is 15.18 – J Moda Feb 05 '16 at 01:40
  • 1
    Just noticed the parenthesis in the call. Are you assigning to a returned value or just calling? If the later, it should be this: AppleScriptTask "hello.scpt", "myhandler", "hello" but if you add parenthesis you get a different error so it's probably not the answer. – Jamie Garroch - MVP Feb 05 '16 at 09:24
  • Also, if you edit the script from the com.microsoft.Powerpoint folder and add the test line, does it work? myhandler("hello") on myhandler(paramString) say paramString end myhandler – Jamie Garroch - MVP Feb 05 '16 at 09:27
  • Yes i am assigning it to a returned value. – J Moda Feb 05 '16 at 10:38
  • And yes it work directly from script editor with test line but not from vba – J Moda Feb 05 '16 at 10:39
  • Version 15.18 at this end. I tried retval = AppleScriptTask("hello.scpt", "myhandler", "hello") and this works for me too. I get the feeling that messing around with folder names (upper/lower case 2nd P) + trying with Excel + rebooting kicked it into action because it did not work for me first time. – Jamie Garroch - MVP Feb 05 '16 at 14:05
  • I tried a workaround launching a shell script that launches the applescript with this : Shell "Macintosh HD:Library:Application Scripts:com.microsoft.Powerpoint:test.sh" But it throws me an error 53 : file not found. Do you know anything about this? – J Moda Feb 06 '16 at 14:08