Home Download Buy Blog Forum Support

How are ApplicationCommands invoked and other questions

How are ApplicationCommands invoked and other questions

Postby jktravis on Sat Oct 27, 2012 1:57 am

Hi all,

Sorry for the vagueness of the subject. I'm just not really sure for what to ask. My current enterprise uses old HomeSite scripts to do a variety of things, and I'm looking to try to reproduce some of that functionality within Sublime. Many of these scripts invoke external commands to do diffs or open files by converting the a passed URL to a file path. Out of the three objects, it seems like the sublimeplugin.ApplicationCommand is the most likely candidate from which to start, but I do not understand how to invoke such a plugin to do any testing to get started.

I have reviewed a few tutorials, but none of them seem to be what I need.

Would anyone be willing to point me to a tutorial or documentation that can help me out in this specific area?
jktravis
 
Posts: 5
Joined: Sat Oct 27, 2012 1:46 am

Re: How are ApplicationCommands invoked and other questions

Postby quarnster on Sat Oct 27, 2012 8:52 am

You can either launch it from python via sublime.run_command or you can create a key binding or create a menu entry. There's a tutorial linked from the root documentation page going into more details.
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

Re: How are ApplicationCommands invoked and other questions

Postby jktravis on Sat Oct 27, 2012 9:05 pm

I've reviewed those resources, but I still cannot figure it out. I don't have a view with which to work, so I'm confused as to how I can invoke the plugin that from the Python console built into Sublime. The tutorial shows to run the command as follows:

Code: Select all
view.run_command('hello')


I've also tried using:

Code: Select all
sublime.run_command('hello')


I've tried creating a key binding in my user file:

Code: Select all
[
   { "keys": ["super+shift+h"], "command": "hello" }
]


All I'm trying to do at the moment is to just print something to the console that doesn't use the

Code: Select all
import sublime, sublimeplugin

class HelloCommand(sublime_plugin.ApplicationCommand):
   def run(self, args):
      print "Hello"


Ultimately, I'd like to make a plugin that will prompt me for a URL that will go fetch that file based on specific parameters like drive mappings. But to get there, I need to understand how to do basic stuff like this.
jktravis
 
Posts: 5
Joined: Sat Oct 27, 2012 1:46 am

Re: How are ApplicationCommands invoked and other questions

Postby agibsonsw on Sat Oct 27, 2012 9:37 pm

It is sublime_plugin.

Also check the Console (Ctrl- ' (apostrophe)) for any error message.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: How are ApplicationCommands invoked and other questions

Postby jktravis on Sat Oct 27, 2012 11:51 pm

Bah! I should have known it was some mundane typo.

Thanks!
jktravis
 
Posts: 5
Joined: Sat Oct 27, 2012 1:46 am


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 7 guests