+36
Add AppleScript support
I love to be able to script my applications, and build workflows. It would be very useful if it were possible to interact with ST2 via AppleScript. Even a simple bridge that let you execute a command (just like when you're binding keyboard shortcuts) through AppleScript would instantly expose most of the application (because of the way it is built). For example a way for a script to open a new window with two files in each pane, in a certain layout etc. (Dynamically).
Customer support service by UserEcho
This would be an awesome feature. Just having basic support so we can at least interact with the windows and application at the most basic level.
How would that work on Linux and Windows? Remember that Sublime Text is cross platform.
Well the thing is, there is some platform-specific support and code for sure. There is no reason why adding support for a platforms feature would affect the other platforms that don't support it.
This seems like something you could accomplish by writing an ST2 plugin, which either performs AppleScript evaluation itself, or just watches some local file for commands or Python statements to be placed in it; and then write something on the AppleScript side to populate that file.
No you can't. AppleScripts have to be supported in the base bundle by including a .sdef file that provides definitions for what scripting the application supports and then add this to the Info.plist for the application. Plugins can't modify this.
AppleScript needs no evaluation, just linking to variables and functions using the .sdef file. There is a standard suit of functions that are supported just by including the .sdef file, which require 0 extra code.
https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ScriptableCocoaApplications/SApps_about_apps/SAppsAboutApps.html#//apple_ref/doc/uid/TP40001976-BBCBCIJE
The easiest would be to let other applications send text commands, just like if it was typed into the Python terminal, this would let an AppleScript access all the functions and plugins and should be very simple to implement - similar to how Chrome let's you execute arbitrary Javascript through AppleScript.
Yeah, this would be awesome. I have Alfred setup to open my project directory in Sublime, but osx resizing issues when opening a second app window, so chaining an AppleScript resize onto the end would be perfect.
I understand that it doesn't make sense to build this into the core of ST2. Would it possible for a bundle to add Applescript support to ST2?
This would be a pretty wonderful enhancement.
Old Apple editors, like for example Alpha, had a great interface with a simple command through applescript (osascript). You could send an internal command to Alpha in Tcl, that was, as for ST Python is, the chosen embedded language.