home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Computerworld Gratis 30 Hours of Connection
/
Image(2).iso
/
infovia
/
win31
/
genteach.st_
/
genteach.st
Wrap
Text File
|
1995-07-27
|
25KB
|
848 lines
<*
*>
:(mm,#!,())
:(o,,(
<***************************************************************>
<* GENTEACH.STP - WTN Teach Mode Script *>
<* *>
<* Revision History *>
<* ----------------------------------------------------------- *>
<* 26-MAR-95 (TMG) - Initial coding. Vanilla teach mode *>
<* "Alpha READY" *>
<* *>
<* Needed Functionality/Known Limitations: *>
<* *>
<* 1. If user enters incorrect username or password the first *>
<* time there is currently no way to change it without *>
<* restarting WTNVT. This is half my problem and half *>
<* WNVT's. Maybe an option to wipe the password would fix *>
<* this. *>
<* *>
<* 2. If user sends a logout command to the server or if the *>
<* user selects disconnect, the Trac interpretter is killed *>
<* and the user is not given the option to save his/her *>
<* script. *>
<* *>
<* 3. Prompt parser seems to incorrectly parse prompt in a few *>
<* instances. This is 99% reliable and should be OK for *>
<* Alpha. *>
<* *>
<* 4. Would be nice if user could manual go back and edit *>
<* prompts/responses visually. *>
<* *>
<* 5. Start over button should be implimented which *>
<* disconnect/reconnects. *>
<* *>
<* 6. Prompt recognition needs to be re-written to support *>
<* fuzzy logic. Things also need to become less lock-step. *>
<* Maybe beta 2 timeframe? *>
<* *>
<***************************************************************>
))
:(s,teach.) :(o,,<* My home *>)
:(mm,#!,( :(o,,<* Intercept TRAC responses *>)
))
:(o,,(
<***********************************************************************>
<* Tell user about teach mode. Then prompt user for the default values *>
<* for maximum timeout and the default host prompt character. *>
<***********************************************************************>
))
:(s,timer,30000) <* initialize timer to 30 seconds *>
:(s,time_seconds,:(aq,:(r,timer),1000)) <* convert to seconds *>
:(d,default_prompt) <* set default prompt *>
:(s,default_prompt,>:(bxo,20)) <* to '> ' *>
:(d,welcome_msg)
:(s,welcome_msg,(Welcome to TNVT Teach Mode!
Use Teach mode to "teach" TNVT how to connect to and respond to prompts from the remote host.
To get started, the Prompt dialog box will ask you for information, first about the maximum timeout and then for the default host prompt.
To change the maximum timeout or default prompt:
Select from the list at the bottom of the dialog box and choose OK.
--or--
Enter a new value in the text field and then choose OK.
))
:(win_message,:(r,welcome_msg))
<* ask user to define the maximum time to wait *>
:(s,time_seconds,
:(win_prompt,
(Maximum timeout default is shown below. Please confirm or change:),,
:(r,time_seconds),:(r,time_seconds),(60),(120))
)
<* ask user to define the user prompt to look for on the host *>
:(s,default_prompt,
:(win_prompt,
(Default host PROMPT is shown below. Please confirm or change:),,
:(r,default_prompt),:(r,default_prompt),(# ),(% ))
)
:(o,,(
<**********************>
<* Build key value db *>
<**********************>
))
:(mm,teach.loadkeys,(
:(d,<0>)
:(s,teach.keys.)
<* Control Keys *>
:(<0>2,(Carriage Return),(<Enter>))
:(<0>2,(Escape),(<ESC>))
:(<0>2,(NUL),(<NUL>))
:(<0>2,(BEL),(<BEL>))
:(<0>2,(BS),(<BS>))
:(<0>2,(Line Feed),(<LF>))
:(<0>2,(Form Feed),(<FF>))
:(<0>2,(DEL),(<DEL>))
<* PC Keys *>
:(<0>2,(CapsLock),(<CapsLock>))
:(<0>2,(NumLock),(<NumLock>))
:(<0>2,(ScrollLock),(<ScrollLock>))
:(<0>2,(Shift),(<Shift>))
:(<0>2,(Control),(<Control>))
:(<0>2,(Alt),(<Alt>))
:(<0>2,(Ignore key),(<Ignore key>))
:(<0>2,(Reboot),(<Reboot>))
:(<0>2,(Print Screen),(<Print Screen>))
:(<0>2,(Toggle Print),(<Toggle Print>))
<* F Keys *>
:(pc,(
:(<0>2,(F):(pn):(e,:(pn),15,( ):(tca,41)(Help):(tca,40))
:(e,:(pn),16,( ):(tca,41)(Do):(tca,40))
,(<F):(pn)(>))
),20,1)
<* Shift-F Keys *>
:(pc,(
:(<0>2,(Shift F):(pn),(<Shift F):(pn)(>))
),14,6)
:(<0>2,(Up Arrow),(<Up Arrow>))
:(<0>2,(Down Arrow),(<Down Arrow>))
:(<0>2,(Right Arrow),(<Right Arrow>))
:(<0>2,(Left Arrow),(<Left Arrow>))
:(<0>2,(Find),(<Find>))
:(<0>2,(Insert Here),(<Insert Here>))
:(<0>2,(Remove),(<Remove>))
:(<0>2,(Select),(<Select>))
:(<0>2,(Prev Screen),(<Prev Screen>))
:(<0>2,(Next Screen),(<Next Screen>))
:(pc,(
:(<0>2,(PF):(pn),(<PF):(pn)(>))
),4,1)
:(pc,(
:(<0>2,(Keypad ):(pn),(<Keypad ):(pn)(>))
),10,0)
:(<0>2,(Keypad .),(<Up Arrow>))
:(<0>2,(Keypad Enter),(<Up Arrow>))
:(<0>2,(Keypad ,),(<Up Arrow>))
:(<0>2,(Keypad -),(<Up Arrow>))
:(<0>2,(Backspace),(<Backspace>))
:(<0>2,(Delete),(<Delete>))
:(<0>2,(Compose Key),(<Compose Key>))
:(<0>2,(Up Arrow),(<Up Arrow>))
:(d,<0>2)
))
:(o,,(
<********************************>
<* Key value builder part Deuce *>
<********************************>
))
:(mm,teach.loadkeys2,(
:(s,teach.keys.num,:(aa,0:(r,teach.keys.num),1))
:(s,teach.keys.k:(r,teach.keys.num),(<1>))
:(s,teach.keys.v:(r,teach.keys.num),(<2>))
))
:(teach.loadkeys) :(o,,<* Fill key database and chuck loader *>)
:(o,,(
<*******************************************************>
<* Build db of default prompts and suggested responses *>
<*******************************************************>
))
:(mm,teach.loadprompts,(
:(d,<0>)
:(s,teach.prompts.)
:(<0>2,(login:),6,y)
:(<0>2,(username:),6,y)
:(<0>2,(userid:),6,y)
:(<0>2,(id:),6,y)
:(<0>2,(password:),7,y)
:(<0>2,:(r,default_prompt),0,y)
:(<0>2,(# ),0)
:(<0>2,(who),6)
:(<0>2,(user),6)
:(<0>2,(login),6)
:(<0>2,(logon),6)
:(<0>2,(name),6)
:(<0>2,(secret),7)
:(<0>2,(security),7)
:(<0>2,(key),7)
:(s,teach.prompts.msg0,(I am done with this teaching session.))
:(s,teach.prompts.msg1,(Abort this teaching session))
:(s,teach.prompts.msg2,(Ignore this prompt.))
:(s,teach.prompts.msg3,(Increase wait for next Prompt Dialog Box.))
:(s,teach.prompts.msg4,(Send a carriage return here.))
:(s,teach.prompts.msg5,(Send specific keys here.))
:(s,teach.prompts.msg6,(Use my username here.))
:(s,teach.prompts.msg7,(Use my password here.))
:(s,teach.prompts.msg8,(Connect to server now.))
:(s,teach.prompts.msg9,(Disconnect from server now.))
:(s,teach.prompts.nummsg,10)
:(d,<0>2)
))
:(o,,(
<****************************************>
<* Loadprompts Part Deuce-The workhorse *>
<****************************************>
))
:(mm,teach.loadprompts2,(
:(s,teach.prompts.num,:(aa,0:(r,teach.prompts.num),1))
:(s,teach.prompts.p:(r,teach.prompts.num),(<1>))
:(s,teach.prompts.d:(r,teach.prompts.num),(<2>))
:(ei,<3>,,,(
:(s,teach.prompts.e:(r,teach.prompts.num))
))
))
:(ri,teach.loadprompts) :(o,,<* Build prompt db & discard loader *>)
:(o,,(
<*********************************************>
<* Parse out the important part out a prompt *>
<* From the last CR *>
<*********************************************>
))
:(mm,teach.getprompt,(
:(s,<0>data,:(teach.iwt2)) <* Get data from strm *>
:(s,<0>data,:(r,<0>data):(bxo,0d0a))
:(tps,<0>data,0)
:(tra,<0>data,:(bxo,0d),:(bxo,0a)) <* convert CRs to LFs *>
:(tps,<0>data,0)
:(s,<0>retval) <* Start with no return value *>
:(pcd,(
<* Find next LF delimitted prompt OR exit *>
:(s,<0>temp2,:(ts,<0>data,,:(bxo,0a),(:(px))))
:(ei,:(r,<0>temp2),,,(
<* A prompt, save it if not NULL *>
:(s,<0>retval,:(r,<0>temp2))
))
),-1)
<* Reverse Prompt *>
:(d,<0>revp)
:(tps,<0>retval,0)
:(pc,(
:(s,<0>revp,:(tn,<0>retval,1):(r,<0>revp))
),:(tl,<0>retval))
<* Reverse again this time cropping more *>
:(tps,<0>revp,0)
:(d,<0>retval)
:(d,<0>pflag)
:(d,<0>xflag)
:(pc,(
:(s,<0>tchar,:(tn,<0>revp,1))
:(pc,(
:(mhi,<0>pflag,,(
:(agi,33,:(tcn,:(r,<0>tchar)),(
:(px)
))
))
:(s,<0>pflag)
:(agi,33,:(tcn,:(r,<0>tchar)),(
:(s,<0>xflag)
:(px)
))
:(s,<0>retval,:(r,<0>tchar):(r,<0>retval))
),1)
:(mhi,<0>xflag,(:(px)))
),:(tl,<0>revp))
<* Return cropped prompt *>
:(r,<0>retval)
<* Clean up *>
:(d,<0>xflag,<0>revp,<0>pflag,<0>tchar,<0>retval,<0>temp2,<0>data)
))
:(o,,(
<*****************************************************************>
<* Get input until recognized prompt or 'n' second pause in stream *>
<*****************************************************************>
))
:(mm,teach.iwt2,(
:(s,<0>timer,:(xcm)) <* Reset timer *>
:(d,teach.sugres) <* Reset suggested response *>
:(d,<0>retval) <* Clear return value *>
:(d,<0>pfound) <* Prompt found flag *>
<* Loop until we find a prompt *>
:(pcd,(
:(s,<0>tmp,:(i2)) <* Get data from stream *>
:(ei,:(r,<0>tmp),,(
<* Check For 'n' second Pause (Approx.) *>
:(agi,:(as,:(xcm),:(r,<0>timer)),:(r,timer),(
:(px)
))
),(
<* Concatanate Return Value, and Update Timer *>
:(s,<0>retval,:(r,<0>retval):(r,<0>tmp))
:(s,<0>timer,:(xcm))
<* throw away all but the last 250 bytes of retval*>
:(s, size, :(tl, <0>retval))
:(agi, :(r,size), 250, (
:(tps, <0>retval, :(r,size))
:(s, <0>tmp, :(tn, <0>retval, -250, ) )
:(tps, <0>retval, 0)
:(s, <0>retval,:(r, <0>tmp) )
)
)
<* Remove excess from <0>retval *>
:(s,<0>rtemp,:(r,<0>retval) )
:(tra,<0>rtemp,:(tca,10),:(tca,13))
:(d,<0>cr)
:(agi,:(tl,<0>rtemp),0,(
:(tps,<0>rtemp,:(as,:(tl,<0>rtemp),1))
:(ei,:(tn,<0>rtemp,1),:(tca,13),(
:(s,<0>cr)
))
))
:(mhi,<0>cr,,(:(s,<0>rtemp,:(r,<0>rtemp):(tca,13))))
:(tps,<0>rtemp,0)
:(d,<0>lps)
:(pc,(
:(s,<0>lp,:(ts,<0>rtemp,,:(tca,13),(:(px))))
:(ei,:(r,<0>lp),,,(
:(s,<0>lps,:(r,<0>lp))
))
),-1)
:(s,<0>retval,:(r,<0>lps):(mh,<0>cr,:(tca,13)))
:(d,<0>rtemp,<0>lps,<0>cr,<0>lp)
<* Look for certain prompt *>
:(pc,(
<* Search for matching prompt *>
<* Only if I am certain is prompt ext *>
:(mhi,teach.prompts.e:(pn),(
:(ttci,<0>retval,:(r,teach.
prompts.p:(pn)),(
<* Set sug response *>
:(s,teach.sugres,:(r,
teach.prompts.d
:(pn)))
:(px)
))
))
),:(r,teach.prompts.num),1) <* Looking *>
:(mhi,teach.sugres,(:(px))) <* Exit loop *>
))
),-1) <* Prompt found *>
<* Search for suggested response *>
:(mhi,teach.sugres,,(
<* Look only if no certain prompt *>
:(pc,(
:(ttci,<0>retval,:(r,teach.prompts.p:(pn)),(
<* Found suggestion *>
:(s,teach.sugres,:(r,teach.prompts.d
:(pn)))
:(px)
))
),0:(r,teach.prompts.num),1)
))
<* Return prompt *>
:(r,<0>retval)
<* Clean up *>
:(d,<0>timer,<0>tmp,<0>retval)
))
:(o,,(
<**********************************>
<* The heart and soul of genteach *>
<**********************************>
))
:(mm,teach.genteach,(
:(s,teach.script) <* Start with a blank script *>
:(teach.start_scr) <* General script filler *>
:(s,connect_pause,0) <* initialize *>
:(s,loginprompt) <* initialize variable name *>
<* if already connected, ask user for the first wtnvt command *>
<* if not connected - attempt a :(wtn_connect) first *>
:(ei, :(r,is_connected), yes,
(
:(teach.prompt_first)
),
(
:(teach.genteach8)
:(s,connect_pause,1)
)
)
<* Loop until user says to stop/abort *>
:(pcd,(
<* Get a prompt *>
:(s,<0>temp,:(teach.getprompt))
:(ei,:(r,connect_pause),1,(
:(s,loginprompt,:(r,<0>temp))
:(teach.write_pause)
),)
<* Build a win_prompt command *>
:(s,<0>prompt,(:):(tca,40)(win_prompt,):(tca,40)
(How do you respond to "):(tca,41)
(:(r,<0>temp)):(tca,40)("?):(tca,41)(,,)
:(mh,teach.sugres,(:(r,teach.prompts.msg
:(r,teach.sugres))))
:(pc,(
(,):(tca,40)
:(r,teach.prompts.msg:(pn)):(tca,41)
),:(r,teach.prompts.nummsg),0)
:(tca,41))
<* Ask the user what to do with the prompt *>
:(s,<0>temp2,:(ri,<0>prompt))
<* Reset response number *>
:(s,<0>rnum,-1)
<* See if this is a canned response *>
:(pcd,(
:(ei,:(r,<0>temp2),:(r,teach.prompts.
msg:(pn)),(
:(s,<0>rnum,:(pn))
:(px)
))
),:(r,teach.prompts.nummsg),0) <* Canned? *>
<* Check if a ctl respe (done,abort,ignore)*>
:(ei,:(e,:(r,<0>rnum),0,y):(e,:(r,<0>rnum),1,y)
:(e,:(r,<0>rnum),2,y),,(
<* Bld scrpt, chck agst prmpt *>
:(ei, :(r,connect_pause),1,,(
:(teach.write_scr,((:):(tca,40)(o,,<)
(* Waiting For Prompt "):(r,<0>temp)
(" *)(>):(tca,41)))
:(teach.write_scr,(:(teach.open)(s,teach.)
(response,):(teach.open)(teach.iwt2,)
:(tca,40):(r,<0>temp):(tca,41)
(,:(r,timer)):(teach.close):(teach.close)))
:(teach.write_scr,(:(teach.open)
(ttci,teach.response,):(tca,40)
:(r,<0>temp):(tca,41)(,):(tca,40)))
:(teach.write_scr,(:(tca,9)(:):(tca,40)(o,,<)
(* Found prompt *)(>):(tca,41)))
:(teach.write_scr,(:(tca,9)))
))))
:(ei,:(r,<0>rnum),-1,(
<* Not canned, original work! *>
<* Protect parens and gt-lt symbols *>
:(tra,<0>temp2,:(tca,40),:(tca,41)(:):(tca,40)
(tca,40):(tca,41):(tca,40))
:(tra,<0>temp2,:(tca,41),:(tca,41)(:):(tca,40)
(tca,41):(tca,41):(tca,40))
:(tra,<0>temp2,(<),:(tca,41)(:):(tca,40)(<)
:(tca,41):(tca,40))
:(tra,<0>temp2,(>),:(tca,41)(:)
:(tca,40)(>):(tca,41):(tca,40))
:(s,<0>temp2,:(tca,40):(r,<0>temp2):(tca,41))
<* Write to script *>
:(teach.write_scr,(:(tca,9):(teach.open)
(wtn_sendkeys,):(r,<0>temp2)
:(tca,40)(<Enter>):(tca,41)
:(teach.close)))
<* Send to stream *>
:(wtn_sendkeys,:(ri,<0>temp2)(<Enter>))
),(
<* Boring canned response *>
:(ri,<0>:(r,<0>rnum),<1p>)
))
:(ei,:(r,connect_pause),1,(:(s,connect_pause,0) ),
(:(ei,:(e,:(r,<0>rnum),0,y):(e,:(r,<0>rnum),1,y)
:(e,:(r,<0>rnum),2,y),,(
:(teach.write_scr,(:(tca,9)))
:(teach.write_scr,(:(tca,41)(,):(tca,40)))
:(teach.write_scr,(:(tca,9)(:):(tca,40)(o,,<)
(* Unknown prompt, get help )
(from user *)(>):(tca,41)))
:(teach.write_scr,(:(tca,9)))
:(teach.write_scr,(:(tca,9):(teach.open)
(teach.help,teach.response)
:(teach.close)))
:(teach.write_scr,(:(tca,41):(tca,41)))
:(teach.write_scr)
))))
),-1) <* Loop til user says uncle *>
<* Clean up *>
:(d,<0>temp,<0>temp2,<0>rnum,teach.sug)
:(g) <* End the script *>
))
:(mm,teach.genteach0,(
<* User says Done *>
<* Normally I would write the script here, but I don't *>
<* know the filename *>
:(fc5)
:(fg5,<1p>,(
:(win_message,(Fatal Error; cannot create file "<1p>"!))
:(g)
))
:(fw5,:(r,teach.script))
<* Always end the script when done *>
:(fw5,:(bx0,0d0a))
:(fw5,(:):(tca,40)(o,,):(tca,40))
:(fw5,(<)(*************************)(>):(bxo,0d0a))
:(fw5,(<)(* Terminate this script *)(>):(bxo,0d0a))
:(fw5,(<)(*************************)(>):(bxo,0d0a))
:(fw5,:(tca,41):(tca,41):(bxo,0d0a))
:(fw5,(:):(tca,40)(g):(tca,41):(bxo,0d0a))
:(fc5)
:(d,teach.script)
:(px)
))
:(mm,teach.genteach1,(
<* User says Abort, Do not write any scripts *>
:(d,teach.script)
:(px)
))
:(o,,(
<***************************************************>
<* Return user's username, ask for it if necessary *>
<***************************************************>
))
:(mm,teach.username,(
:(ei,:(win_username),,(
:(win_username,:(win_prompt,(Enter your username:)))
))
:(win_username)
))
:(o,,(
<***************************************************>
<* Return user's password, ask for it if necessary *>
<***************************************************>
))
:(mm,teach.passcode,(
:(ei,:(win_passcode),,(
:(win_passcode,:(win_prompt,(Enter your password:),*))
))
:(win_passcode)
))
:(mm,teach.genteach2,(
<* Ignore this prompt *>
))
:(mm,teach.genteach3,(
<* Increase timer *>
:(s,timer,:(aa,:(r,timer),5000))
))
:(mm,teach.genteach4,(
<* Send a carriage return *>
:(teach_write_scr)
:(teach.write_scr,(:(tca,9)(:):(tca,40)(o,,<)(* Send a CR *)(>)
:(tca,41)))
:(teach.write_scr,(:(tca,9):(teach.open)(wtn_sendkeys,)
:(tca,40)(<Enter>):(tca,41):(teach.close)))
:(wtn_sendkeys,(<Enter>))
))
:(mm,teach.genteach5,(
<**********************>
<* Send specific keys *>
<**********************>
:(d,<0>sendkeys)
:(d,<0>exitflag)
:(s,<0>numk,0)
:(s,<0>kpos.)
:(pcd,(
<* Prepare to build the prompt *>
:(s,<0>px,:(r,<0>sendkeys))
<* Protect the innocent TRAC delimiters *>
:(tra,<0>px,:(tca,40),:(tca,41)(:(tca,40)):(tca,40))
:(tra,<0>px,:(tca,41),:(tca,41)(:(tca,41)):(tca,40))
:(tra,<0>px,:(tca,60)(*),:(tca,41)(:(tca,60)):(tca,40)
(*))
:(tra,<0>px,(*):(tca,62),(*):(tca,41)(:(tca,62))
:(tca,40))
:(tra,<0>px,:(tca,44),:(tca,41)(:(tca,44)):(tca,40))
:(s,<0>px,:(tca,40):(r,<0>px):(tca,41))
<* Really build a prompt *>
:(s,<0>prompt,:(teach.open)(win_prompt,):(tca,40)
(Return: "):(ri,<0>px)("):(tca,41)(:(bxo,0a0d)):(tca,40)
(Send which key:):(tca,41)(,,)((I am done.),)
((Delete last key.),(I am done.),)
((Abort without sending keys.))
:(pc,(
(,):(tca,40):(r,teach.keys.k:(pn)):(tca,41)
),:(r,teach.keys.num),1)
:(tca,41))
:(d,<0>px) <* Throw away temp *>
:(s,<0>pres,:(ri,<0>prompt)) <* Prompt the user *>
:(pc,(
:(ei,:(r,<0>pres),(Delete last key.),(
<* Delete Last key *>
:(agi,:(r,<0>numk),0,(
:(tps,<0>sendkeys,:(r,<0>kpos.
:(r,<0>numk)))
:(s,<0>sendkeys,:(tpb,<0>sendkeys))
:(d,<0>kpos.:(r,<0>numk))
:(s,<0>numk,:(as,:(r,<0>numk),1))
))
:(px)
))
:(ei,:(r,<0>pres),(I am done.),(
<* Finish up *>
:(s,<0>exitflag)
:(px)
))
:(ei,:(r,<0>pres),(Abort without sending keys.),(
<* Abort *>
:(d,<0>sendkeys)
:(s,<0>exitflag)
:(px)
))
<* Store Last Position *>
:(s,<0>numk,:(aa,0:(r,<0>numk),1))
:(s,<0>kpos.:(r,<0>numk),:(tl,<0>sendkeys))
<* Get String to send *>
:(s,<0>keyv,:(r,<0>pres)) <* Default case *>
:(pcd,(
:(ei,:(r,<0>pres),:(r,teach.keys.k:(pn)),(
:(s,<0>keyv,:(r,teach.keys.v:(pn)))
:(px)
))
),:(r,teach.keys.num),1)
:(0,:(r,<0>keyv))
<* Add key to list *>
:(s,<0>sendkeys,:(r,<0>sendkeys):(r,<0>keyv))
))
:(mhi,<0>exitflag,(:(px)))
),-1)
:(agi,:(tl,<0>sendkeys),0,(
<* Protect the innocent TRAC delimiters *>
:(tra,<0>sendkeys,:(tca,40),:(tca,41)(:(tca,40)):(tca,40))
:(tra,<0>sendkeys,:(tca,41),:(tca,41)(:(tca,41)):(tca,40))
:(tra,<0>sendkeys,:(tca,60)(*),:(tca,41)(:(tca,60)):(tca,40)
(*))
:(tra,<0>sendkeys,(*):(tca,62),(*):(tca,41)(:(tca,62))
:(tca,40))
:(tra,<0>sendkeys,:(tca,44),:(tca,41)(:(tca,44)):(tca,40))
:(s,<0>sendkeys,:(tca,40):(r,<0>sendkeys):(tca,41))
:(teach_write_scr)
:(teach.write_scr,(:(tca,9)(:):(tca,40)(o,,<)
(* Send specific keys *)(>):(tca,41)))
:(teach.write_scr,(:(tca,9):(teach.open)(wtn_sendkeys,)
:(r,<0>sendkeys):(teach.close)))
:(wtn_sendkeys,:(ri,<0>sendkeys))
))
:(d,<0>prompt,<0>keynum,<0>keyval,<0>pres,<0>keyv,<0>sendkeys,
<0>exitflag,<0>numk,<0>kpos.)
))
:(mm,teach.genteach6,(
<* Username *>
<* Get username from WTN *>
:(teach_write_scr)
:(teach.write_scr,(:(tca,9)(:):(tca,40)(o,,<)(* Send username *)(>)
:(tca,41)))
:(teach.write_scr,(:(tca,9):(teach.open)(wtn_sendkeys,)
:(teach.open)(teach.username):(teach.close)
:(tca,40)(<Enter>):(tca,41):(teach.close)))
:(wtn_sendkeys,:(teach.username)(<Enter>))
))
:(mm,teach.genteach7,(
<* Password *>
<* Get password from WTN *>
:(teach_write_scr)
:(teach.write_scr,(:(tca,9)(:):(tca,40)(o,,<)(* Send password *)(>)
:(tca,41)))
:(teach.write_scr,(:(tca,9):(teach.open)(wtn_sendkeys,)
:(teach.open)(teach.passcode):(teach.close):(tca,40)
(<Enter>):(tca,41):(teach.close)))
:(wtn_sendkeys,:(teach.passcode)(<Enter>))
))
:(mm,teach.genteach8,(
<* Connect *>
:(wtn_connect)
:(teach.write_scr,(:(tca,9)(:):(tca,40)(o,,<)(* Connect to server *)
(>):(tca,41)))
:(teach.write_scr,(:(tca,9):(teach.open)(wtn_connect)
:(teach.close)))
))
:(mm,teach.genteach9,(
<* Disconnect *>
:(teach.write_scr,(:(tca,9)(:):(tca,40)(o,,<)
(* Disconnect from server *)(>):(tca,41)))
:(teach.write_scr,(:(tca,9):(teach.open)(wtn_disconnect)
:(teach.close)))
:(wtn_disconnect)
))
:(mm,teach.start_scr,(
<* Script file header *>
:(<0>w,((:):(tca,40)(o,,<)(*)
(*********************************************************************)(>)
:(tca,41)))
:(<0>w,((:):(tca,40)(o,,<)(*)
( This script was automatically generated by TNVT teach mode. *)(>)
:(tca,41)))
:(<0>w,((:):(tca,40)(o,,<)(*)
( Created: ):(xcf)( *)(>)
:(tca,41)))
:(<0>w,((:):(tca,40)(o,,<)(*)
(*********************************************************************)(>)
:(tca,41)))
:(<0>w)
<* Read common TRAC code from GENTEACH.WTN *>
:(fc5)
:(fo5,:(r,##teach_wtn),(
:(win_message,(Fatal Error; cannot open ):(r,##teach_wtn)(!))
:(g)
))
:(pcd,(
:(s,<0>temp,:(fr5,:(bxo,0a),,(:(px))))
<*:(tra,<0>temp,:(bx0,0d),)*>
<*:(tra,<0>temp,:(bxo,0a),)*>
:(teach.write_scr,(:(r,<0>temp)))
),-1)
:(fc5)
:(teach.write_scr)
))
:(o,,(
<****************************************************************************>
<* If teach mode began after login, ask user what to send initially? *>
<****************************************************************************>
))
:(mm,teach.prompt_first,(
<* ask user to define the user prompt to look for on the host *>
:(d,hostcmd)
:(s,hostcmd,
:(win_prompt,(Please enter your initial TNVT command:)) )
<* Write to script *>
:(teach.write_scr,(:(tca,9):(teach.open)
(wtn_sendkeys,):(tca,40):(r,hostcmd)<Enter>:(tca,41):(teach.close)))
<* Send to stream *>
:(wtn_sendkeys,:(r,hostcmd)(<Enter>))
))
:(o,,(
<**************************************>
<* Teach write script shortcut macros *>
<**************************************>
))
:(mm,teach.open,((:):(tca,40)))
:(mm,teach.close,(:(tca,41)))
:(mm,teach.start_scrw,(
:(teach.write_scr,(<1>))
))
:(mm,teach.write_scr,(
:(s,teach.script,:(r,teach.script)<1>:(bxo,0d0a))
))
:(mm,teach.write_pause,(
:(s,pcd_str,(wtn_receive,):(r,timer)(,):(r,loginprompt))
:(teach_write_scr)
:(teach.write_scr,(:(tca,9)(:):(tca,40)(o,,<)(* Pause till login input *)(>)
:(tca,41) ) )
:(teach.write_scr,(:(tca,9):(teach.open)
:(r,pcd_str):(teach.close)))
))
:(o,,(
<**************************************************************>
<* Le Bootstrap, called by WTN after reading in script file *>
<* <1> should contain the name of the script file to generate *>
<**************************************************************>
))
:(mm,##,(
<* send initial welcome message and information about teach mode*>
<* Get temporary output script filename *>
:(s,<0>filename,(<2p>))
:(s,<0>teach_wtn,(<1p>))
:(s,is_connected,(<3p>)) <* are we already logged in? *>
<* Start learn mode *>
:(ri,teach.genteach,:(r,<0>filename))
<* Clean up, I should never get here but it looks good *>
:(d,<0>filename)
))