Run AppleScript

newbie here. coming from applescript and auto hot key. I made a project. I added a button. HOW DO YOU MAKE THE BUTTON CLICK RUN AN APPLESCRIPT. thanks for any help.

Drag your AppleScript File to the IDE.

in Button Action write the name of your AppleScript File.

thanks but its not working. see screenshot

Write your AppleScript.
Save as file “hi.txt” to the desktop.
Drag from desktop to Xojo.
Call with method.

Here an Example

AppleScript and AppleScript as Constant

applescript lets me save as a text file but adds .applescript as the extension. I get the same exact error message in the xojo IDE. I still don’t know how to call the method. can’t thank you guys enough for trying to help me.

1 more question. IF I ever get this working and want to actually use the app, I have to pay $99, is that every year. what happens next year when I need to make changes to the app I created. do I have to pay $99 a year for life to keep this thing working.

look at my Example, you can put your AppleScript in a Constant

Constant myscript2 (string)

/usr/bin/osascript <<-EOF display dialog "Something's wrong!" buttons {"OK", "Cancel"} default button 1 display dialog "It works" buttons {"OK", "Cancel"} default button 1 EOF


dim mshell as new shell mshell.Execute myscript2

You can continue to use whatever version you have licensed as long as you want. You would only need to pay for updated versions of XOJO (i.e. to gain access to updated features, or if there are bugs that have been fixed in newer versions).

still confused about how to make this work,can you try another explanation

Does the example not work?

Is saving it as text causing an issue? I’ve always saved them as a script and never had any problem.

axel, thanks for the cool animation…now…how can I get the tutorial so it works for me

What is the content of your Applescript?

Copy it in the AppleScript-Editor and paste it here.

your myscript2 is in the wrong place.

Drag it to Window1 or write
mshell.execute App.myscript2 (if it is in App)

I am so sorry , I have no idea what you are talking about. Do I drag your code:

dim shell as new shell
mshell.Execute myscript2

to window1, what will that do.

No, drag it with the mouse

OK I did that, still not working

What is the error message?

Can You upload the project?