Mac 10.14.6
Xojo 2021 3.1
Puzzling (to me) behavior of calling AppleScript from Xojo.
I have an AppleScript that I have written that simply speaks: Hello World. I use it for testing purposes.
The name of the AppleScript is Show. I have dragged the AppleScript to the Navigator bar.
I have a button (pbTest) and in the Pressed event I have one line of code: Show. It autocompletes. But when I run the program and click on this button, nothing happens.
Now I create a module which I call TestCode. It has a single method: DoTest. DoTest contains a single line of code: Show.
Now if I put in the pressed event of *pbTest a single line of code: TestCode.DoTest it works. I hear the computer speak Hello World.
Why can I not call the AppleScript directly in the code of the button press? Why does it work just fine if I write the single line of code in a method of a module and then call this module method in the code of the button press?
Code of the button press event:
DOES NOT WORK
// TestCode.DoTest
Show
DOES WORK
TestCode.DoTest
// Show
TestCode.DoTest is a single line of code:
// just one line of code
Show