WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Miscellaneous

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

UltraEdit WordFile Maker


;Ultraedit wordfile maker for winbatch
;Creates a file 'winbatch_wordfile.txt' in the script path containing
;the definitions for .wbt .wed .mnu files.
;Reads the wil.clr file
; ';-' will appear as bookmarks in the function listing
;USE IT AT YOUR OWN RISK NO WARRANTIES OF ANY KIND
;Guido 08/03

exclusive(@on)

;files
clr=strcat(dirhome(),"wil.clr")
wordfile=strcat(dirget(),"winbatch_wordfile.txt")

if !fileexist(clr)
	q=askyesno("Warning",strcat("WIL.clr file not found in:",@crlf,clr,@crlf,"Browse for it?"))
	if q==@yes
		clr=askfilename("","","clr Files|*.clr|All files|*.*","",1)
	else
		exit
	endif
endif

if fileexist(wordfile)
	q=askyesno("Warning",strcat("File:",wordfile,@crlf,"Already exists, overwrite it?"))
	if q==@no then exit
endif

;ini
section="KEYWORDS"

;init wordlists
for x=97 to 122 ;A-Z
	keyword%x%=""
	extender%x%=""
	studio%x%=""
	control%x%=""
next

control35="" ;#
constant=""

;START
;open file , write header
errormode(@off)
hfile=fileopen(wordfile,"write")
;open error
if !hfile
	message("Error",strcat("File: ",wordfile,@crlf,"Could not be opened"))
endif
errormode(@on)
filewrite(hfile,'/L20"WinBatch" Line Comment = ; Nocase File Extensions = WBT WED MNU')
filewrite(hfile,'/Delimiters = %%()+=|\/{}"'' 	,.?')
filewrite(hfile,'/Indent Strings = "For" "If" "While" "Select" "#DefineFunction" "#DefineSubroutine"')
filewrite(hfile,'/Unindent Strings = "EndWhile" "EndIf" 2EndSelect" "Next" "#EndFunction" "#EndSubroutine"')
filewrite(hfile,'/Function String = "%%[^t ]++#DefineFunction ^([a-zA-Z0-9_]+*[^t ]++([, ^ta-zA-Z_0-9]++)^)"')
filewrite(hfile,'/Function String 1 = "%%[^t ]++#DefineSubroutine ^([a-zA-Z0-9_]+*[^t ]++([, ^ta-zA-Z_0-9]++)^)"')
filewrite(hfile,'/Function String 2 = "%%;-*"')

;make wordlists
boxopen("","")
boxtitle("Making wordlists..")
ta=gettickcount()
key_list=IniItemizePvt(section,clr)
key_count=itemcount(key_list,@tab)
;error 0 keys
if key_count==0
	message("Error",strcat("No keys were found in:",@crlf,clr))
	exit
endif
for x=1 to key_count 
	key=itemextract(x,key_list,@tab)
	type=IniReadPvt(section,key,"",clr)
	i=char2num(StrSub(strlower(key),1,1)) ;list index
	
	;split
	select @true 
		case type==1 ;keyword
			keyword%i%=ItemInsert(key,-1,keyword%i%," ")
			break
			
		case type=="CON" ;control
			if StriCmp(key,"definefunction")==0 || StriCmp(key,"endfunction")==0 || StriCmp(key,"definesubroutine")==0 || StriCmp(key,"endsubroutine")==0 || StriCmp(key,"include")==0
   	  	key=strcat("#",key)
				i=35 ;#
			endif
			control%i%=ItemInsert(key,-1,control%i%," ")
			break

		case type=="CONSTANT" ;constant
			constant=ItemInsert(key,-1,constant," ")
			break

		case type=="EXT" ;extender
			extender%i%=ItemInsert(key,-1,extender%i%," ")
			break

		case type=="WED" ;studio
			studio%i%=ItemInsert(key,-1,studio%i%," ")
	endselect

	boxtext("%x% of %key_count%")
next

;write file
boxtitle("Making word file..")

boxtext("Keywords..")
filewrite(hfile,'/C1"WIL Functions"')
for x=97 to 122
	if keyword%x%<>"" then filewrite(hfile,keyword%x%)
next

boxtext("Constants..")
itemsort(constant," ")
filewrite(hfile,'/C2"Constants"')
for x=1 to itemcount(constant," ")
	con=itemextract(x,constant," ")
	filewrite(hfile,strcat("@",con))
next

boxtext("Extenders..")
filewrite(hfile,'/C3"Extenders"')
for x=97 to 122
	if extender%x%<>"" then filewrite(hfile,extender%x%)
next

boxtext("Control..")
filewrite(hfile,'/C4"Control"')
if control35<>"" then filewrite(hfile,control35) ;#
for x=97 to 122
	if control%x%<>"" then filewrite(hfile,control%x%)
next
 
boxtext("Winbatch Studio..")
filewrite(hfile,'/C5"WinBatch Studio"')
for x=97 to 122
	if studio%x%<>"" then filewrite(hfile,studio%x%)
next

fileclose(hfile)

tb=gettickcount()

message("Done",strcat("File: ",wordfile,@crlf,"Created in: ",(tb-ta)/1000," seconds"))
;end script



Article ID:   W16030
File Created: 2004:03:30:15:42:20
Last Updated: 2004:03:30:15:42:20