Difference between revisions of "Komodo Macro"

From WebOS Internals
Jump to navigation Jump to search
m
m (starting to update with documentation)
Line 21: Line 21:
 
== Deploy Functions ==
 
== Deploy Functions ==
  
A list of the deploy functions which will automatically toggle and animate the add-on to prevent conflicts. Currently arguments are not allowed with these functions, but will be added later. This means that Macros only work with the active project.
+
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">
 
<source lang="javascript">
Line 37: Line 37:
 
== Custom Deploy functions ==
 
== Custom Deploy functions ==
  
All deploy functions are asynchronous with callbacks.
+
All deploy functions are asynchronous with onSuccess and onFailure callbacks.
  
[will type this out tomorrow]
+
=== 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>

Revision as of 04:55, 15 March 2010

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>