Sublime Forum

AppleScript

#1

Hi,

I am using Sublime Text 2 with pleasure and I have just 2 small problem with Applescript.
For information, for using AppleScript, I installed the following package : github.com/idleberg/AppleScript-Sublime-Text

  1. All my AS are saved with AS Editor as MyFile.scpt and when I open them with Sublime Text, I have an Hexa File and not the text file
    And if I wrote an AS text directly on Sublime Text and save it, it was save with MyFile.applescript but I cannot use it as a script, it is a “plain text” …

  2. I have a simply AS file with

display dialog "Hello World !"

And when I built it this message appear :

execution error: No user interaction allowed. (-1713) [Finished in 0.1s with exit code 1]
Is ther a way to have User interface activated ?

Thanks by advanced for your feedback
Sorry for my english, I am a french girl … :blush:

Thais

0 Likes

#2

I ran into some problems like this when trying to use Sublime for Applescript recently too. I’m not on a Mac right now so I can’t test any of my suggestions, but based on this helpful link (especially the “Run AppleScripts as shell scripts” section), it looks like the build system included in the package you installed should be able to run a plaintext .applescript file. The file in your list item 2 is just a plaintext .applescript file? Can you run it from the command line using /usr/bin/osascript ?

This article may also be of interest.

0 Likes

#3

[quote=“thais781”]1. All my AS are saved with AS Editor as MyFile.scpt and when I open them with Sublime Text, I have an Hexa File and not the text file
And if I wrote an AS text directly on Sublime Text and save it, it was save with MyFile.applescript but I cannot use it as a script, it is a “plain text” …
[/quote]

I’m not aware of how to solve this programmatically, maybe some Python coder could help here. However, when you save a file in the AppleScript Editor, you can choose between several file formats. The default “Script” (.scpt) will produce the problems you mentioned, while “Text” (.applescript) will let you open the file in other text editors.

[quote]2. I have a simply AS file with

display dialog "Hello World !"

And when I built it this message appear :

execution error: No user interaction allowed. (-1713) [Finished in 0.1s with exit code 1]
Is ther a way to have User interface activated ?[/quote]

This works for me, did you use the build tool of the AppleScript package? Found this and that on Stack Overflow.

0 Likes

#4

Just for the record, there’s an AppleScript to convert .scpt to .applescript

0 Likes

#5

Also for the record: as of v2.0 you can edit binary scripts using sublime-applescript (testing and reporting issues is more than welcome)

0 Likes