Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Using Debug to see contents of an array in Studio
For example:
If I define an array to hold address details with 5 cells - how can I use debug in WinBatch Studio to inspect the contents of each cell.
So far I have added lines to copy the array to a temp variable - so that I can see the value..
For quick use with messagebox an max. 30 elements in dim1-array:
#DefineFunction udfDumpArray(Array,Delimiter) outstr="" If (vartype(Array)<>256) then return (outstr) dimensions=ArrInfo(array,0) If (dimensions>1) then return (outstr) arrmax=ArrInfo(array,1)-1 If (arrmax<0) then return (outstr) For i=0 to arrmax outstr = ItemInsert(Array[i],-1,outstr,Delimiter) Next outstr=StrCat("Dim=",dimensions," Elements=",arrmax+1,@crlf,outstr) Return (outstr) #EndFunctionHere's an array tool which dumps the content of an array to file:
:Beauty_CollectUDFs ;collect udfs from marked area and copy them into Studio's INI file "WIL.CLR" If InStudio If wGetSelState() GotoLine = ItemExtract(1,SelInfo,@TAB) GotoCol = ItemExtract(2,SelInfo,@TAB) wClearSel() EndIf EndIf itemlist="" struct=BinaryTagInit(bb,"#DefineFunction","(") While @true struct=BinaryTagFind(struct) If (struct=="") then break item=StrTrim(BinaryTagExtr(struct,0)) itemlist=ItemInsert(item,-1,itemlist,@tab) EndWhile If (itemlist=="") Drop(GotoCol,GotoLine,item,itemlist,struct) Return EndIf :firststuff ;Is it my udf? udflist="" udfpatternlist="udf*,*udf" pcount=ItemCount(udfpatternlist,",") icount=ItemCount(itemlist,@tab) For i=1 to icount item=ItemExtract(i,itemlist,@tab) For p=1 to pcount udfpattern=ItemExtract(p,udfpatternlist,",") If (StrIndexWild(item,udfpattern,1) > 0) If (ItemLocate(item,udflist,@tab)==0) then udflist=ItemInsert(item,-1,udflist,@tab) Break EndIf Next Next udfcount=ItemCount(udflist,@tab) For i=1 to udfcount IniWritePvt("KEYWORDS",ItemExtract(i,udflist,@tab),"UDF",Strcat(DirHome(),"WIL.CLR")) Next :secondstuff ; modify color user dialog rgb1 ="Black.0,0,0" rgb2 ="Blue.0,0,255" rgb3 ="Green.0,255,0" rgb4 ="Red.255,0,0" rgb5 ="Cyan.0,255,255" rgb6 ="Yellow.255,255,0" rgb7 ="Magenta.255,0,255" rgb8 ="Dark Blue.0,0,128" rgb9 ="Dark Cyan.0,128,128" rgb10="Dark Gray.064,064,064" rgb11="Dark Green.0,160,0" rgb12="Dark Magenta.128,0,128" rgb13="Dark Red.128,0,0" rgb14="Dark Yellow/Brown.128,096,048" rgb15="Gray.128,128,128" rgb16="Light Gray.192,192,192" rgb17="Lighter Gray.221,221,221" rgblist="" dialoglist="" For i=1 to 17 rgblist=ItemInsert(ItemExtract(2,rgb%i%,"."),-1,rgblist,@tab) dialoglist=ItemInsert(ItemExtract(1,rgb%i%,"."),-1,dialoglist,@tab) Next dialoglist_save=dialoglist done=@false While !done IntControl(33,0,0,0,0) dialoglist=dialoglist_save RGBSelectFormat=`WWWDLGED,5.0` RGBSelectCaption=`UDF Color Selection` RGBSelectX=400 RGBSelectY=60 RGBSelectWidth=70 RGBSelectHeight=150 RGBSelectNumControls=4 RGBSelect01=`14,2,40,DEFAULT,STATICTEXT,DEFAULT,"Select udf color"` RGBSelect02=`0,14,70,130,ITEMBOX,dialoglist,DEFAULT` RGBSelect03=`3,135,28,DEFAULT,PUSHBUTTON,DEFAULT,"&OK",1` RGBSelect04=`35,135,30,DEFAULT,PUSHBUTTON,DEFAULT,"&Cancel",2` ButtonPushed=Dialog("RGBSelect") Select ButtonPushed Case 1 If (dialoglist<>"") dialogpos=ItemLocate(dialoglist,dialoglist_save,@tab) rgbvalue=ItemExtract(1,ItemExtract(dialogpos,rgblist,@tab),".") IniWritePvt("COLORS","UDF",rgbvalue,Strcat(DirHome(),"WIL.CLR")) done=@true EndIf break Case 2 done=@true Break EndSelect EndWhile Drop(ButtonPushed,dialoglist,dialoglist_save,dialogpos,done,i) DropWild("rgb*") :thirdstuff ;put list on top of the file itemlist="" struct=BinaryTagInit(bb,"#DefineFunction",")") While @true struct=BinaryTagFind(struct) If (struct=="") then break item=StrTrim(BinaryTagExtr(struct,0)) item=StrCat("; ",StrFix(StrCat(item,")")," ",49)," ; ",TimeYmdHms()) itemlist=ItemInsert(item,-1,itemlist,@crlf) EndWhile itemlist=StrCat(";",StrFill("-",75),@crlf,itemlist,@crlf,";",StrFill("-",75),@crlf) linecount=ItemCount(itemlist,@crlf)-1 ClipPut(itemlist) If InStudio wTopOfFile() wPaste() wGotoLine(GotoLine+linecount) wGotoCol(GotoCol) EndIf Drop(GotoCol,GotoLine,linecount,i,icount,item,itemlist,p,pattern) ; auto Drop Drop(patternlist,pcount,struct,udfcount,udflist) ; auto Drop Return
Article ID: W15017
File Created: 2001:12:24:14:08:10
Last Updated: 2001:12:24:14:08:10