; もともと自分専用に単発で書いたものなので、ファイル処理の辺りが適当で遅い。 #include "hspext.as"; #include "exforce.as"; #include "multiopen.as"; #include "msgdlg.as"; #define HELPFILENAME "of_mjum.chm"; #define JPGCOMMENTFILE "jpgcomment.ini"; #define SETTINGFILENAME "of_mjum.ini"; #define INIFILENAME "comment.ini"; #define HEADEROFFSET 33; #define CHUNKALLOWED 128; #define IOERROR "ファイルの処理で問題が発生しました"; #define TMPOUTFILE "ofmjum.tmp" #define TMPCHUNKFILE "textchnk.bin" #define PROGNAME "もじうめ"; #define MSPGOTHIC "MS Pゴシック"; #define MSGOTHIC "MS ゴシック"; #define VERSION "1.01"; #define MYURL "http://imasy.jp/~mishiki/"; #define MYMAIL "mailto:mishiki@imasy.jp"; #define AUTOFILLMESSAGE "(AUTOFILL)"; #define TEXTCHUNKHEADER "tEXt"; ;;;;;;;;;;;for INI Window;;;;;;;;;;;; #define iniWinsizeX 560; #define iniWinsizeY 450; #define XOFFSET 10; #define YOFFSET 10; #define PRESETWORDSMANY 10; #define TITLETEXTP 1; #define DATETEXTP 9; #define TITLETEXTARRAYP 0; #define DATETEXTARRAYP 4; #define INISHOUDCONTAIN "#of_mjum\n#キーワードとテキストをtab文字で区切って記述します。\n#PNGの仕様上、アルファベットだけにしてください。\n#“#”から始まる行はコメントとして無視します。\n#よく分からない場合は、直接編集しないでください。\n\n" ;;;;;;;;;;;for JPG;;;;;;;;;;;;;;;;;;;; #define jpgCOM 65279; 0xfffe #define jpgSOS 56063; 0xffda #define jpgHEADEROFFSET 20; #define JPGCOMMENTALLOWED 16; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;CRC32算出モジュール ;Described by USK in 3 Jul 2000; ;Remake a little bit by Mishiki Sakana to calc only memory CRC not file. #module "crc" #define POLY32 0xEDB88320 #deffunc crc32_ini dim crc32_table, 256 repeat 256 i = cnt repeat 8 if (i&1) { ;奇数の時 i = i >> 1 & 0x7FFFFFFF ^ POLY32 } else { ;偶数の時 i = i >> 1 & 0x7FFFFFFF } loop crc32_table.cnt = i loop return #deffunc crc32_get val, val, int; mref crc, 16; mref content, 33; mref crcContentLength,2; mref status, 64 crc = 0xFFFFFFFF repeat crcContentLength ;cntバイト目のデータを得る peek c, content, cnt ;下位1バイト分だけ、今の値との排他的論理和を取る c = crc ^ c & 0xFF ;右に1バイト分論理シフトして、表との排他的論理和を得る crc = crc >> 8 & 0x00FFFFFF ^ crc32_table.c loop crc = crc ^ 0xFFFFFFFF sdim content, 1 status = 0 return #global #module "getTimeZone"; ;get timezone from Windows registry. ;written by Mishiki Sakana. ;requires hspext.dll. #deffunc getTimeZone; mref retStr,65 regkey@ 1, "System\\CurrentControlSet\\Control\\TimeZoneInformation",0; getreg@ timeBias ,"Bias"; timezoneHour=timeBias/60; timezoneMin=timeBias\60*-1; if timezoneHour < 0{ timezoneHour=timezoneHour*-1; if timezoneHour<10 { timezoneHour="0"+timezoneHour; } timezoneHour="+"+timezoneHour; } else{ if timezoneHour<10 { timezoneHour="0"+timezoneHour; } timezoneHour="-"+timezoneHour; } if timezoneMin < 10 { timezoneMin == "0"+timezoneMin; } if timeBias==0 { retStr="GMT"; } else { retStr= ""+ timezoneHour + "" + timezoneMin; } return; #global; #module "formatDate"; #deffunc formatdate val ;format HSP date/time array to RFC 1123 string. ;ex. Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123. ;written by Mishiki Sakana. getTimeZone; timezone=refstr; mref lastmod, 48; mref datestr, 65; if lastmod.8==0 : return; //とりあえず最低限のチェック dim tempint,1; sdim wkdayname,4,8; ;曜日 wkdayname="Sun","Mon","Tue","Wed","Thu","Fri","Sat"; tempint=lastmod.10; datestr=""+wkdayname.tempint; ;日 tempstr=lastmod.11; if lastmod.11<10 : tempstr="0"+lastmod.11 : else tempstr=lastmod.11; datestr+=", "+tempstr; ;月 sdim monthname,4,12; monthname="Jan","Feb","Mar","Apr","May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"; tempint=lastmod.9-1; datestr+=" "+monthname.tempint; ;年 datestr+=" "+lastmod.8; ;時 tempstr=lastmod.12; if lastmod.12<10 : tempstr="0"+lastmod.12 : else tempstr=lastmod.12; datestr+=" "+tempstr; ;分 tempstr=lastmod.13; if lastmod.13<10 : tempstr="0"+lastmod.13 : else tempstr=lastmod.13; datestr+=":"+tempstr; ;秒 tempstr=lastmod.14; if lastmod.14<10 : tempstr="0"+lastmod.14 : else tempstr=lastmod.14; datestr+=":"+tempstr; datestr+=" "+timezone; return; #global; #module "pngSigCheck"; ;check PNG file signature, the first 8bit. ;written by Mishiki Sakana. #deffunc pngSigCheck str; mref pngfilename,32; mref status,64; ;they are the signature binary dumped, and defined as constats. #define pngSig0 1196314761 #define pngSig1 169478669 exist pngfilename; if strsize<8{ status=0; return; } dim fileheader,64,1; bload pngfilename,fileheader,64,0; if (fileheader.0==pngSig0) && (fileheader.1==pngSig1){ status=1; return; } status=0; return; #global; #module "jpgSigCheck"; ;check JPEG (JFIF) file header and footer. ;written by Mishiki Sakana. #deffunc jpgSigCheck str; mref jpgfilename,32; mref status,64; ;they are the signature binary dumped, and defined as constats. #define jpgSOI 0xE0FFD8FF; #define jpgJFIF 0x4649464a; #define jpgEOI 55807 dim filesize,1; exist jpgfilename; filesize=strsize; if filesize<8{ ;最低ファイルサイズって幾つかな。最低でも 2+4+2 以下はない。 status=0; return; } sdim fileheader,64,1; dim byte,1; dim fp,1; bload jpgfilename,fileheader,64,0; repeat 4; peek byte,fileheader,fp; poke soi,cnt,byte; fp++; loop; if soi != jpgSOI { status=0; return; } fp=6; repeat 4; peek byte, fileheader,fp; poke jfif,cnt,byte; fp++; loop; if jfif != jpgJFIF { status=0; return; } ;本当はこの後のバイトがヌルであることを確認するべきなのだがめんどいのでやってない。 sdim filefooter,64,1; bload jpgfilename,filefooter,64,filesize-64; fp=62; dim eoi,1; repeat 2; peek byte,filefooter,fp; poke eoi,cnt,byte; fp++; loop; if eoi != jpgEOI { status=-1; return; } status=1; return; #global; #module ; 文字列の挿入 by Sakura; #deffunc e_replase int,str,int,int mref mesid, 0 ;mesboxのid mref rpmoji,33 ;置換(挿入)文字列 mref si, 2 ;開始位置 mref siend, 3 ;終了位置 mref stt, 64 ;stat if (mesid<0)|(mesid>63) : stt=1 : return a=si :c=siend objsend mesid,$b1,a,c,1 objsend mesid,$b7,0,c,1 objsel mesid objsend mesid,$c2,0,rpmoji,0 stt=0 return #global ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; *sysInit; onexit *sysWindowClose gosub *sysGetSetting; sdim tempstr,256,1; dim tempint,1; gosub *getwindowcolor; gosub *splitwindowcolors; sxinfo menuBarHeight, "",8,15; screen 0,dispx,dispy,0; title PROGNAME; gosub *fillappworkspace; wndstyle 1,0,0; stbset 0,$100; stbset 1; stbsize = stat; width mainWinSizeX,mainWinSizeY,mainWinPosX,mainWinPosY sdim messtr,32000,1; sdim messtradd,256,1; pos 12,4; color ButtonTextr,ButtonTextg,ButtonTextb; font MSPGOTHIC,15; print "Log Message:"; pos 10,20; messtr=""; mesbox messtr,0,0,0; objfont 0,17; pos 0,0; objsize 0,0; button "", *sysGiveFilenameForInsert; button "",*sysGiveFilenameForStrip; button "",*sysWindowClose; button "",*sysProcOpenDialog; button "",*sysShowINIEdit; button "",*sysCallExternalEditor; button "",*sysInvertBackupConf; button "",*sysShowHelp; button "",*sysShowVersion; button "",*sysInvertRemovePhotoShopExt; mmset "ファイル(&F)"; mmadd "ファイルを開く(&O)",0,4; mmadd "",0,$800; mmadd "コメントを埋め込む(&I)",0,1; mmadd "コメントを削除する(&S)",0,2; mmadd "",0,$800; mmadd "終了(&X)",0,3; mmset "編集(&E)"; mmadd "コメントの設定(&E)",1,5; mmadd "関連付けエディタでコメントを編集(&X)",1,6; mmadd "",1,$800; mmadd "バックアップファイルを作成する(&B)",1,7; mmadd "",1,$800; mmadd "PhotoShopバイナリを削除する(&P)",1,10; mmset "ヘルプ(&H)"; mmadd "トピックの検索(&H)\tF1",2,8; mmadd "",2,$800; mmadd "バージョン情報(&A)",2,9; mmchk 0,2,3; mmchk 0,3,3; if makeBackupFile : mmchk 1,3,0; if removePhotoShopExt : mmchk 1,5,0; setdnd 1; dim userEvent,9; gsel 0,1; goto *main; *sysGetSetting; dim mainWinSizeX,1 dim mainWinSizeY,1 dim mainWinPosX ,1 dim mainWinPosY ,1 dim makeBackupFile,1; dim removePhotoShopExt,1; dim filesize,1; exist SETTINGFILENAME; filesize =strsize; if filesize < 0 { gosub *sysSetDefaultSetting; return; } filesize++; sdim settingfile,filesize,1; bload SETTINGFILENAME,settingfile,filesize,0; dim tempint,1; dim eachline,256,1; sdim item,256,1; notesel settingfile; notemax maxline; repeat maxline; noteget eachline,cnt; if cnt==0 { if eachline=="[of_mjum]"{ continue; } else { gosub*sysSetDefaultSetting; break; } } getstr item,eachline,0,'='; tempint=strsize; strmid value,eachline,tempint,255; int value; if item=="mainWinSizeX" : mainWinSizeX = value; if item=="mainWinSizeY" : mainWinSizeY = value; if item=="mainWinPosX" : mainWinPosX = value; if item=="mainWinPosY" : mainWinPosY = value; if item=="makeBackupFile" : makeBackupFile = value; if item=="removePhotoShopExt" : removePhotoShopExt=value; loop dim item,1; dim settingfile,1; if mainWinSizeX> dispx : gosub *sysSetDefaultSetting : return; if mainWinSizeY> dispy : gosub *sysSetDefaultSetting : return; if mainWinPosX > dispx : gosub *sysSetDefaultSetting : return; if mainWinPosY > dispy : gosub *sysSetDefaultSetting : return; if mainWinSizeX< 0 : gosub *sysSetDefaultSetting : return; if mainWinSizeY< 0 : gosub *sysSetDefaultSetting : return; if makeBackupFile > 1 : gosub *sysSetDefaultSetting : return; if makeBackupFile < 0 : gosub *sysSetDefaultSetting : return; if removePhotoShopExt > 1 : gosub *sysSetDefaultSetting : return; if removePhotoShopExt < 0 : gosub *sysSetDefaultSetting : return; return; *sysSetDefaultSetting; mainWinSizeX=300; mainWinSizeY=320; mainWinPosX =100; mainWinPosY =100; makeBackupFile=1; removePhotoShopExt=1; return; *sysShowHelp; getkey f1key,112; if (f1key){ wait 1; goto *sysShowHelp; } exist HELPFILENAME; if strsize<1 { msgdlg "ヘルプファイルが見当たらんぞ。",PROGNAME+" のお手伝いさん",0,5; goto *main; } aplsel PROGNAME+"のお手伝いさん": if stat==0 : aplact : goto *main; exec HELPFILENAME,16; goto *main; *sysShowVersion; msgdlg PROGNAME + "\nVer. " + VERSION +"\n\n" + MYURL + "\n" + MYMAIL+"\nCopyright Mishiki Sakana 2002",PROGNAME,0,5; goto *main; *sysInvertBackupConf; if (makeBackupFile){ makeBackupFile=0; mmchk 1,3,1; } else { makeBackupFile=1; mmchk 1,3,0; } goto *main; *sysInvertRemovePhotoShopExt; if (removePhotoShopExt){ removePhotoShopExt=0; mmchk 1,5,1; } else { removePhotoShopExt=1; mmchk 1,5,0; } goto *main; *sysCallExternalEditor; exec INIFILENAME,16; goto *main; *sysPutSetting; sdim outfile,256,1; mainWinSizeX=winx+2; mainWinSizeY=winy+stbsize+2; ginfo 2; mainWinPosX = prmx; mainWinPosY = prmy; outfile="[of_mjum]\n"; outfile+="mainWinSizeX=" + mainWinSizeX +"\n"; outfile+="mainWinSizeY=" + mainWinSizeY +"\n"; outfile+="mainWinPosX=" + mainWinPosX +"\n"; outfile+="mainWinPosY=" + mainWinPosY +"\n"; outfile+="makeBackupFile=" + makeBackupFile +"\n"; outfile+="removePhotoShopExt=" +removePhotoShopExt +"\n"; dim filesize,1; strlen filesize,outfile; bsave SETTINGFILENAME ,outfile,filesize; dim outfile,1; return; *sysWindowClose; ginfo 1; activewindow=prmx; if activewindow==2 { goto *sysIniCancel; } gosub *sysPutSetting; end; *main; ;main() wait 1; ginfo 1; if prmx < 0 :goto *main; getcmd userEvent; if (userEvent.EF_DND!=0){ goto *eventProcDNDFile; } if (userEvent.EF_WSZ!=0){ goto *eventProcResizeWin; } getkey f1key,112; if (f1key){ goto *sysShowHelp; } goto *main; *eventProcResizeWin; pos 10,20; objmove 0,winx-20,winy-40-stbsize; goto *main; *sysPrintMesStr; strlen tempint,messtr; if tempint > 31500 { ; dialog "ログが大きくなり過ぎて表示できない可能性があります。パージします。",0,"ログの削除"; messtr="Log becomes too Big!! Purged.\n\n"; objprm 0,messtr; wait 1; } await 0; e_replase 0,messtradd,tempint,tempint; return; *sysResetMesstr; messtr=""; objprm 0,messtr; return; *eventProcDNDFile; dim filemany,1; filemany=userEvent.EF_DND; sdim filelist,256*filemany,1; gosub *sysResetMesstr; messtradd=""+filemany+" file(s) is/are Selected.\nChecking format...\n\n"; gosub *sysPrintMesStr; statusstr=""+filemany+" 個のファイルが選択されました"; gosub *sysStatusbarDraw; objsend id,$b6,cxScroll,cyScroll,1 gosub *sysHideSysMenu; getdnd filelist,filemany; setdnd 1; strlen filelistlen,filelist; filelistlen+=filemany+1;//改行コードの分と予備 dim seekstart,1; sdim tmpList,filelistlen,1; repeat getstr tempstr,filelist,seekstart,$0a; if strsize==0 : break; seekstart+=strsize; tmpList+=tempstr+"\n"; loop; sdim filelist,filelistlen,1; sdim pngfilelist,filelistlen,1; sdim jpgfilelist,filelistlen,1; goto *sysCheckValidPNG; *sysCheckValidPNG; notesel tmpList; sdim filename,256,1; dim pnghowmany,1; dim jpghowmany,1; dim totalhowmany,1; dim pngProceed,1; dim jpgProceed,1; dim is_png,1; dim is_jpg,1; repeat filemany; noteget filename,cnt; pngSigCheck filename; is_png=stat; jpgSigCheck filename; is_jpg=stat; if (is_png!=1) && (is_jpg !=1) : continue; if is_png==1 : pnghowmany++ : pngfilelist+=filename+"\n"; if is_jpg==1 : jpghowmany++ : jpgfilelist+=filename+"\n"; messtradd=filename+"\n"; gosub *sysPrintMesStr; await 0; loop; messtradd="\nChecked.\n"; gosub *sysPrintMesStr; await 0; gosub *sysShowSysMenu; totalhowmany=pnghowmany+jpghowmany; if totalhowmany==0 { messtradd="No File to handle.\n"; gosub *sysPrintMesStr; statusstr="扱えるファイルはありません"; gosub *sysStatusbarDraw; sdim filelist,1,1; sdim pngfilelist,1,1; sdim jpgfilelist,1,1; goto *main; } mmchk 0,2,2; mmchk 0,3,2; messtradd=""+pnghowmany+" file(s) has/have PNG Header.\n"+jpghowmany+" file(s) is/are Jpeg format.\n"; gosub *sysPrintMesStr; statusstr=""+totalhowmany+" 個の 画像 ファイル"; gosub *sysStatusbarDraw; goto *main; *sysStatusbarDraw; ; gsel 0,0; await 1; stbstr statusstr, 0; return; *sysProcOpenDialog; sdim pwd,256,1; pwd=curdir; gosub *sysHideSysMenu; dim globsize,1; globsize=20480; alloc tmpfilelist,globsize; tmpfilelist.0=globsize; fileinfo="PNGファイル(*.png)|*.png|JPGファイル(*.jpg)|*.jpg|バックアップファイル(*.bak)|*.bak|全てのファイル|*.*|"; tempstr="画像ファイルを開く"; multiopen tempstr,pwd; strlen tmpfilelist.1,fileinfo; multiopen tmpfilelist,fileinfo,1; if stat=0{ sdim tmpfilelist,1; chdir exedir; gosub *sysShowSysMenu; goto *main; } else { notesel tmpfilelist notemax filemany strlen globsize,tmpfilelist; pwd=curdir; strlen tempint,pwd; tempint=globsize+(tempint*filemany)+(filemany*2)+1;//ファイル名一覧のサイズ、パスサイズ、\マークと改行分、以上でジャストなので +1。 sdim tmpList,tempint,1; sdim filelist,tempint,1; repeat filemany sdim filename,256,1; noteget filename,cnt if filemany!=1 : filename=fileinfo+"\\"+filename; tmpList+=filename+"\n"; loop gosub *sysResetMesstr; messtradd=""+filemany+" file(s) is/are selected.\nChecking format...\n\n"; gosub *sysPrintMesStr; statusstr=""+filemany+" 個のファイルが選択されました"; gosub *sysStatusbarDraw; } dim tmpfilelist,1; ; このプログラムは、基本的に exedir だけで動いてる。 ; osakana暦を、細かな chdir する設計にしたのは愚かだった。 chdir exedir; gosub *sysShowSysMenu; goto *sysCheckValidPNG; *eventSelectFilePrompt; ;デバグ用死亡中。 dialog "変換するPNGファイル(複数可)をドロップしてください",0,"ファイルが未選択です"; return; *sysHideSysMenu; mmchk 0,-1,3; mmchk 1,-1,3; mmchk 2,-1,3; return; *sysShowSysMenu; mmchk 0,-1,2; mmchk 1,-1,2; mmchk 2,-1,2; return; *sysGiveFilenameForStrip; if totalhowmany==0 : gosub *eventSelectFilePrompt : goto *main; gosub *sysHideSysMenu; chgcursor "",2; objcursor "",2,0; if pnghowmany>0 { repeat pnghowmany; notesel pngfilelist; sdim filename,256,1; noteget filename,cnt; gosub *sysStripTextChunk; gosub *eventBreak; if escapekey : dialog "処理を中断しますか?",3,"処理の中断" : if stat!=7 : break; loop; sdim pngfilelist,1; } dim pnghowmany,1; if jpghowmany>0 { repeat jpghowmany; notesel jpgfilelist; sdim filename,256,1; noteget filename,cnt; gosub *sysJpgStripTextChunk; gosub *eventBreak; if escapekey : dialog "処理を中断しますか?",3,"処理の中断" : if stat!=7 : break; loop; sdim jpgfilelist,1; } dim jpghowmany,1; mmchk 0,2,3; mmchk 0,3,3; chgcursor "",1; objcursor "",5,0; gosub *sysShowSysMenu; statusstr="全ての処理が完了しました"; gosub *sysStatusbarDraw; goto *main; *eventBreak; await 0; getkey escapekey,27; return; *sysGiveFilenameForInsert; if totalhowmany==0 : gosub *eventSelectFilePrompt : goto *main; chgcursor "",2; objcursor "",2,0; gosub *sysHideSysMenu; if pnghowmany>0 { repeat pnghowmany; notesel pngfilelist; noteget filename,cnt; gosub *sysMakeCommentChunkFile; gosub *eventBreak; if escapekey : dialog "処理を中断しますか?",3,"処理の中断" : if stat!=7 : break; loop; sdim pngfilelist,1; } dim pnghowmany,1; if jpghowmany>0 { repeat jpghowmany; notesel jpgfilelist; noteget filename,cnt; gosub *sysMakeCommentTxtFile; gosub *eventBreak; if escapekey : dialog "処理を中断しますか?",3,"処理の中断" : if stat!=7 : break; loop; sdim jpgfilelist,1; } dim jpghowmany,1; mmchk 0,2,3; mmchk 0,3,3; chgcursor "",1; objcursor "",5,0; gosub *sysShowSysMenu; statusstr="全ての処理が完了しました"; gosub *sysStatusbarDraw; goto *main; *sysStripTextChunk; outfilename=TMPOUTFILE; dim filesize,1; exist filename; filesize=strsize if filesize<8 : dialog "No such file:\n"+filename : return; sdim filepart,filesize,1; sdim outfile,filesize,1; dim whereIsText,1; dim tempint,1; dim fatalError,1; sdim tempstr,256; tempstr=TEXTCHUNKHEADER; messtradd="Filename : "+filename+".\nFile Size : "+filesize+" byte.\n"; gosub *sysPrintMesStr; pngProceed++; statusstr=""+pngProceed+" / "+totalhowmany+" ファイルの処理中..."; gosub *sysStatusbarDraw; fp=0; dim comStartArray,CHUNKALLOWED; dim comLongArray,CHUNKALLOWED; dim totalTextChunk,1; dim byte,1; bload filename,filepart,filesize,0; fp=$8;本当は33バイト目までのフォーマットは全て同一。 ; とりあえずtEXtチャンクの位置と長さと数を探ります。 repeat; if fp>=filesize : break; if totalTextChunk == CHUNKALLOWED { dialog "チャンクが多すぎます。このソフトで処理できる限界を超えています",0,"処理の限界を超えています。"; fatalError=1; break; } dim chunksize,1; repeat 4; peek byte,filepart,fp; //4バイトを読み、チャンクのサイズを取得する; poke chunksize,3-cnt,byte; //バイトオーダ逆転させるため fp++; loop; ; messtradd="chunk size : "+chunksize+"\n"; ; gosub *sysPrintMesStr; sdim chunktype,8,1; repeat 4; peek byte,filepart,fp; //4バイトを読み、チャンクタイプを取得する; poke chunktype,cnt,byte; fp++; loop; ; messtradd="chunk type : "+chunktype+"\n"; ; gosub *sysPrintMesStr; if chunktype==TEXTCHUNKHEADER { ; print "tEXt Found!"; rmStartP=fp-8; //チャンクサイズとチャンクタイプ分 rmEndP=rmStartP+chunksize+12; //チャンクサイズとチャンクタイプとCRC分 rmLong=rmEndP-rmStartP; comStartArray.totalTextChunk=rmStartP; comLongArray.totalTextChunk=rmLong; totalTextChunk++; messtradd="#"+totalTextChunk+" tEXt chunk starts from "+rmStartP+" byte, "+rmLong+" byte long.\n"; gosub *sysPrintMesStr; await 0; } fp+=chunksize+4; //チャンクそのものとチャンクサイズ(4)・チャンクタイプ(4) + CRC(4) loop; if fatalError { fatalError=0; return; } if totalTextChunk==0 { messtradd="No tEXt chunk was found.\nSkipped.\n\n"; gosub *sysPrintMesStr; statusstr="コメントは埋め込まれていません"; gosub *sysStatusbarDraw; return; } messtradd="\nTotal "+totalTextChunk+" tEXt chunk(s).\n\nStart Stripping and Saving...\n"; gosub *sysPrintMesStr; statusstr=""+totalTextChunk+"個のコメントを削除中..."; gosub *sysStatusbarDraw; ;ブロック用ですね。 comStartArray.totalTextChunk=filesize; i=0; op=0; fp=0; newfilesize=filesize; ; print filesize; repeat totalTextChunk; newfilesize=newfilesize-comLongArray.cnt; loop; ; print newfilesize; ; print comStartArray.i; ; print comLongArray.i; repeat filesize,0; if op==newfilesize : break; if fp==comStartArray.i { fp+=comLongArray.i; i++; ; print "cnt="+cnt+" fp="+fp+" op="+op; continue; } peek byte,filepart,fp; poke outfile,op,byte; fp++; op++; loop; bsave outfilename,outfile,newfilesize; sdim filepart,1,1; sdim outfile,1,1; dim saveError,1; gosub *sysSaveFile; if saveError { gosub *sysShowProcessAbort; return; } gosub *sysShowCompleted; return; *sysJpgStripTextChunk; outfilename=TMPOUTFILE; dim byte,1; dim fp,1; dim fatalError,1; dim filesize,1; exist filename filesize = strsize; if filesize<8 : dialog "No such file:\n"+filename : return; sdim filepart,filesize+1,1; bload filename,filepart,filesize,0; dim totalTxtMarker,1; dim totalExtMarker,1; dim extExist,1; dim txtStartArray,JPGCOMMENTALLOWED,1; dim extLongArray,JPGCOMMENTALLOWED,1; dim extStartArray,JPGCOMMENTALLOWED,1; dim extLongArray,JPGCOMMENTALLOWED,1; messtradd="Filename : "+filename+".\nFile Size : "+filesize+" byte.\n"; gosub *sysPrintMesStr; jpgProceed++; tempint=jpgProceed+pngProceed statusstr=""+tempint+" / "+totalhowmany+" ファイルの処理中..."; gosub *sysStatusbarDraw; fp=20; ;ううーん、COMマーカって、幾つ存在してもいいみたいなんだなぁ。 ;でも、PNGみたいにごっつい数埋め込むことはないと判断。 repeat if fp>=filesize : break; if totalTxtMarker == JPGCOMMENTALLOWED{ dialog "マーカが多すぎます。このソフトで処理できる限界を超えています",0,"処理の限界を超えています。"; fatalError=1; break; } repeat 2; peek byte,filepart,fp; //2バイトを読み、マーカを取得する; poke markerType,cnt,byte; fp++; loop; if markerType==jpgSOS : break; SOSが始まったら捨ててしまえ。……という実装で本当に好いんだろうか。手許にはこれでダメなJPGファイルはないのだが。 repeat 2; peek byte, filepart,fp;2バイトを読み、サイズを取得する; poke markerSize,1-cnt,byte;//バイトオーダを逆転させる; fp++; loop; if markerType==jpgCOM { rmStartP=fp-4; rmEndP=rmStartP+markerSize+2; rmLong=rmEndP-rmStartP; txtStartArray.totalTxtMarker=rmStartP; txtLongArray.totalTxtMarker=rmLong; totalTxtMarker++; fp+=markerSize-2; messtradd="#"+totalTxtMarker+" comment starts from "+rmStartP+" byte, "+rmLong+" byte long.\n"; gosub *sysPrintMesStr; continue; } if (removePhotoShopExt){ ;0xffe0-1 to ffee+1 if (markerType>57598) & ( markerType<61184 ) &( markerType\256==255 ){ rmExtStartP=fp-4; rmExtEndP=rmExtStartP+markerSize+2; rmExtLong=rmExtEndP-rmExtStartP; extStartArray.totalExtMarker=rmExtStartP; extLongArray.totalExtMarker=rmExtLong; totalExtMarker++; fp+=markerSize-2; ; print "remove from "+ rmExtStartP+" to "+rmExtEndP+" fp:"+fp; messtradd="#"+totalExtMarker+" extension marker starts from "+rmExtStartP+" byte, "+rmExtLong+" byte long.\n"; gosub *sysPrintMesStr; extExist++; continue; } } fp+=markerSize-2; loop; if fatalError { fatalError=0; return; } if totalTxtMarker<1{ messtradd="No comment marker was found.\nSkipped.\n\n"; gosub *sysPrintMesStr; statusstr="コメントは埋め込まれていません"; gosub *sysStatusbarDraw; if removePhotoShopExt==0 : return; if totalExtMarker==0 : return; ; return; } messtradd="Total "+totalTxtMarker+" comment(s).\nStart Stripping and Saving...\n"; gosub *sysPrintMesStr; ; statusstr=""+totalTxtMarker+"個のコメントを削除中..."; ; gosub *sysStatusbarDraw; txtStartArray.totalTxtMarker=filesize; extStartArray.totalExtMarker=filesize; newfilesize=filesize; repeat totalTxtMarker; newfilesize-=txtLongArray.cnt; loop; if (removePhotoShopExt==1){ repeat totalExtMarker; newfilesize-=extLongArray.cnt; loop; } sdim outfile,filesize,1; dim i,1; dim j,1; dim op,1; dim fp,1; repeat filesize,0; if op==newfilesize : break; if fp==txtStartArray.j{ fp+=txtLongArray.j j++; continue; } if (removePhotoShopExt){ if fp==extStartArray.i { fp+=extLongArray.i; ; print "cnt="+cnt+" fp="+fp+" op="+op; i++; continue; } } peek byte,filepart,fp; poke outfile,op,byte; fp++; op++; loop; bsave outfilename,outfile,newfilesize; dim filepart,1; dim outfile,1; gosub *sysSaveFile; gosub *sysShowCompleted; return; *sysShowCompleted; messtradd="Done. \nNew File Size : "+newfilesize+" byte.\n\n"; gosub *sysPrintMesStr; statusstr="処理が完了しました"; gosub *sysStatusbarDraw; return; *sysShowProcessAbort; messtradd="\n\nPROCESS ABORTED!!\n\n\n"; gosub *sysPrintMesStr; statusstr="このファイルの処理を中断しました"; gosub *sysStatusbarDraw; return; *sysSaveFile; dim lastmod,24; saveError=1; fxtget lastmod,filename; ;//バックアップファイルのReadOnlyチェック if (makeBackupFile){ tempstr=filename+".bak" exist tempstr; if strsize>=0 : { fxaget tempint, tempstr; tempint=tempint\2; if tempint{ dialog "バックアップ用のファイルへ書き込みができません。このファイルの処理を中止します。オリジナルのファイルは一切変更していません。",1,IOERROR; return; } } } ;//画像ファイルのreadonlyチェック dim fileAttrib,1; fxaget fileAttrib, filename; ; dialog "でばこ"+fileAttrib; tempint=fileAttrib \ 2; if tempint{ dialog "ファイル "+filename+" の書き込みが禁止されています。制限を解除して処理を続けますか?",3,IOERROR; if stat==7 { dialog "このファイルの処理を中止します。",1,IOERROR; return; } ; dialog "でばこ"+fileAttrib; fxaset filename,fileAttrib-1; //OKならReadOnlyを外す if stat { dialog "書き込み禁止制限を解除できません。",1,IOERROR; return; } } ;//旧世代のバックアップ用ファイルを消す。 if (makeBackupFile){ exist filename+".bak"; if strsize>0{ skiperr 1; delete filename+".bak"; if err==12{ dialog "バックアップ用のファイルの上書き処理中に何らかの問題が発生しました。オリジナルのファイルは一切変更していません。このファイルの処理を中止します。",1,IOERROR; skiperr 0; return; } skiperr 0; } } ;//画像ファイルをバックアップ用ファイルにコピー if (makeBackupFile){ sxcopy filename,filename+".bak",1; if stat{ dialog "バックアップファイルの作成に失敗しました。このファイルの処理を中止します。オリジナルのファイルは一切変更していません。",1,IOERROR; return; } } ;//オリジナルの画像ファイルを削除する else { skiperr 1; delete filename; if err==12{ dialog "オリジナルのファイルの上書き中に何らかの問題が発生し、アクセスが拒絶されました。オリジナルのファイルは変更できません。このファイルの処理を中止します。",1,IOERROR; skiperr 0; return; } skiperr 0; } ;//一時画像をオリジナルの名前でコピーする sxcopy outfilename,filename,0,0; if stat{ dialog "ファイル "+filename+" の保存に失敗しました。ファイルシステムに問題があるかもしれません。\n画像ファイルは "+exedir+"\\"+outfilename+" という名前で一時保存されています。このファイルの処理を中止します。",1,IOERROR; return; } ;//タイムスタンプを書き戻す fxtset lastmod, filename; ;//テンポラリファイルを消す skiperr 1; delete outfilename; if err==12 { dialog "テンポラリファイルの処理に失敗しました。アクセス権等の処理を確認してください。このファイルの処理を中止します。",1,IOERROR; skiperr 0; return } skiperr 0; saveError=0; return; *getMarkerLen; dim markerlen,1; strlen markerlen, markerall; tempint=markerlen-2; poke markerall,0,0xFF; poke markerall,1,0xFE; repeat 2; peek byte, tempint,cnt poke markerall,3-cnt,byte; loop; return; *sysMakeCommentTxtFile exist filename; if strsize<8 : dialog "No such file:\n"+filename : return; messtradd="Process "+filename+"...\n"; gosub *sysPrintMesStr; jpgProceed++; tempint=jpgProceed+pngProceed statusstr=""+tempint+" / "+totalhowmany+" ファイルの処理中..."; gosub *sysStatusbarDraw; ; sdim tempstr,256,1; dim markerlen,1; exist JPGCOMMENTFILE; filesize=strsize; if filesize > 0 { sdim markerall,filesize+16,1; bload JPGCOMMENTFILE,markerall,filesize; strlen markerlen, markerall; markerlen+=2; markerall="...."+markerall; gosub *getMarkerLen; } else{ dim filesize,1; exist INIFILENAME; if strsize<1 { gosub *makeDefaultINI; exist INIFILENAME; } filesize=strsize+1; sdim,markerall,filesize+256; markerall="...." ;//マーカタイプとサイズの4文字分を突っ込んでおく。 sdim inifile,filesize,1; bload INIFILENAME,inifile,filesize,0; dim inilinecount,1; dim byte,1; notesel inifile; notemax inilinecount; repeat inilinecount; sdim commarker,256,1; noteget commarker,cnt; peek byte,commarker,0; if byte==$23 : continue; if byte=="" : continue; gosub *string2marker loop; sdim inifile,1,1; gosub *getMarkerLen; } outfilename=TMPOUTFILE; messtradd="Start Saving...."; gosub *sysPrintMesStr; sdim infile,64,1; bload filename,infile,64,0; bsave outfilename,infile,64; bsave outfilename,markerall,markerlen,jpgHEADEROFFSET; exist filename; filesize=strsize; sdim infile,filesize,1; bload filename,infile,filesize,jpgHEADEROFFSET; bsave outfilename,infile, filesize-jpgHEADEROFFSET, jpgHEADEROFFSET+markerlen; gosub *sysSaveFile if saveError { gosub *sysShowProcessAbort; return; } exist filename; newfilesize=strsize; gosub *sysShowCompleted sdim infile,1,1; sdim markerall,1,1; sdim commarker,1,1; return; *sysMakeCommentChunkFile; exist filename; if strsize<8 : dialog "No such file:\n"+filename : return; messtradd="Process "+filename+"...\n"; gosub *sysPrintMesStr; pngProceed++; statusstr=""+pngProceed+" / "+totalhowmany+" ファイルの処理中..."; gosub *sysStatusbarDraw; sdim tempstr,256,1; dim fp,1; dim filesize,1; exist INIFILENAME; if strsize<1 { gosub *makeDefaultINI; exist INIFILENAME; } filesize=strsize+1; sdim,comchunkall,filesize+1024; sdim inifile,filesize,1; bload INIFILENAME,inifile,filesize,0; dim inilinecount,1; dim byte,1; notesel inifile; notemax inilinecount; repeat inilinecount; sdim comchunk,256,1; dim chunklen,1; noteget comchunk,cnt; peek byte,comchunk,0; if byte==$23 : continue; if byte=="" : continue; gosub *string2chunk loop; sdim inifile,1,1; messtradd="Saving Chunks File..."; gosub *sysPrintMesStr; await 1; bsave TMPCHUNKFILE, comchunkall,fp; messtradd="DONE.\n"; gosub *sysPrintMesStr; outfilename=TMPOUTFILE; messtradd="Start Saving...."; gosub *sysPrintMesStr; sdim infile,64,1; bload filename,infile,64,0; bsave outfilename,infile,64; bsave outfilename,comchunkall,fp,HEADEROFFSET; exist filename; filesize=strsize; sdim infile,filesize,1; bload filename,infile,filesize,HEADEROFFSET; bsave outfilename,infile, filesize-HEADEROFFSET, HEADEROFFSET+fp; gosub *sysSaveFile if saveError { gosub *sysShowProcessAbort; return; } delete TMPCHUNKFILE; exist filename; newfilesize=strsize; gosub *sysShowCompleted sdim infile,1,1; sdim comchunkall,1,1; sdim comchunk,1,1; return; *string2marker; messtradd=commarker; gosub *sysPrintMesStr; sdim markertitle,80,1; getstr markertitle, commarker, 0,$09; tempint=strsize; markerall+="["+markertitle+"]\n"; strmid tempstr,commarker, tempint,256; if markertitle=="Title"{ if tempstr==AUTOFILLMESSAGE { sdim tempstr,256,1; extract tempstr,filename,0; extract tempstr,"",6; messtradd=" is expanded to\n"+"Title\t"+tempstr; gosub *sysPrintMesStr; } } if markertitle=="Creation Time"{ if tempstr==AUTOFILLMESSAGE { dim lastmod,24; fxtget lastmod,filename; formatDate lastmod; tempstr=refstr; messtradd=" is expanded to\n"+"Creation Time\t"+tempstr; gosub *sysPrintMesStr; } } markerall+=tempstr+"\n\n"; sdim markertitle,1,1; messtradd="\n"; gosub *sysPrintMesStr; return; *string2chunk; messtradd=comchunk; await 0; comchunk=TEXTCHUNKHEADER+comchunk; gosub *sysPrintMesStr; strlen chunklen,comchunk; getstr tempstr, comchunk, 0,$09; insertNullPoint=strsize; if TEXTCHUNKHEADER+"Title"==tempstr { getstr tempstr, comchunk, insertNullPoint, 256; if tempstr==AUTOFILLMESSAGE { sdim tempstr,256,1; sdim comchunk,256,1; extract tempstr,filename,0; extract tempstr,"",6; comchunk="Title"+"\t"+tempstr; messtradd=" is expanded to\n"+comchunk; gosub *sysPrintMesStr; comchunk=TEXTCHUNKHEADER+comchunk; strlen chunklen,comchunk; insertNullPoint=10; } } if TEXTCHUNKHEADER+"Creation Time"==tempstr { getstr tempstr, comchunk, insertNullPoint, 256; if tempstr==AUTOFILLMESSAGE { dim lastmod,24; fxtget lastmod,filename; formatDate lastmod; sdim comchunk,256,1; comchunk="Creation Time"+"\t"+refstr; messtradd=" is expanded to\n"+comchunk; gosub *sysPrintMesStr; comchunk=TEXTCHUNKHEADER+comchunk; strlen chunklen,comchunk; insertNullPoint=18; } } insertNullPoint--; poke comchunk,insertNullPoint,0; dim tempint,1; tempint=chunklen-4; repeat 4; peek byte,tempint,cnt; //4バイトを読み、チャンクのサイズを取得する; poke comchunkall,3-cnt+fp,byte; //バイトオーダ逆転させるため loop; fp+=4; i=0; repeat chunklen; peek tempint,comchunk,i; poke comchunkall,fp,tempint; fp++; i++; loop; crc32_ini; crc32_get crcvalue, comchunk, chunklen; repeat 4; peek tempint,crcvalue,3-cnt; poke comchunkall,fp,tempint; fp++; loop; str crcvalue,16; messtradd=" : crc="+crcvalue+"\n"; await 0; gosub *sysPrintMesStr; return; *sysShowINIEdit; gosub *sysHideSysMenu; dim iniWinposX,1; dim iniWinposY,1; gsel 0; ginfo 2; iniWinposX=prmx+10; iniWinposY=prmy+10; if iniWinposX+iniWinsizeX>dispx : iniWinposX=dispx-iniWinsizeX-10; if iniWinposY+iniWinsizeY>dispy : iniWinposY=dispy-iniWinsizeY-10; screen 2,800,600,28,-1000,-800; gsel 2,-1; redraw 0; title "コメントの設定"; gosub *fillappworkspace; width iniWinsizeX,iniWinsizeY,iniWinposX,iniWinposY; ; wndstyle 2,3; dim autofillTitle,1; dim autofillDate, 1; autofillTitle=1; autofillDate =1; sdim keywordPreset,16,PRESETWORDSMANY; keywordPreset="Title", "Author", "Description", "Copyright", "Creation Time", "Software", "Disclaimer", "Warning", "Source", "Comment"; sdim keywordPopup,32,PRESETWORDSMANY; keywordPopup="タイトル","作者名","説明","著作権情報","作成日時","使用したソフトウェア","制限条項","警告","使用したデヴァイス","雑多なコメント"; chunkmany=16; inputSizeY=22; margin=2; sdim keywordInput,80,chunkmany; sdim textInput,256,chunkmany; color ButtonTextr,ButtonTextg,ButtonTextb; repeat chunkmany; font MSGOTHIC, 12,0; pos 5+XOFFSET,inputsizeY+margin*cnt+YOFFSET+7; print "Keyword:" pos 182+XOFFSET,inputsizeY+margin*cnt+YOFFSET+7; print "Text:" pos 60+XOFFSET,inputSizeY+margin*cnt+YOFFSET; input keywordInput.cnt,110,inputSizeY,79; pos 220+XOFFSET,inputSIzeY+margin*cnt+YOFFSET; input textInput.cnt,320,inputSizeY,255; font MSGOTHIC, 14,0; objfont cnt,0; objfont cnt*2,0; objfont cnt*2+1,0; loop; pos 50+XOFFSET,390+YOFFSET; dim tempint,1; font MSGOTHIC,12,0; objsize 152,20; objno=chunkmany*2; button "タイトルを自動挿入する",*sysAutoFillTitleInvert; objsend objno,$f4,$03,tempint,1; objfont objno,0; objsize 130,20; objno++; button "日付を自動挿入する",*sysAutoFillDateInvert; objsend objno,$f4,$03,tempint,1; objfont objno,0; pos 260+XOFFSET,400+YOFFSET; objsize 100,24; objno++; button "保存", *sysSaveIniFile objfont objno,17; tempint=0; objsend objno,$f4,$01,tempint,1; pos 360+XOFFSET,400+YOFFSET; objsize 100,24; objno++; button "キャンセル", *sysIniCancel; objfont objno,17; objmany=objno+1; dim refWindowObjID,objmany; repeat objmany; refWindowObjID.cnt=cnt; loop; dim tempint,1; repeat PRESETWORDSMANY; objprm cnt*2,keywordPreset.cnt; objsend cnt*2,$cf,-1,tempint,1; objtip keywordPopup.cnt,cnt*2; loop; gosub *iniProc objno=chunkmany*2; if autofilltitle{ objsend TITLETEXTP,$cf,-1,tempint,1; objsend objno,$f1,1,tempint,1; } objno++; if autofilldate{ objsend DATETEXTP,$cf,-1,tempint,1; objsend objno,$f1,1,tempint,1; } objfocus 0; gsel 2,2; redraw 1; goto *sysINIEditMain; *sysAutoFillTitleInvert; if autofilltitle { textInput.TITLETEXTARRAYP=""; objprm TITLETEXTP,textInput.TITLETEXTARRAYP; objsend TITLETEXTP,$cf,0,tempint,1; autofilltitle=0; goto *sysINIEditMain; } objprm TITLETEXTP,AUTOFILLMESSAGE objsend TITLETEXTP,$cf,-1,tempint,1; autofilltitle=1; goto *sysINIEditMain; *sysAutoFillDateInvert; if autofilldate{ textInput.DATETEXTARRAYP=""; objprm DATETEXTP,textInput.DATETEXTARRAYP; objsend DATETEXTP,$cf,0,tempint,1; autofilldate=0; goto *sysINIEditMain; } objprm DATETEXTP,AUTOFILLMESSAGE objsend DATETEXTP,$cf,-1,tempint,1; autofilldate=1; goto *sysINIEditMain; *sysIniCancel; gosub *sysINIWindowClose; goto *main; *sysSaveIniFile sdim outfile,chunkmany*336+256,1; outfile=INISHOUDCONTAIN; repeat chunkmany if keywordInput.cnt="" : continue; if textInput.cnt="" : continue; outfile+=keywordInput.cnt+"\t"+textInput.cnt+"\n"; loop; strlen filesize,outfile; ; exist INIFILENAME; ; dialog "でばこ"+INIFILENAME+"\n"+outfile+"\n"+filesize; dim filestat,1; fxaget filestat, INIFILENAME; filestat = filestat \ 2; if filestat == 0 { bsave INIFILENAME, outfile, filesize; dim outfile,1; wait 10; } else { dialog "コメント設定ファイルに書き込みができません。ファイルが書き込み可能かどうか確認してください。",1,IOERROR; goto *sysINIEditMain; } gosub *sysINIWindowClose; goto *main; *sysINIWindowClose; width 1,1,-100,-100; screen 2,1,1,0,-100,-100; gsel 2,-1; gsel 0; gosub *sysShowSysMenu; return; *sysINIEditMain; wait 1; ginfo 1; activewindow=prmx; if prmx==0 : gsel 2,2 : goto *sysINIEditMain; if prmx!= 2 : goto *sysINIEditMain; stick keyinput,0,1; if (keyinput == 32) : goto *eventCheckEnter; if (keyinput == 128) : goto *sysIniCancel; if keyinput==1024 : goto *sysINITabLoop; goto *sysINIEditMain; *eventCheckEnter; goto *sysSaveIniFile; *sysINITabLoop; objfocus -1; tabPos=stat; getkey shiftkey,16; getkey ctrlkey,17; getkey altkey,18; if ctrlkey : goto *sysINIEditMain; if altkey : goto *sysINIEditMain; if shiftkey : tabPos-- : else tabPos++; if tabPos >= objmany : tabPos=0; if tabPos < 0 : tabPos=objmany-1; objfocus refWindowObjID.tabPos goto *sysINIEditMain; *makeDefaultINI; dialog "コメント用の設定ファイルがありません。デフォルトに置き換えます。",1,INIFILENAME+"がありません"; sdim outfile,512,1; outfile=INISHOUDCONTAIN; outfile+="Title\t"+AUTOFILLMESSAGE+"\nCreation Time\t"+AUTOFILLMESSAGE+"\n"; strlen filesize,outfile; bsave INIFILENAME,outfile,filesize; return; *iniProc sdim tempstr,255,1; dim fp,1; dim filesize,1; exist INIFILENAME; if strsize<1 { gosub *makeDefaultINI; exist INIFILENAME; } filesize=strsize+1; sdim,comchunkall,filesize+1024; sdim inifile,filesize,1; bload INIFILENAME,inifile,filesize,0; dim inilinecount,1; notesel inifile; dim i,1 dim textP,1; notemax inilinecount; repeat inilinecount; sdim eachline,255,1; dim sepPoint,1; dim flag,1; noteget eachline,cnt; peek byte,eachline,0; if byte==$23 : continue; if byte=="" : continue; ; dialog "でばこ"+eachline getstr tempstr,eachline,0,$09; sepPoint =strsize; repeat PRESETWORDSMANY+i if tempstr==keywordInput.cnt{ flag=1; textP=cnt; strmid tempstr,eachline,sepPoint,128; ; dialog "でばこ"+"static"+tempstr+" "+cnt; textInput.textP=tempstr; tempint=cnt*2+1; objprm tempint, textInput.textP; break; } loop; if flag==0 { textP= i + PRESETWORDSMANY; keywordInput.textP=tempstr; tempint= textP * 2; objprm tempint,keywordInput.textP; strmid tempstr,eachline,sepPoint,128; textInput.textP=tempstr; tempint= textP * 2 + 1; ; dialog "でばこ"+"dynamic"+textInput.textP objprm tempint, textInput.textP; i++; } loop; dim tempint,1; if textInput.TITLETEXTARRAYP!=AUTOFILLMESSAGE{ autofillTitle=0; objsend TITLETEXTP,$cf,0,tempint,1; } else { autofilTitle=1; textInput.TITLETEXTARRAYP==AUTOFILLMESSAGE; objprm TITLETEXTP, textInput.TITLETEXTARRAYP; } if textInput.DATETEXTARRAYP!=AUTOFILLMESSAGE{ autofillDate=0; objsend DATETEXTP,$cf,0,tempint,1; } else { autofillDate=1; textInput.DATETEXTARRAYP==AUTOFILLMESSAGE; objprm DATETEXTP,textInput.DATETEXTARRAYP; } return; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; *colorextract; sdim extractor,8,3; extractor = "","",""; tempint = 0; repeat 3,0; getstr extractor.cnt, tempstr, tempint, ' '; tempint = tempint+strsize; loop; return; *getwindowcolor; sdim appColor,16,1; sdim ShadowColor,16,1; sdim HighlightColor,16,1; sdim DarkShadowColor,16,1; sdim ButtonText,16,1; dim colortmp,8,3; sxinfo colortmp,"",4,20 HighlightColor = "" + colortmp.0 + " " + colortmp.1 + " " + colortmp.2; if stat : HighlightColor="255 255 255"; sxinfo colortmp,"",4,15 appColor = "" + colortmp.0 + " " + colortmp.1 + " " + colortmp.2; if stat : ShadowColor="192 192 192"; sxinfo colortmp,"",4,16 ShadowColor = "" + colortmp.0 + " " + colortmp.1 + " " + colortmp.2; if stat : ShadowColor="128 128 128"; sxinfo colortmp,"",4,21 DarkShadowColor = "" + colortmp.0 + " " + colortmp.1 + " " + colortmp.2; if stat : DarkShadowColor="0 0 0"; sxinfo colortmp,"",4,18 ButtonText = "" + colortmp.0 + " " + colortmp.1 + " " + colortmp.2; if stat : ButtonText="0 0 0"; return; *splitwindowcolors; tempstr=appColor; gosub *colorextract; appColorr = extractor.0; appColorg = extractor.1; appColorb = extractor.2; int appColorr; int appColorg; int appColorb; tempstr=ShadowColor; gosub *colorextract; ShadowColorr = extractor.0; ShadowColorg = extractor.1; ShadowColorb = extractor.2; int ShadowColorr; int ShadowColorg; int ShadowColorb; tempstr=HighlightColor; gosub *colorextract; HighlightColorr = extractor.0; HighlightColorg = extractor.1; HighlightColorb = extractor.2; int HighlightColorr; int HighlightColorg; int HighlightColorb; tempstr=DarkShadowColor; gosub *colorextract; DarkShadowColorr = extractor.0; DarkShadowColorg = extractor.1; DarkShadowColorb = extractor.2; int DarkShadowColorr; int DarkShadowColorg; int DarkShadowColorb; tempstr=ButtonText; gosub *colorextract; ButtonTextr = extractor.0; ButtonTextg = extractor.1; ButtonTextb = extractor.2; int ButtonTextr; int ButtonTextg; int ButtonTextb; return; *fillappworkspace; color appColorr, appColorg, appColorb; boxf 0,0,dispx,dispy; return;