Launching AppleScript using IDE Script

I have an AppleScript that I have written and finally debugged. It is intended to be used while using the Xojo IDE. Currently, I am using KeyboardMaestro to launch this AppleScript. KeyboardMaestro has a hot key assigned to a macro. The only thing that the KeyboardMaestro macro does is launch this particular AppleScript.

What I would like is to free myself from this dependance on KeyboardMaestro.

I currently have an IDE script that does a few things. I fire off that script and when it has finished, I launch manually (with the hot key) the KeyboardMaestro script to complete the intended task using AppleScript. Would I would like is to have the final command of the IDE Script be a command that launches my AppleScript.

I have not been able to figure out exactly how to do this (or whether it is doable)

Any help would be appreciated.

doCommand "osascript "


DoCommand is for those commands the IDE runs directly

I have a reply but get a message when I try to post it:

If this goes through, I am not sure why my actual reply does not…

Well, I’ve been led to water, but I still cannot drink. A little embarrassed but I will post my IDE Script. I run it, and nothing happens beyond the notification that the IDE Script itself did run.

So I presume that something is wrong with my substitution, but I have tried lots of variations and no success so I am back asking for help.

I have what I take to be the script path working in KeyboardMaestro. This path is copied from there.

When I run the IDE Script below nothing happens (except notify me that the IDE Script itself ran). The AppleScript does not.

[code] doCommand “osascript /Users/owl/Library/Mobile Documents/com~apple~ScriptEditor2/Documents/160609Experiment.scpt”

Dim allDone As String = “Finished”
Print (allDone)[/code]

Norman, I had been to that page and thanks for the reference. But that page is over my head in terms of actually knowing what the command would be to launch an AppleScript.

By the way, the reason I was getting the

message was because I had an emoji in the reply.

Back to the issue of using DoCommand to run AppleScript. Trying to deal with a simple case. One line…

osascript -e 'quit app ""'

I can paste right the above into Terminal and it does what it implies (Closes Safari)

But I cannot seem to correctly write

DoCommand osascript -e 'quit app ""'

I cannot get this to work trying various combinations of quotation marks etc. How should this be written?

Thanks for any help.

DoCommand is NOT the right way to run it
DoCommand is telling the IDE to run a command it already understands and OSAScript is NOT one of those

You want DoShellCommand as you want the OS shell object to run the OSASCRIPT application

Put this code into a new ide script in the IDE and run it

  dim s as string
  s = DoShellCommand( "osascript -e 'quit app """"' " ) 

note that each " was doubled up to “”
then you command wrapped in one set of " to enclose the whole thing

Norm, thanks for sticking with me. Kept playing with the quotation marks until it finally came together.

Dim result As String result = DoShellCommand ("osascript ""/Users/owl/Library/Mobile Documents/com~apple~ScriptEditor2/Documents/160609Experiment.scpt""")

This works as the answer to my original question.

It is long path name so it is arbitrarily wrapping, in this Xojo forum environment, at …Mobile Documents…. It is not actually a new line (although there is a space between Mobile & Documents.)

For me, being able to do this is fabulous!

The AppleScript itself is 160609Experiment.scpt, and you are passing its entire path in this formulation, and it is successful.

One can do really nice stuff with DoShellCommand and osascript.

Once upon a time I had to do a sudo shell command when building. Because DoShellCommand can’t do this I had a DoShellCommand calling a AppleScript with osascript calling a shellscript. The osascript was called “with privileges” and my password.