Komodo Macro

From WebOS Internals
Revision as of 04:55, 15 March 2010 by Templarian (talk | contribs) (starting to update with documentation)
Jump to navigation Jump to search

Macros show up in the toolbox panel on the right hand side of the Komodo window. They can be used to automate almost everything in Komodo, and with the Komodo add-on all the functionality are extended to the macros.

Since users are use to writing javascript from their Mojo applications all macros are written in JavaScript (Python is also allowed, but not documented).

If you do not see the panel: View > Tabs & Sidebars > Toolbox.

Macro Basics

To create a new macro... [fill this in]

Add a new Macro to the Toolbox

<source lang="javascript"> komodo.assertMacroVersion(2); // Macro Version if(komodo.view && komodo.view.scintilla) {

   komodo.view.scintilla.focus(); // Sets focus

} </source>

Deploy Functions

A list of the deploy functions which will automatically toggle and animate the add-on to prevent conflicts. These cannot be modified as they function is a very specific way.

<source lang="javascript"> ko.extensions.webos.emulator.packageInstallLaunch(); ko.extensions.webos.emulator.packageInstallInspect(); ko.extensions.webos.emulator.remove(); ko.extensions.webos.emulator.launch(); ko.extensions.webos.emulator.close(); ko.extensions.webos.device.packageInstallLaunch(); ko.extensions.webos.device.remove(); ko.extensions.webos.device.launch(); ko.extensions.webos.device.close(); </source>

Custom Deploy functions

All deploy functions are asynchronous with onSuccess and onFailure callbacks.

Is Emulator Connected

The first thing you need to determine is if the emulator or device is connected.

<source lang="javascript"> ko.extensions.webos.palm.isEmulatorConnected({

   onSuccess:function()
   {
       // Emulator was found
   },
   onFailure:function()
   {
       // Emulator was not found
   }

}); </source>

Is Device Connected

<source lang="javascript"> ko.extensions.webos.palm.isDeviceConnected({

   onSuccess:function()
   {
       // Emulator was found
   },
   onFailure:function()
   {
       // Emulator was not found
   }

}); </source>