nm - looks like  CmdUtils.executeCommand('email', {mesage:mail_msg},
{ to: mods.to }); worked... though does anyone else have trouble with
Ubiquity updating the code everytime?  I find I am making arbitrary
changes just to make sure the latest version was loaded in... is this
a known buy of any sort?

On Feb 26, 10:07 am, GooseusTheGreen <[email protected]> wrote:
> It did indeed work, though still not my ideal solution for now since
> there are still variables being used in the command I'm aliasing that
> I want to access and can't (ie the subject of the email).  I'm also
> having some trouble passing the message in to the execute function...
> I am trying to pass just a text string, but I think it wants an
> object:
>
> I tried:
> var mail_msg = "This is a message";
> CmdUtils.executeCommand('email', mail_msg, { to: mods.to });
>
> and
> var mail_msg = "This is a message";
> CmdUtils.executeCommand('email', {html:mail_msg}, {to: mods.to});
>
> but neither is adding my message where it should be going... the to:
> field is being filled properly though.
>
> What I meant by context was that here you have:
>
> CmdUtils.executeCommand = function executeCommand(  command,
>                           directObj,
>                           modifiersValues) {
>   return (command.constructor == String?
>     CmdUtils.getCommandByName(command) :
>     command
>   ).execute(
>     context || {},  <--- Context passed in here (?)
>     directObj,
>     modifiersValues || {}
>   );
>
> };
>
> Where you're passing the context in to the external execute command,
> but in the email example I've been using here:
>
> CmdUtils.CreateCommand({
>   name: "email",
>   takes: {"message": noun_arb_text},
>   icon: "chrome://ubiquity/skin/icons/email.png",
>   modifiers: {to: noun_type_contact},
>         /*etc*/
>   execute: function(directObj, headers) {
>     var html = directObj.html;
>
>     var document = context.focusedWindow.document;   <--- Accessed
> Here without being assigned anywhere
>
>     /*etc*/
>
> });
>
> The document variable is assigned from a context object that I didn't
> see being assigned... but the point is moot now I suppose.
>
> On Feb 26, 9:11 am, lrbabe <[email protected]> wrote:
>
> > I'm not sure to understand your questions about the context... but I'm
> > also curious if this work for your application, can you give it a try?
>
> > An alias is a wrapper around references to the external command
> > functions, it uses the previewCommand and executeCommand utils.
>
> > On Feb 26, 4:54 pm, GooseusTheGreen <[email protected]> wrote:
>
> > > Looks good, but I'm curious if this will work for my application...
> > > does the context that is passed in to the execute function
> > > automatically overwrite the external commands context or does the
> > > command author have to write that in?  Also, is an alias just a
> > > wrapper around references to the external command functions or is it a
> > > local copy of those functions?
>
> > > It seems that if the latter is the case then having a bunch of
> > > commands which are separately making aliases of other commands would
> > > bloat the command namespace... I'm wondering if it wouldn't be better
> > > to allow command authors to expose mini-command-apis for use by other
> > > commands which could then be accessed via a CmdUtils method?
>
> > > On Feb 26, 3:34 am, lrbabe <[email protected]> wrote:
>
> > > > You should have a look at my proposed additions to the API related to
> > > > alias creation, you're likely to find some answers and I'm interested
> > > > in the results you get when using it:http://gist.github.com/61752
>
> > > > On Feb 26, 4:46 am, GooseusTheGreen <[email protected]> wrote:
>
> > > > > Alright, looks like this could work so long as the command doesn't
> > > > > reference any variables in the local sandbox.
>
> > > > > for instance, I'm trying to execute the "email" command, but
> > > > > unfortunately it requires the context variable to get the document of
> > > > > the focused window.  Are there any plans to allow the email command to
> > > > > have the document passed in (along with any other needed parameters)?
> > > > > I suppose I shall just snag the necessary code for a local email
> > > > > function.  Any other interest in this sort of thing?  What are the
> > > > > feelings on command chaining?
>
> > > > > On Feb 25, 6:48 pm, GooseusTheGreen <[email protected]> wrote:
>
> > > > > > Alright, looks like these (pulled from mouse.js, suggested by atul 
> > > > > > in
> > > > > > another post of the same sort) is the functions I need.  Am I
> > > > > > correct?  Any plans to develop this functionality in to CmdUtils or
> > > > > > another library?
>
> > > > > > function getUbiquity(){
> > > > > >   var mainWindow = window.QueryInterface
> > > > > > (Components.interfaces.nsIInterfaceRequestor)
> > > > > >                      .getInterface
> > > > > > (Components.interfaces.nsIWebNavigation)
> > > > > >                      .QueryInterface
> > > > > > (Components.interfaces.nsIDocShellTreeItem)
> > > > > >                      .rootTreeItem
> > > > > >                      .QueryInterface
> > > > > > (Components.interfaces.nsIInterfaceRequestor)
> > > > > >                      .getInterface
> > > > > > (Components.interfaces.nsIDOMWindow);
>
> > > > > >   return mainWindow.gUbiquity;
>
> > > > > > }
>
> > > > > > function getCommandByName( name ) {
> > > > > >   var ubiq = getUbiquity();
> > > > > >   return ubiq.__cmdManager.__cmdSource.getCommand( name );
>
> > > > > > }
>
> > > > > > function executeCommand( commandName, mods ) {
> > > > > >   var cmd = getCommandByName( commandName );
> > > > > >   var selText = CmdUtils.getWindow().getSelection().toString();
> > > > > >   selText = selText || LAST_SEL_TEXT;
> > > > > >   LAST_SEL_TEXT = selText;
>
> > > > > >   cmd.execute( {}, {text:selText}, mods || {} );
>
> > > > > > }
>
> > > > > > On Feb 25, 6:33 pm, GooseusTheGreen <[email protected]> 
> > > > > > wrote:
>
> > > > > > > Alright, maybe I'm having trouble with my wording here.  What I'm
> > > > > > > looking to do is make a command that grabs information from a web
> > > > > > > service and then puts it in a new email to my contact.  For
> > > > > > > instance...
>
> > > > > > > get-asset-to-email (assetID) (email)
>
> > > > > > > Everything is fine, but I am not sure how to access the other 
> > > > > > > commands
> > > > > > > (ie email) from within my command... is this not possible yet?  I
> > > > > > > can't imagine being forced to rewrite the "email" command in to my
> > > > > > > command function just to do this.
>
> > > > > > > Can I maybe send a command to the ubiquity command line from 
> > > > > > > within my
> > > > > > > function?
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ubiquity-firefox" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/ubiquity-firefox?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to