Basically, IGOR leaves the parsing up to the programmer instead of the system. IGOR checks the intelligent assistant phrase to see if an IGOR registered keyword is found. If it is found then the whole phrase is sent to the program that registered the keyword. This gives two advantages:
Here is a piece of one of my programs. The install and remove scripts register and unregister with IGOR. The PostIgor is sent to the package that registers with IGOR.
DEFCONST('kAIAction, // the template for registering with IA { name: "Inline Action", isa: 'dyna_user_action, lexicon: [ LocObj("",'lexicon.calc), LocObj("",'lexicon.equal), LocObj("",'lexicon.about), ], }); DEFCONST( 'kTaskTemplate, // used by IA. See InstallScript in Project Data { value: "Inline Action", isa: 'task_template, primary_act: kAIAction, preconditions: ['action], signature: [kAIAction], // The post parse method is called as a method of the taskTemplate // It calls an application method with the taskTemplate as a parameter. postParse: func() begin // calling the same function as IGOR will to // process the data. (You don't have to do that) GetRoot().(kAppSymbol):PostIgor(self.origPhrase); end, }); DEFCONST( 'kPostParse, { postIgor: func(puPhrase) // IGOR will call this function begin // puPhrase will be the unprocessed string if sent from IGOR // do your IA stuff print(puPhrase); GetRoot().assistant:?Close() // close the IA slip end, }); InstallScript := func( partFrame, removeFrame ) begin GetRoot().(EnsureInternal(kAppSymbol)) := kPostParse; // for IA removeFrame.taskTemplateID := RegTaskTemplate( kTaskTemplate ); // for Igor if NOT GetGlobals().igor then getGlobals().(EnsureInternal('igor)) := {}; getGlobals().igor.(EnsureInternal(kAppSymbol)) := kAIAction.lexicon; end; RemoveScript := func( removeFrame ) begin if GetRoot().(kAppSymbol) exists then RemoveSlot(GetRoot(),kAppSymbol); // for IA if removeFrame.taskTemplateID then begin UnRegTaskTemplate( removeFrame.taskTemplateID ); removeFrame.taskTemplateID := nil; end; // for Igor RemoveSlot(getGlobals().igor,kAppSymbol); end;
Send comments to: info@catamount.com
(last modified : May 12, 1996)