;==========================================================================================================================================; WBStudio Utility for use within WinBatch Studio debug mode.;==========================================================================================================================================;; "Spell Check" for WSPOPUP.MNU - Read/Write -;; This script does a spellcheck on Item1 and Item2 of special menu title lines of wspopup.mnu; by lookup into a keyword database with proper spell checked words.;; It works directly on the file wspopup.mnu - virtually in WBStudio editor -; but user must decide to save changes afterwards.;;..........................................................................................................................................;; >>> The running script can be terminated by pressing the Shift key. <<<;; Adapt the filepathes to your environment (see "Options - Tweak Section"); for the Wspop.mnu file and the keyword database textfile.;;..........................................................................................................................................; Version History:; 20090711. Changed StrCat() to colon ":" concatenator and beautified the code.; 20051215. Initial version.;; Detlev Dalitz.20051215.;==========================================================================================================================================;------------------------------------------------------------------------------------------------------------------------------------------Terminate(RtStatus()!=10,IntControl(1004,0,0,0,0),"Terminated. Script runs only in WinBatch Studio debug mode.");------------------------------------------------------------------------------------------------------------------------------------------;------------------------------------------------------------------------------------------------------------------------------------------; ****** Options - Tweak Section ****** adapt it to your environment ******;;sWorkFile=DirHome():"Wspopup.mnu"sLookupFile="W:\WINBATCH\WBSTUDIO\WBStudio.WspopupMnu.SpellCheck.txt";;;------------------------------------------------------------------------------------------------------------------------------------------;------------------------------------------------------------------------------------------------------------------------------------------; Set Editor AutoIndent OFF.iAutoIndent=RegQueryDword(@REGCURRENT,"Software\Wilson WindowWare\WinBatch Studio\Settings\File types\WIL Files[Autoindent]")IfiAutoIndentSendKey("!vo!a~"); Function wViewOptions() does not fit in this case.TimeDelay(1)iAutoIndent=RegQueryDword(@REGCURRENT,"Software\Wilson WindowWare\WinBatch Studio\Settings\File types\WIL Files[Autoindent]")Terminate(iAutoIndent,IntControl(1004,0,0,0,0),"Terminated. Cannot set registry value [Autoindent]=off.")EndIf;------------------------------------------------------------------------------------------------------------------------------------------wFileOpen(sWorkFile)wTopOfFile()iLineCount=wLineCount();------------------------------------------------------------------------------------------------------------------------------------------wFileOpen(sLookupFile)wTopOfFile();------------------------------------------------------------------------------------------------------------------------------------------SendKey("!wh"); Tile horizontal MDI windows in WBStudio editor. ; Function wWinTile() does not fit in this case.;------------------------------------------------------------------------------------------------------------------------------------------sHeader=TimeYmdHms():" - WSPOPUP.MNU - SpellCheck Reserved Words":@LFsExitMsg="Ready.";------------------------------------------------------------------------------------------------------------------------------------------iCountTouched=0iCountChangedItem1=0iCountChangedItem2=0iCountNotChanged=0iCountDBError=0sOut=""While@TRUEwFileOpen(sWorkFile)wClearSel(); Search within WSPOPUP.MNU for menu title lines.wf_sPattern="^.+\^.+\^.*\^.*$"; Pattern for menu title lines.wf_iForward=@TRUEwf_iMatchCase=@TRUEwf_iRegExp=@TRUEwf_iWrap=@FALSEwf_iResult=wFind(wf_sPattern,wf_iForward,wf_iMatchCase,wf_iRegExp,wf_iWrap)If!wf_iResultThenBreak; Fill selection buffer with hit line from wspopup.mnu.sPopLine=wGetWord()iLine=wGetLineNo()sLineNum=StrFixLeft(iLine,"",6);..........................................................................................................................................; Work on Item2;..........................................................................................................................................; Fetch Item2 Keyword from selection buffer.sPopLine2=ItemExtract(2,sPopLine,"^")IfStrIndex(sPopLine2,".",1,@FWDSCAN)ThenContinue; If special "long.text.line" menu title then Continue.;..........................................................................................................................................; Work on Lookup;..........................................................................................................................................wFileOpen(sLookupFile)wClearSel(); Search within lookup file.wf_sPattern="^":sPopLine2:"="wf_iForward=@TRUEwf_iMatchCase=@FALSEwf_iRegExp=@TRUEwf_iWrap=@TRUEwf_iResult=wFind(wf_sPattern,wf_iForward,wf_iMatchCase,wf_iRegExp,wf_iWrap)If!wf_iResultsMsg="??? Not found: '":sPopLine2:"'";sMsg = StrCat("`",sMsg,"`") ; "Literal Red Tag in Studio"sMsg=sLineNum:" |":sMsgsOut=ItemInsert(sMsg,-1,sOut,@LF)sPopLine=sLineNum:" |":sPopLinesOut=ItemInsert(sPopLine,-1,sOut,@LF)iCountDBError=iCountDBError+1ContinueEndIfsPopLookup=wGetWord()sPopLookup=ItemExtract(1,sPopLookup,"=");..........................................................................................................................................; Work on Item2;..........................................................................................................................................sPopLine2=sPopLookup; Store back Item2 into selection buffer.sPopLine=ItemReplace(sPopLine2,2,sPopLine,"^"); Report.If(StrCmp(sPopLine2,sPopLookup)!=0)sMsg="--- Item2 changed from: '":sPopLine2:"' to: '":sPopLookup:"'";sMsg = StrCat("`",sMsg,"`") ; "Literal Red Tag in Studio"sMsg=sLineNum:" |":sMsgsOut=ItemInsert(sMsg,-1,sOut,@LF)iCountChangedItem2=iCountChangedItem2+1EndIf;..........................................................................................................................................; Work on Item1;..........................................................................................................................................; Fetch Item1 Menu title from selection buffer.sPopLine1=ItemExtract(1,sPopLine,"^")iWild=StrIndexWild(sPopLine1,sPopLookup,1)IfiWildsWild=StrSubWild(sPopLine1,sPopLookup,iWild)If(StrCmp(sWild,sPopLookup)!=0)sPopLine1=StrReplace(sPopLine1,sWild,sPopLookup); Store back Item1 into selection buffer.sPopLine=ItemReplace(sPopLine1,1,sPopLine,"^"); Report.sMsg="--- Item1 changed from: '":sWild:"' to: '":sPopLookup:"'";sMsg = StrCat("`",sMsg,"`") ; "Literal Red Tag in Studio"sMsg=sLineNum:" |":sMsgsOut=ItemInsert(sMsg,-1,sOut,@LF)iCountChangedItem1=iCountChangedItem1+1EndIfElse; Report.sMsg="### Item1 cannot be changed by automatic. Need review.";sMsg = StrCat("`",sMsg,"`") ; "Literal Red Tag in Studio"sMsg=sLineNum:" |":sMsgsOut=ItemInsert(sMsg,-1,sOut,@LF)iCountNotChanged=iCountNotChanged+1EndIf;..........................................................................................................................................; Write back.;..........................................................................................................................................; Write back selection buffer into the file.wFileOpen(sWorkFile)wInsString(sPopLine)iCountTouched=iCountTouched+1sLineNum=StrFixLeft(iLine,"",6)sPopLine=sLineNum:" |":sPopLinesOut=ItemInsert(sPopLine,-1,sOut,@LF)sStatusMsg=iLineCount:"/":sPopLinewStatusMsg(sStatusMsg)IfIsKeyDown(@SHIFT)sExitMsg="*** Aborted. ***"BreakEndIfEndWhilewFileOpen(sLookupFile)wWinClose()wFileOpen(sWorkFile)wClearSel()wTopOfFile();------------------------------------------------------------------------------------------------------------------------------------------IfsOut!=""sOut=ItemInsert("",-1,sOut,@LF)sOut=ItemInsert(TimeYmdHms():" - Line ":iLineCount:"/":iLine,-1,sOut,@LF)sOut=ItemInsert(" - Lines touched ..: ":iCountTouched,-1,sOut,@LF)sOut=ItemInsert(" - Item1 changed ..: ":iCountChangedItem1,-1,sOut,@LF)sOut=ItemInsert(" - Item2 changed ..: ":iCountChangedItem2,-1,sOut,@LF)sOut=ItemInsert(" - Not changed ....: ":iCountNotChanged,-1,sOut,@LF)sOut=ItemInsert(" - DB Lookup Error : ":iCountDBError,-1,sOut,@LF)sOut=ItemInsert(sExitMsg,-1,sOut,@LF); Add Footer.sOut=ItemInsert(sHeader,0,sOut,@LF); Add Header.sOut=StrReplace(sOut,@LF,@CRLF)EndIf;------------------------------------------------------------------------------------------------------------------------------------------;------------------------------------------------------------------------------------------------------------------------------------------:CANCELRegSetDword(@REGCURRENT,"Software\Wilson WindowWare\WinBatch Studio\Settings\File types\WIL Files[Autoindent]",iAutoIndent);------------------------------------------------------------------------------------------------------------------------------------------wWinMaximize(); SendKey("!-x") ; Maximize MDI window in WBStudio editor.;------------------------------------------------------------------------------------------------------------------------------------------IfsOut==""ThensOut="*** No output. ***"ClipPut(sOut)wFileNew()wPaste()Exit;------------------------------------------------------------------------------------------------------------------------------------------