// Scribe.vdm v5.1 // A Spell Checker & Thesaurus macro for Vedit for Windows 6.x // written by Scott Lambert November 2010 // see included readme.txt for installation instructions // see included manual.txt for how to use instructions // see included setup.txt for how to setup languages #60=0 // set error flag to 0 (OK) #51=num_edit_bufs // get total number of edit buffers #41=cur_pos // get current file position // test if block set ; ensure block end is set // and has a higher file position then block begin #52=block_begin // save block begin position #53=block_end // save block end position if(#52<>-1 && #53==-1) { block_end(cur_pos) // if block_end not set, assume current position #53=cur_pos } // end of if // if block selected from bottom up, switch block begin and block end positions if(#52>#53) { #78=#53 #53=#52 #52=#78 } // end of if #40=buf_num // get current buffer# if(#40>=num_edit_bufs-7) { // test for valid buffer# #60=4 // set error flag to 4 goto error4 // starting in invalid buffer#, fatal error } // end of if // establish path of scribe's files reg_set(60,&"&) reg_set(60,USER_HOME,append) // get path of user's home folder reg_set(60,"\scribe\",append) // add the macros & scribe folders to it // load some often used submacros into their t-regs // getword.vdm reg_set(61,@60) // reset to scribe path reg_set(61,"getword.vdm",append) // add getword.vdm reg_set(61,&"&,append) reg_load(93,@61) // load getword in t-reg #93 // wordchk.vdm reg_set(61,@60) // reset to scribe path reg_set(61,"wordchk.vdm",append) // add wordchk.vdm reg_set(61,&"&,append) reg_load(94,@61) // load wordchk.vdm in t-reg #94 // corrmenu.vdm reg_set(61,@60) // reset to scribe path reg_set(61,"corrmenu.vdm",append) // add corrmenu.vdm reg_set(61,&"&,append) reg_load(95,@61) // load corrmenu.vdm in t-reg #95 // set buffer numbers for internal use buffers #77=#51 // ignore this session #76=#51-1 // ignore vdf file #75=#51-2 // special dictionaries vdf files or thesaurus data file #74=#51-3 // user vdf file #73=#51-4 // main vdf file #72=#51-5 // scribe.ini #71=#51-6 // user interface #70=#51-7 // temp // clear the user interface buffer buf_switch(#71) // switch to user interface buffer buf_empty(ok) // empty it // clear the ignore this session buffer buf_switch(#77) // switch to ignore this session buffer buf_empty(ok) // empty it // give buffer a filename to enable auto-buffering reg_set(61,@60) // reset to scribe path reg_set(61,"ignorebuf.tmp",append) // add ignorebuf.tmp reg_set(61,&"&,append) file_save_as(@61,ok+nomsg) // load scribe.ini file buf_switch(#72) // switch to scribe.ini buffer buf_empty(ok) reg_set(61,@60) // reset to scribe path reg_set(61,"scribe.ini",append) // add scribe.ini reg_set(61,&"&,append) file_open(@61) // open scribe.ini file // read the scribe.ini file and configure Scribe reg_set(61,@60) // reset to scribe path reg_set(61,"iniread.vdm",append) // add iniread.vdm reg_set(61,&"&,append) call_file(98,@61) // call iniread.vdm to configure Scribe // if no block set at startup, // display main menu and process user's selection if(#52==-1 && #53==-1) { reg_set(61,@60) // reset to scribe path reg_set(61,"mainmenu.vdm",append) // add mainmenu.vdm reg_set(61,&"&,append) call_file(91,@61) // call mainmenu.vdm to display main menu } // end of if // if a block was set at startup, start automode // and skip main menu and spell check block if(#52>-1 && #53>0) { reg_set(61,@60) // reset to scribe path reg_set(61,"automode.vdm",append) // add automode.vdm reg_set(61,&"&,append) call_file(91,@61) // call automode.vdm to spell check block } // end of if // fatal error handling #60==4 :error4: if(#60==4) { // if fatal error do... buf_switch(#40) // switch to starting buffer #80 = Dialog_Input_1(62,"`Scribe Spell Checker`, `Fatal Error Encountered Most likely cause by: 1. missing file: a vdf file, etc 2. language not defined 3. missing required dictionary type (user, main, ignore) 4. starting Scribe in a buffer in the range of num_edit_bufs to num_edit_bufs-7 Scribe will now shutdown and return you to Vedit.`, `.v.c[OK]`", SCREEN+CENTER,0,0) } // end of if // Scribe shutdown // quit all internal buffers buf_switch(#70) buf_quit(ok) buf_switch(#71) buf_quit(ok) buf_switch(#72) buf_quit(ok) buf_switch(#73) buf_quit(ok) buf_switch(#74) buf_quit(ok) buf_switch(#75) buf_quit(ok) buf_switch(#76) buf_quit(ok) buf_switch(#77) buf_quit(ok) buf_switch(#40) // switch back to starting buffer block_begin(clear) // clear any block markers goto_pos(#41) // goto starting file position update() // update screen // end of macro