AUTODEFINE "OFF" ' Compile as Window $INCLUDE "windowssdk.inc" $INCLUDE "ctl.inc" ' Splits "Inp$" by "Deliminator" into "RetArray" returns number of strings placed into "RetArray" DECLARE Split(Inp$:STRING,Deliminator:CHAR,RetArray:POINTER),INT DECLARE CDECL cmpFunc(a:POINTER,b:POINTER),INT CONST filename = "Colors.txt" CONST index = 2325 CONST Base_Colors = 30 :' Max number of Base Colors CONST _Base_Color = 201 :' Column where Base Color Starts CONST cBase_Color = 21 :' Field number for Base Color (0 based) CONST lBase_Color = 12 :' Length of Base Color in Chars CONST _Color = 214 :' Column where Color Name Starts CONST cColor = 22 :' Field number for Color Name (0 based) /* CONST filename = "Colors-140.txt" CONST index = 150 CONST Base_Colors = 30 :' Max number of Base Colors CONST _Base_Color = 21 :' Column where Base Color Starts CONST cBase_Color = 4 :' Field number for Base Color (0 based) CONST lBase_Color = 6 :' Length of Base Color in Chars CONST _Color = 28 :' Column where Color Name Starts CONST cColor = 5 :' Field number for Color Name (0 based) */ DEF win:WINDOW DEF win2,win3:DIALOG DEF myfile:FILE DEF sp[25]:INT DEF sp$[25]:STRING DEF changed=0,update=0,fnd=0,irgb[index,3],lb=-1,lbmax=-1,max=0,maxcntr=0:INT DEF cntr,i,j,l,rows,rr,scntr,msg,mx,my,r,g,b,clip,test,choice:INT DEF cntrf,cntrl:INT DEF mc,red,green,blue:UINT DEF sort_name[8]="BASE",h[16]:ISTRING DEF icol[16,index],ihex[16,index]:ISTRING DEF idata[index],istr[index],sdata[index],lbcol[Base_Colors],lbtext="*All",indata,saveas,header[3],path,temp:STRING DEF tmp,t:STRING DEF p1,p2:STRING DEF del=",":CHAR DEF sort_start,sort_len:INT t = "," test = 0 ENUM controls b_exit = 1000 b_next b_prev b_sort b_static1 b_listbox b_update b_chg_color b_static2 b_static3 b_listbox2 b_exit2 b_rgb b_hsl b_luma b_xyz b_lab b_de b_hsv b_base2 b_base b_name b_exit3 ENDENUM IF test = 1 THEN OPENCONSOLE ClearData() path = GETSTARTPATH IF (OPENFILE(myfile,path + filename,"R") = 0) 'skip 3 headers READ(myfile,indata) header[0] = indata READ(myfile,indata) header[1] = indata READ(myfile,indata) header[2] = indata cntr = -1 p1 = "" p2 = "" WHILE READ(myfile,indata) = 0 IF MID$(indata,1,12) = p1 AND MID$(indata,34) = p2 THEN GOTO skipit p1 = MID$(indata,1,12) p2 = MID$(indata,_COLOR+1) IF MID$(indata,_COLOR-1,1) <> "," MESSAGEBOX 0,STR$(cntr)+" "+indata,"Problem" END ENDIF cntr++ idata[cntr] = indata rows = Split(indata,del,sp) FOR rr = 0 TO rows - 1 temp = *(sp[rr]) SELECT rr ' Red CASE 0 r = VAL(temp) irgb[cntr,0] = r ' Green CASE 1 g = VAL(temp) irgb[cntr,1] = g ' Blue CASE 2 b = VAL(temp) irgb[cntr,2] = b ' Hex CASE 3 ihex[0,cntr] = temp ' Base CASE cBase_Color 'temp = RTRIM$(temp) icol[0,cntr] = temp IF lb = -1 lb++ lbcol[lb] = temp ELSE fnd = 0 FOR i = 0 TO lb IF lbcol[i] = temp fnd = 1 i = lb + 1 ENDIF NEXT i IF fnd = 0 lb++ lbcol[lb] = temp IF lb > Base_Colors MESSAGEBOX win,"Too many Base Colors","Error" END ENDIF ENDIF ENDIF ' Color CASE cColor IF cntr>0 IF ihex[0,cntr] = ihex[0,cntr-1] temp = "**" + temp ENDIF ENDIF istr[cntr] = temp 'PRINT istr[cntr],cntr ENDSELECT NEXT rr LABEL skipit ENDWHILE CLOSEFILE myfile maxcntr = cntr max = cntr ENDIF OPENWINDOW win,0,0,1300,804,0x80C80080,0,"Color Bars - RGB -"+STR$(maxcntr+1)+" defs",&handler_win SETFONT win,"Courier New",10,400 FRONTPEN win,RGB(0,0,0) BACKPEN win,RGB(255,255,255) CONTROL win,@BUTTON,"Exit",1200,10,60,25,0x50010001,b_exit CONTROL win,@BUTTON,"Next",1200,45,60,25,0x50010001,b_next CONTROL win,@BUTTON,"Prev",1200,80,60,25,0x50010001,b_prev CONTROL win,@BUTTON,"Sort",1200,115,60,25,0x50010001,b_sort CONTROL win,@STATIC,"Limit to",1159,158,60,22,0x50010001,b_static1 CONTROL win,@LISTBOX,"",1160,180,130,280,0x50800142|@CTLISTSTANDARD,b_listbox CONTROL win,@BUTTON,"Update",1200,470,60,25,0x50010001,b_update CONTROL win,@BUTTON,"Change\nColor",1200,500,60,45,0x50010001|@CTLBTNMULTI,b_chg_color CONTROL win,@STATIC,"Save as",1200,550,60,22,0x50010001,b_static2 CONTROL win,@STATIC,"*Undef",1170,570,110,22,0x50010001,b_static3 SETCONTROLCOLOR win,b_exit,RGB(0,0,0),RGB(255,0,0) 'Black, Red SETCONTROLCOLOR win,b_next,RGB(0,0,0),RGB(102,205,0) 'Black, Green SETCONTROLCOLOR win,b_prev,RGB(0,0,0),RGB(255,215,0) 'Black, Yellow SETCONTROLCOLOR win,b_sort,RGB(0,0,0),RGB(092,172,238) 'Black, Blue SETCONTROLCOLOR win,b_static1,RGB(255,0,0),RGB(0,0,0) 'Red, Black SETCONTROLCOLOR win,b_listbox,RGB(0,0,0),RGB(0,255,255) 'Black, Cyan SETCONTROLCOLOR win,b_update,RGB(0,0,0),RGB(211,211,211) 'Black, Gray SETCONTROLCOLOR win,b_chg_color,RGB(0,0,0),RGB(255,192,203) 'Black, Pink SETCONTROLCOLOR win,b_static2,RGB(255,0,0),RGB(0,0,0) 'Red, Black SETCONTROLCOLOR win,b_static3,RGB(0,0,0),RGB(0,0,0) 'Black, Black SETFONT win,"Arial",12,700,0,b_static3 lbmax = lb ADDSTRING win,b_listbox,"*All" FOR i = 0 to lbmax ADDSTRING win,b_listbox,lbcol[i] NEXT i SETSELECTED win,b_listbox,0 cntr = -1 scntr = cntr cntrf = 0 FOR i = 10 TO 1000 STEP 160 FOR j = 25 TO 750 STEP 45 cntr++ Legend(i,j,155,20,0,0,0,irgb[cntr,0],irgb[cntr,1],irgb[cntr,2], _ RTRIM$(icol[0,cntr])+":"+istr[cntr],ihex[0,cntr]) NEXT j NEXT i cntrl = cntr DispSE() SHOWWINDOW(win,@SWHIDE,b_chg_color) SHOWWINDOW(win,@SWHIDE,b_static2) SHOWWINDOW(win,@SWHIDE,b_static3) SHOWWINDOW(win2,@SWHIDE) CREATEDIALOG win2,0,0,240,360,0x80C80080,win,"Pick a Color",&handler_win2 SETFONT win2,"Arial",10,700 FRONTPEN win2,RGB(0,0,0) BACKPEN win2,RGB(255,255,255) CONTROL win2,@BUTTON,"Exit",170,10,60,25,0x50010001,b_exit2 CONTROL win2,@LISTBOX,"",10,10,150,330,0x50800142|@CTLISTSTANDARD,b_listbox2 CREATEDIALOG win3,0,0,150,360,0x80C80080,win,"Select Sort Routine",&handler_win3 CONTROL win3,@BUTTON,"rgb",50,10,60,25,0x50010001,b_rgb CONTROL win3,@BUTTON,"hsl",50,40,60,25,0x50010001,b_hsl CONTROL win3,@BUTTON,"luma",50,70,60,25,0x50010001,b_luma CONTROL win3,@BUTTON,"xyz",50,100,60,25,0x50010001,b_xyz CONTROL win3,@BUTTON,"lab",50,130,60,25,0x50010001,b_lab CONTROL win3,@BUTTON,"de",50,160,60,25,0x50010001,b_de CONTROL win3,@BUTTON,"hsv",50,190,60,25,0x50010001,b_hsv CONTROL win3,@BUTTON,"base2",50,220,60,25,0x50010001,b_base2 CONTROL win3,@BUTTON,"base",50,250,60,25,0x50010001,b_base CONTROL win3,@BUTTON,"name",50,280,60,25,0x50010001,b_name CONTROL win3,@BUTTON,"Exit",50,320,60,25,0x50010001,b_exit3 WAITUNTIL IsWindowClosed(win) IF test = 1 THEN CLOSECONSOLE END SUB handler_win(),int SELECT @CLASS CASE @IDCREATE CENTERWINDOW win CASE @IDCLOSEWINDOW CASE& @IDDESTROY CLOSEWINDOW win CASE @IDLBUTTONDN mx = @MOUSEX my = @MOUSEY IF mx > 7 AND mx < 1126 IF my > 10 AND my < 764 mc = GETPIXEL(win,mx,my) DecToRGB(mc) h = HEX$(mc) IF LEN(h) < 6 THEN h = STRING$(6-LEN(h),"0") + HEX$(mc) temp = "RGB("+USING("0###",red)+","+USING("0###",green)+","+USING("0###",blue)+") 0x"+h FOR i=0 TO max IF ihex[0,i] = "#"+h temp += " " + istr[i] i = max + 1 ENDIF NEXT i 'temp += "\n"+STR$(mx)+STR$(my) IF update = 1 UpdateRec("#" + h) ELSE msg = MESSAGEBOX win,temp,"Send to Clipboard",@MB_YESNO|@MB_ICONQUESTION IF msg = @IDYES THEN clip = SendToClipBoard(win,temp) ENDIF ENDIF ENDIF CASE @IDCONTROL SELECT @CONTROLID CASE b_listbox IF @NOTIFYCODE = @LBNSELCHANGE clearwin() SHOWWINDOW(win,@SWHIDE,b_chg_color) SHOWWINDOW(win,@SWHIDE,b_static2) SHOWWINDOW(win,@SWHIDE,b_static3) lb = GETSELECTED(win,b_listbox) lbtext = GETSTRING(win,b_listbox,lb) i = LEN(temp) ClearData() maxcntr = -1 FOR i = 0 TO max temp = idata[i] ' Base Color IF lbtext = "*All" OR lbtext = MID$(temp,_Base_Color,LEN(lbtext)) maxcntr++ sdata[maxcntr] = temp ENDIF NEXT i IF lbtext = "*All" SETCAPTION win,"Color Bars - "+sort_name+" -"+STR$(maxcntr+1)+" defs" ELSE SETCAPTION win,"Color Bars - "+sort_name+" -"+STR$(maxcntr+1)+" defs for "+lbtext ENDIF DoQsort(maxcntr) SplitRGB() 'SETCONTROLTEXT win,b_sort,sort cntr = -1 cntrf = 0 FOR i = 10 TO 1000 STEP 160 FOR j = 25 TO 750 STEP 45 cntr++ IF cntr > maxcntr i = 1010 j = 760 cntr = maxcntr ELSE IF lbtext = "*All" Legend(i,j,155,20,0,0,0,irgb[cntr,0],irgb[cntr,1],irgb[cntr,2], _ RTRIM$(icol[0,cntr])+":"+istr[cntr],ihex[0,cntr]) ELSE Legend(i,j,155,20,0,0,0,irgb[cntr,0],irgb[cntr,1],irgb[cntr,2], _ istr[cntr],ihex[0,cntr]) ENDIF ENDIF NEXT j NEXT i cntrl = cntr DispSE() IF lbtext = "*Undef" AND update = 1 SHOWWINDOW(win,@SWSHOW,b_chg_color) SHOWWINDOW(win,@SWSHOW,b_static2) SHOWWINDOW(win,@SWSHOW,b_static3) DOMODAL win2,0 ELSE SHOWWINDOW(win,@SWHIDE,b_chg_color) SHOWWINDOW(win,@SWHIDE,b_static2) SHOWWINDOW(win,@SWHIDE,b_static3) ENDIF ENDIF ' Exit CASE b_exit IF changed = 1 MESSAGEBOX 0,"Writing new file","Info" IF (OPENFILE(myfile,path + "ColorsF.txt","W")=0) FOR i = 0 TO 2 WRITE(myfile,header[i]) NEXT i FOR i = 0 TO max WRITE(myfile,idata[i]) NEXT i CLOSEFILE myfile tmp = TIME$ tmp = MID$(tmp,1,2) + "-" + MID$(tmp,4,2) + "-" + MID$(tmp,7,2) tmp = "Colors-" + DATE$("yyyy-MM-dd") + "_-_" + tmp + ".txt" IF COPYFILE(path + "Colors.txt", path + tmp, 0) = 0 MESSAGEBOX 0, path + "Colors.txt NOT copied","Info" ENDIF IF COPYFILE(path + "ColorsF.txt", path + "Colors.txt", 0) = 0 MESSAGEBOX 0, path + "ColorsF.txt NOT copied","Info" ENDIF ENDIF ENDIF CLOSEWINDOW win ' Next CASE b_next clearwin() scntr = cntr cntrf = cntr + 1 FOR i = 10 TO 1000 STEP 160 FOR j = 25 TO 750 STEP 45 cntr++ IF cntr > maxcntr i = 1010 j = 760 cntr = maxcntr ELSE IF lbtext = "*All" Legend(i,j,155,20,0,0,0,irgb[cntr,0],irgb[cntr,1],irgb[cntr,2], _ RTRIM$(icol[0,cntr])+":"+istr[cntr],ihex[0,cntr]) ELSE Legend(i,j,155,20,0,0,0,irgb[cntr,0],irgb[cntr,1],irgb[cntr,2], _ istr[cntr],ihex[0,cntr]) ENDIF ENDIF NEXT j NEXT i cntrl = cntr DispSE() ' Prev CASE b_prev clearwin() cntr = cntr - 119 - 119 IF cntr < 0 THEN cntr = -1 cntrf = cntr + 1 FOR i = 10 TO 1000 STEP 160 FOR j = 25 TO 750 STEP 45 cntr++ IF cntr > maxcntr i = 1010 j = 760 cntr = maxcntr ELSE IF lbtext = "*All" Legend(i,j,155,20,0,0,0,irgb[cntr,0],irgb[cntr,1],irgb[cntr,2], _ RTRIM$(icol[0,cntr])+":"+istr[cntr],ihex[0,cntr]) ELSE Legend(i,j,155,20,0,0,0,irgb[cntr,0],irgb[cntr,1],irgb[cntr,2], _ istr[cntr],ihex[0,cntr]) ENDIF ENDIF NEXT j NEXT i cntrl = cntr DispSE() ' Sort CASE b_sort DOMODAL win3,win IF choice=0 THEN RETURN 0 clearwin() ClearData() maxcntr = max IF sort_name = "RGB" SetCaption win,"Color Bars - RGB -"+STR$(maxcntr+1)+" defs" 'SETCONTROLCOLOR win,b_sort,RGB(0,0,0),RGB(217,217,025) 'Gold FOR i = 0 TO maxcntr sdata[i] = idata[i] NEXT i ELSE SetCaption win,"Color Bars - "+sort_name+" -"+STR$(maxcntr+1)+" defs" 'SETCONTROLCOLOR win,b_sort,RGB(0,0,0),RGB(092,172,238) 'Blue FOR i = 0 TO maxcntr temp = MID$(idata[i],sort_start,sort_len) IF sort_name = "Name" l = LEN(temp) IF l < sort_len THEN temp = temp + SPACE$(sort_len-l," ") ENDIF sdata[i] = temp + STR$(i) NEXT i ENDIF DoQsort(maxcntr) SplitRGB() 'SETCONTROLTEXT win,b_sort,sort cntr = -1 cntrf = 0 FOR i = 10 TO 1000 STEP 160 FOR j = 25 TO 750 STEP 45 cntr++ IF lbtext = "*All" Legend(i,j,155,20,0,0,0,irgb[cntr,0],irgb[cntr,1],irgb[cntr,2], _ RTRIM$(icol[0,cntr])+":"+istr[cntr],ihex[0,cntr]) ELSE Legend(i,j,155,20,0,0,0,irgb[cntr,0],irgb[cntr,1],irgb[cntr,2], _ istr[cntr],ihex[0,cntr]) ENDIF NEXT j NEXT i cntrl = cntr DispSE() ' chg Color CASE b_chg_color CASE& b_update update = 1 SHOWWINDOW(win,@SWSHOW,b_chg_color) SHOWWINDOW(win,@SWSHOW,b_static2) SHOWWINDOW(win,@SWSHOW,b_static3) DOMODAL win2,win ENDSELECT ENDSELECT RETURN 0 ENDSUB SUB handler_win2(),int SELECT @CLASS CASE @IDINITDIALOG CENTERWINDOW win2 SETFONT win2,"Arial",12,700,0,b_exit2 SETFONT win2,"Arial",12,700,0,b_listbox2 SETCONTROLCOLOR win2,b_exit2,RGB(0,0,0),RGB(255,0,0) 'Black, Red ADDSTRING win2,b_listbox2,"*Undef" FOR i = 0 to lbmax ADDSTRING win2,b_listbox2,lbcol[i] NEXT i SETSELECTED win2,b_listbox2,0 CASE @IDCLOSEWINDOW CASE& @IDDESTROY CLOSEDIALOG win2,@IDOK CASE @IDCONTROL SELECT @CONTROLID CASE b_listbox2 IF @NOTIFYCODE = @LBNSELCHANGE lb = GETSELECTED(win2,b_listbox2) saveas = GETSTRING(win2,b_listbox2,lb) SETCONTROLTEXT win,b_static3,saveas l = LEN(saveas) IF l < lBase_Color THEN saveas = saveas + STRING$(lBase_Color-l," ") CLOSEDIALOG win2,@IDOK ENDIF ' Exit CASE b_exit2 CLOSEDIALOG win2,@IDOK ENDSELECT ENDSELECT RETURN 0 ENDSUB SUB handler_win3(),int SELECT @CLASS CASE @IDINITDIALOG CENTERWINDOW win3 FOR i=b_rgb TO b_exit3 SETFONT win3,"Arial",12,700,0,i NEXT i SETCONTROLCOLOR win3,b_rgb, RGB(000,000,000),RGB(000,165,080) 'Black, Pigment Green SETCONTROLCOLOR win3,b_hsl, RGB(000,000,000),RGB(173,255,047) 'Black, GreenYellow SETCONTROLCOLOR win3,b_luma, RGB(000,000,000),RGB(238,130,238) 'Black, Violet SETCONTROLCOLOR win3,b_xyz, RGB(000,000,000),RGB(255,215,000) 'Black, Gold SETCONTROLCOLOR win3,b_lab, RGB(000,000,000),RGB(255,160,122) 'Black, LightSalmon SETCONTROLCOLOR win3,b_de, RGB(000,000,000),RGB(152,251,152) 'Black, PaleGreen SETCONTROLCOLOR win3,b_hsv, RGB(000,000,000),RGB(255,099,052) 'Black, Tomato2 SETCONTROLCOLOR win3,b_base2,RGB(000,000,000),RGB(210,180,140) 'Black, Tan SETCONTROLCOLOR win3,b_base, RGB(000,000,000),RGB(123,104,238) 'Black, MediumSlateBlue SETCONTROLCOLOR win3,b_name, RGB(000,000,000),RGB(065,105,225) 'Black, RoyalBlue SETCONTROLCOLOR win3,b_exit3,RGB(000,000,000),RGB(255,000,000) 'Black, Red CASE @IDCLOSEWINDOW CASE& @IDDESTROY choice=0 CLOSEDIALOG win3,@IDOK CASE @IDCONTROL SELECT @CONTROLID ' RGB CASE b_rgb sort_name = "RGB" sort_start = 1 sort_len = 12 choice = 1 CLOSEDIALOG win3,@IDOK ' Luma CASE b_luma sort_name = "Luma" sort_start = 54 sort_len = 10 choice = 1 CLOSEDIALOG win3,@IDOK ' XYZ CASE b_xyz sort_name = "XYZ" sort_start = 73 sort_len = 36 choice = 1 CLOSEDIALOG win3,@IDOK ' LAB CASE b_lab sort_name = "LAB" sort_start = 109 sort_len = 36 choice = 1 CLOSEDIALOG win3,@IDOK ' DE CASE b_de sort_name = "DE" sort_start = 145 sort_len = 11 choice = 1 CLOSEDIALOG win3,@IDOK ' HSV CASE b_hsv sort_name = "HSV" sort_start = 160 sort_len = 26 choice = 1 CLOSEDIALOG win3,@IDOK ' Base2 CASE b_base2 sort_name = "Base2" sort_start = 186 sort_len = 14 choice = 1 CLOSEDIALOG win3,@IDOK ' Base CASE b_base sort_name = "Base" sort_start = 201 sort_len = 12 choice = 1 CLOSEDIALOG win3,@IDOK ' Name CASE b_name sort_name = "Name" sort_start = 214 sort_len = 38 choice = 1 CLOSEDIALOG win3,@IDOK ' Exit CASE b_exit3 choice = 0 CLOSEDIALOG win3,@IDOK ENDSELECT ENDSELECT RETURN 0 ENDSUB SUB clearwin() RECT win,1,1,1290,799,rgb(255,255,255),rgb(255,255,255) RETURN ENDSUB SUB Legend(x:int,y:int,width:int,height:int,br:int,bg:int,bb:int,fr:int,fg:int,fb:int,msg:string,hex:STRING) '---------------------------------------------------------------------------------------- ' HOW TO USE: ' x, y = position ' width = width in pixels ' height = height in pixels ' br, bg, bb = border color ' fr, fg, fb = fill color ' msg = legend name '---------------------------------------------------------------------------------------- IF msg = "---" THEN RETURN RECT win,x,y,width,height,RGB(br,bg,bb),RGB(fr,fg,fb) MOVE win,x,y-18 IF INSTR(msg,"**") FRONTPEN win,RGB(255,0,0) BACKPEN win,RGB(0,255,255) ELSE FRONTPEN win,0 BACKPEN win,RGB(255,255,255) ENDIF PRINT win,msg FRONTPEN win,0 BACKPEN win,RGB(255,255,255) MOVE win,x+2,y+2 PRINT win,USING("0###",fr)+" "+USING("0###",fg)+" "+USING("0###",fb) :'+"-"+USING("###",cntr) RETURN ENDSUB SUB DoQsort(count:INT) DEF v = &sdata + 0:POINTER DEF d:INT count++ qsort(v, count, 255, &cmpFunc) IF sort_name <> "RGB" FOR d = 0 TO maxcntr r = VAL(MID$(sdata[d],sort_len+1)) sdata[d] = idata[r] NEXT d ENDIF RETURN ENDSUB SUB cmpFunc(a:POINTER,b:POINTER),INT RETURN strcmp(a, b) ENDSUB SUB ClearData() FOR i = 0 TO index - 1 irgb[i,0] = 0 irgb[i,1] = 0 irgb[i,2] = 0 ihex[0,i] = "" sdata[i] = "" istr[i] = "" icol[0,i] = "" NEXT i RETURN ENDSUB SUB SplitRGB() DEF c,m:INT FOR m = 0 TO maxcntr indata = sdata[m] r = INSTR(indata,",") IF r > 0 c = -1 DO c++ sp$[c] = MID$(indata,1,r-1) indata = MID$(indata,r+1) r = INSTR(indata,",") UNTIL r = 0 c++ sp$[c] = indata ENDIF ' Red irgb[m,0] = VAL(sp$[0]) ' Green irgb[m,1] = VAL(sp$[1]) ' Blue irgb[m,2] = VAL(sp$[2]) ' HEX ihex[0,m] = sp$[3] ' Base icol[0,m] = RTRIM$(sp$[cBase_Color]) ' Color istr[m] = sp$[cColor] NEXT m cntr = -1 RETURN ENDSUB SUB DecToRGB(decimal:UINT) '---------------------------------------------------------------------------------------- ' Returns RGB Triplet from integer ' Original idea: TexasPete ' Please note : Red,Green and Blue Must be Global and declared outside of this function '---------------------------------------------------------------------------------------- DEF GetRed,GetGreen,GetBlue:UINT ' GetRed blue = (decimal/(256*256)) green = ((decimal-blue*256*256)/256) GetRed = (decimal-blue*256*256-green*256) ' GetGreen blue = (decimal/(256*256)) GetGreen = (decimal-blue*256*256)/256 ' GetBlue GetBlue = (decimal/(256*256)) red = GetRed green = GetGreen blue = GetBlue RETURN ENDSUB SUB UpdateRec(text:STRING) DEF ii,ll:INT FOR ii = 0 TO max ll = INSTR(idata[ii],text) IF ll msg = MESSAGEBOX 0,STR$(ll)+" "+text+" - "+MID$(idata[ii],_Base_Color,lBase_Color)+"\n"+saveas+"\n\n"+MID$(idata[ii],_Color),"Update",@MB_YESNO|@MB_ICONQUESTION IF msg = @IDYES ' up to Base Color Color temp = MID$(idata[ii],1,_Base_Color-1) + saveas + MID$(idata[ii],_Color-14) idata[ii] = temp changed = 1 ENDIF ENDIF NEXT ii RETURN ENDSUB SUB DispSE() RECT win,1180,715,100,25,rgb(255,0,0),rgb(255,0,0) MOVE win,1190,720 PRINT win,"Start ", USING("####",cntrf) RECT win,1180,745,100,25,rgb(255,0,0),rgb(255,0,0) MOVE win,1190,750 PRINT win," End ", USING("####",cntrl) RETURN ENDSUB /* '---- print text to console window ----------- SUB PrintConsole(text:STRING) STATIC UINT stdout UINT charwritten IF stdout=0 OPENCONSOLE stdout=GetStdHandle(-11) SetWindowPos(FindWindow(0,__FILE__),HWND_TOPMOST,0, 0, 0, 0,SWP_NOMOVE | SWP_NOSIZE) test=1 ENDIF WriteConsole(stdout,text+"\n",len(text)+2,&charwritten,0) RETURN ENDSUB */ ' Split created by Ficko _asm Split: push ebp mov ebp, esp push esi push edi push ebx mov edi, [ebp+8] mov esi, [ebp+16] xor ecx, ecx xor ebx, ebx movzx eax, byte [ebp+12] C01:mov [esi], edi inc ebx C00:cmp byte [edi], 0 jz Exit inc ecx scasb jnz C00 lea esi, [esi+4] mov [edi-1], ah jmp C01 Exit: mov dword [esi+4], 0 ;Can be omited since we have return value. xchg eax, ebx pop ebx pop edi pop esi leave ret 0x0C _endasm