I agree. If you look at my tutorial, you may have noted that I start with
the usability of the command. It would make sense to have "sbb" command do:

sbb {from} to {destination}

Otherwise you will run into a problem when one of the stations has space in
its name. E.g.

sbb new york new jersey

Also, as for using defaults when inputs are not supplied, you will have to
do something like

get value of keyword
if empty then assign the default

I can give you the code, but then there's no learning for you. If you want
you can check the final version of the yell command described in the
tutorial here:

http://code.google.com/p/ubiquity-commands/source/browse/trunk/scripts/ubiquity-basic-search.js

look for lines numbered 48-97. Lines 83-86 have the code I am talking about.


- Mayuresh

On Wed, Nov 26, 2008 at 10:15 AM, Christian Sonne <[EMAIL PROTECTED]>wrote:

> Hi tlob,
>
> Ubiquity is meant and designed to be a (currently somewhat simple) language
> parser - thus, for it to do your work for you, you'll need to feed it a
> proper sentence...
>
> That being said, you can freely parse an incomplete sentence yourself, if
> you lose the modifier, you'll get the departure "chicago toronto", and you
> can use normal javascript to split these by the space
>
>
> On Wed, Nov 26, 2008 at 11:09 AM, tlob <[EMAIL PROTECTED]> wrote:
>
>>
>> That works, thanx
>> But I dont want to type "sbb chicago to toronto" I want type "sbb
>> chicago toronto"
>>
>>
>> CmdUtils.CreateCommand({
>>  name: "sbb",
>>  license: "CC",
>>  icon: "http://www.sbb.ch/favicon.ico";,
>>  description: "Time table for Swiss Railways",
>>  license: "CC",
>>
>>   takes: { "departure":noun_arb_text },
>>  modifiers: {"to": noun_arb_text},
>>
>>  execute: function( departure, modifiers ) {
>>
>>    var strDeparture = departure.text;
>>     /* How to set default when not giving snd input? */
>>     var strDestination = modifiers.to.text;
>>
>>    /* How to set local vars? if DE(german) then localVar=d, if FR
>> (french) then localVar=f */
>>     var strUrl = "http://fahrplan.sbb.ch/bin/query.exe/d?S="; +
>> strDeparture + "!&Z=" + strDestination + "!&start=1";
>>
>>    Utils.openUrlInBrowser( strUrl );
>>  },
>> });
>>
>>
>>
>>
>
> >
>


-- 
Mayuresh

--~--~---------~--~----~------------~-------~--~----~
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