A
askyer
Unregistered / Unconfirmed
GUEST, unregistred user!
发现网上虽然有转换工具,但都有缺陷请问有谁做过?怎么实现
/*This source code is part of the MHT packageavailable at http://www.weckert.org/mht/Copyright (C) 2003 Thomas Weckert (info at weckert.org)This program is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public Licenseas published by the Free Software Foundation; either version 2of the License, or (at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.*/#include <stdio.h>#include <stdlib.h>#include <string.h>#include "mht.h"/* Definitions: */#define HELP_STRING "This is mht2html, the Macro-Hyper-Text to HTML compiler./nmht2html supports the following arguments:/n/n-h print this screen/n-v print the release version and compile date/n-p process a MHT file specified by the absolute path/n/nexample usage:/n$> mht2html -p /tmp/file.mht/n/nFor further information about MHT, email to info at weckert.org/n"/* Prototypes: */int main( int argc, char **argvv );void show_mht_error( int mht_error );int main( int argc, char **argv ) { int mht_error = 0; char *mht_version_msg = (char*)NULL; /* Process the command line arguments */ if (argc>=2) { /* Initialize MHT */ mht_init(); /* Try to read the username, style path and user path from the environment. */#ifdef WIN32 mht_register_env("USERNAME","user");#else mht_register_env("USER","user");#endif mht_register_env("MHTUSERPATH","userpath"); mht_register_env("MHTSCRIPTPATH","scriptpath"); if (strcmp(argv[1],"-v")==0) { mht_search_macro("mht_version_msg",&mht_version_msg); fprintf(stdout,"%s/n",mht_version_msg); } else if (strcmp(argv[1],"-h")==0) { fprintf(stdout,"%s",HELP_STRING); } else if (strcmp(argv[1],"-p")==0) { if (argc>=3) { /* Process the MHT file */ mht_error = mht_quickopen(stdout,argv[2]); if (mht_error!=0) { show_mht_error(mht_error); return (0); } } else { fprintf(stdout,"%s",HELP_STRING); } } else { fprintf(stdout,"%s",HELP_STRING); } /* Exit MHT */ mht_exit(); } else { fprintf(stdout,"%s",HELP_STRING); } return (0);}void show_mht_error( int mht_error ) { char *mht_err_msg = (char*)NULL, *mht_err_line = (char*)NULL; if (mht_error!=0) { if ( mht_search_macro("mht_err_msg",&mht_err_msg)!=0) { fprintf(stdout,"/nMHT parse error!/nMessage: %s/n",mht_err_msg); if ( mht_search_macro("mht_err_line",&mht_err_line)!=0) { fprintf(stdout,"Line: %s/n",mht_err_line); } /* if ( mht_search_macro("mht_err_code",&mht_err_code)!=0) { fprintf(stdout,"Code: %s/n",mht_err_code); } */ } else { fprintf(stdout,"/nMHT-Error:/nCode:%d/n",mht_error); } }}
{ This file is part of the mht2htm converter. Copyright (C) 2004,2007 Goran Atanasijevic All Rights Reserved. mht2htm is free software; you can redistribute them and/or modify them under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Goran Atanasijevic <bajaatan@yahoo.com>}unit Unit1;{$mode objfpc}{$H+}interfaceuses {$IFDEF MSWINDOWS} //Windows, ShellAPI, {$ENDIF} {$IFDEF UNIX} Unix, {$ENDIF} Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Grids, StdCtrls, Buttons, ComCtrls, ExtCtrls, Menus , Keyboard, // Process, Unit2, languages;const PVer='1.5.0.10'; PDat='06.apr.2007.'; PExtra='[BETA]'; {$IFDEF MSWINDOWS} DirSep='/';//Directory separator {$ENDIF} {$IFDEF UNIX} DirSep='/';//Directory separator {$ENDIF}type { TForm1 } TForm1 = class(TForm) browser_default1: TMenuItem; Button1: TButton; Button2: TButton; Button3: TButton; Button4: TButton; Button5: TButton; Button6: TButton; Button7: TButton; CheckBox1: TCheckBox; CheckBox2: TCheckBox; CloseHistory1: TMenuItem; Edit1: TEdit; GroupBox1: TGroupBox; GroupBox2: TGroupBox; Image1: TImage; Image2: TImage; ImageList1: TImageList; Label1: TLabel; Label13: TLabel; Label14: TLabel; Label15: TLabel; Label16: TLabel; Label17: TLabel; Label19: TLabel; Label2: TLabel; Label20: TLabel; Label21: TLabel; Label22: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; Label7: TLabel; Label8: TLabel; megaNFOs: TListBox; browser_konqueror2: TMenuItem; MenuItem1: TMenuItem; MenuItem12: TMenuItem; browser_IE1: TMenuItem; browser_netscape1: TMenuItem; browser_mozilla1: TMenuItem; browser_firefox1: TMenuItem; browser_seamonkey1: TMenuItem; browser_opera1: TMenuItem; browser_mozilla2: TMenuItem; browser_netscape2: TMenuItem; browser_firefox2: TMenuItem; browser_opera2: TMenuItem; browser_seamonkey2: TMenuItem; MenuItem2: TMenuItem; N1: TMenuItem; N2: TMenuItem; OpenDialog1: TOpenDialog; OpenHTMdir1: TMenuItem; OpenHTMfile1: TMenuItem; OpenIE1: TMenuItem; OpenMHTfile1: TMenuItem; OpenNetscape1: TMenuItem; Panel1: TPanel; Panel2: TPanel; Panel3: TPanel; Panel4: TPanel; Panel5: TPanel; Panel6: TPanel; Panel7: TPanel; Panel8: TPanel; Panel9: TPanel; PopupMenu1: TPopupMenu; PopupMenu2: TPopupMenu; ProgressBar1: TProgressBar; ProgressBar2: TProgressBar; SelectDirectoryDialog1: TSelectDirectoryDialog; Shape1: TShape; Shape2: TShape; Shape3: TShape; Shape4: TShape; Shape5: TShape; Shape6: TShape; Shape7: TShape; Shape8: TShape; StatusBar1: TStatusBar; StringGrid1: TStringGrid; StringGrid2: TStringGrid; TrackBar1: TTrackBar; procedure browser_IE1Click(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Button1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure Button2Click(Sender: TObject); procedure Button2MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure Button3Click(Sender: TObject); procedure Button3MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure Button4Click(Sender: TObject); procedure Button4MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure Button5Click(Sender: TObject); procedure Button5MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure Button6Click(Sender: TObject); procedure Button6MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure Button7Click(Sender: TObject); procedure Button7MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure CheckBox1Change(Sender: TObject); procedure CheckBox1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure CheckBox2MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure Edit1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer ); procedure FormCreate(Sender: TObject); procedure FormResize(Sender: TObject); procedure Image2MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer ); procedure Image2MouseUp(Sender: TOBject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure Label12Click(Sender: TObject); procedure Label16MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure Label19MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure Label22MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure Label7Click(Sender: TObject); procedure Label7MouseUp(Sender: TOBject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure Label9Click(Sender: TObject); procedure MenuItem1Click(Sender: TObject); procedure MenuItem2Click(Sender: TObject); procedure OpenHTMdir1Click(Sender: TObject); procedure OpenHTMfile1Click(Sender: TObject); procedure OpenMHTfile1Click(Sender: TObject); procedure StatusBar1DblClick(Sender: TObject); procedure StringGrid1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure StringGrid2MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure TrackBar1Change(Sender: TObject); procedure TrackBar1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); private { private declarations } public { public declarations } end;var Form1: TForm1; table:array[0..63]of string[1]; SourDir,OutpDir,OutpDir1,MHTFile,DestFile:string;// nizOrig,nizNew,nizNewName,nizType,nizCode:array[0..10000]of string;{max 2000 files in mht file} nizOrig,nizNew,nizNewName,nizType,nizCode:TStringList; //arrays of Original names, ???, ???, filetype and b64/qp parts,Part:integer; info:textfile; source,megaFILE:textfile; destination:file of byte; boundary:string; stop,pause:boolean; BaseURL:string; firsthtm:string; firsthtmfound:boolean; StartTime,NowTime,MidTime:TDateTime; SizeAll,SizeRem:integer; startme:textfile;// repso,repsn,delo:array[0..10000] of string; {max 10000 links in all variants in mht file} repso,repsn,delo:TStringList; //replace what, replace with, strings to delete// repNr,delNr:longint; CDir:string; tm,dm:boolean; megaNFOlist:TStringList; recognized:array[1..20,1..2]of string; recognizedcount:integer; language_strings:array[0..10,1..100]of string; language_encoding:array[0..10]of integer; language_nr:integer; language_count:integer;implementationprocedure TForm1.FormResize(Sender: TObject);var h,w:integer;begin w:=Button1.Width+Button2.Width+Button4.Width+Button5.Width; if Button7.Visible then w:=w+Button7.Width; if Button3.Visible then w:=w+Button3.Width; w:=w+Panel1.Width; h:=GroupBox2.Top+GroupBox2.Height+StatusBar1.Height; if Form1.ClientWidth<w then Form1.ClientWidth:=w; if Form1.ClientHeight<h then Form1.ClientHeight:=h; if StringGrid2.Width>StringGrid1.Width then w:=StringGrid2.Width else w:=StringGrid1.Width; StringGrid2.ColWidths[0]:=(w-20) div 2; StringGrid2.ColWidths[1]:=StringGrid2.ColWidths[0]; StringGrid1.ColWidths[0]:=w-100; StringGrid1.ColWidths[2]:=w-100;end;procedure TForm1.Image2MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);beginStatusBar1.SimpleText:=language_strings[language_nr,74];end;procedure TForm1.Image2MouseUp(Sender: TOBject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);begin// if Button=mbLeft then PopupMenu2.PopUp(X+Form1.Left+Panel1.Left+6, Y+Form1.Top+Panel8.Top+GroupBox2.Top+20);// PopupMenu2.PopUp(X+Form1.Left, Y+Form1.Top); //for gtk2end;procedure TForm1.Label12Click(Sender: TObject);var browser_name:string;begin {$IFDEF MSWINDOWS} ExecuteFile('explorer.exe', 'http://www.lazarus.freepascal.org', ''); {$ENDIF} {$IFDEF UNIX} browser_name:='konqueror'; if browser_konqueror2.Checked then browser_name:='konqueror' else if browser_firefox2.Checked then browser_name:='firefox' else if browser_netscape2.Checked then browser_name:='netscape' else if browser_mozilla2.Checked then browser_name:='mozilla' else if browser_seamonkey2.Checked then browser_name:='seamonkey' else if browser_opera2.Checked then browser_name:='opera'; ExecuteFile(browser_name, 'http://www.lazarus.freepascal.org', ''); {$ENDIF}end;procedure TForm1.Label16MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);begin StatusBar1.SimpleText:=language_strings[language_nr,67];end;procedure TForm1.Label19MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);begin StatusBar1.SimpleText:=language_strings[language_nr,68];end;procedure TForm1.Label22MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);begin StatusBar1.SimpleText:=language_strings[language_nr,69];end;procedure TForm1.Label7Click(Sender: TObject);var browser_name:string;begin {$IFDEF MSWINDOWS} ExecuteFile('explorer.exe', 'http://myprograms.my-place.us', ''); {$ENDIF} {$IFDEF UNIX} browser_name:='konqueror'; if browser_konqueror2.Checked then browser_name:='konqueror' else if browser_firefox2.Checked then browser_name:='firefox' else if browser_netscape2.Checked then browser_name:='netscape' else if browser_mozilla2.Checked then browser_name:='mozilla' else if browser_seamonkey2.Checked then browser_name:='seamonkey' else if browser_opera2.Checked then browser_name:='opera'; ExecuteFile(browser_name, 'http://myprograms.my-place.us', ''); {$ENDIF}end;procedure TForm1.Label7MouseUp(Sender: TOBject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);begin// if Button=mbLeft then PopupMenu2.PopUp(X+Form1.Left+Panel1.Left+Label7.Left+6, Y+Form1.Top+Panel8.Top+GroupBox2.Top+20);// PopupMenu2.PopUp(X+Form1.Left, Y+Form1.Top); //for gtk2end;procedure TForm1.Label9Click(Sender: TObject);var browser_name:string;begin {$IFDEF MSWINDOWS} ExecuteFile('explorer.exe', 'mailto:bajaatan@yahoo.com', ''); {$ENDIF} {$IFDEF UNIX} browser_name:='konqueror'; if browser_konqueror2.Checked then browser_name:='konqueror' else if browser_firefox2.Checked then browser_name:='firefox' else if browser_netscape2.Checked then browser_name:='netscape' else if browser_mozilla2.Checked then browser_name:='mozilla' else if browser_seamonkey2.Checked then browser_name:='seamonkey' else if browser_opera2.Checked then browser_name:='opera'; ExecuteFile(browser_name, 'mailto:bajaatan@yahoo.com', ''); {$ENDIF}end;procedure TForm1.MenuItem1Click(Sender: TObject);begin MenuItem2.Checked:=false; MenuItem1.Checked:=true; Label7.Caption:=MenuItem1.Caption; set_language(0);end;procedure TForm1.MenuItem2Click(Sender: TObject);begin MenuItem1.Checked:=false; MenuItem2.Checked:=true; Label7.Caption:=MenuItem2.Caption; set_language(1);end;procedure TForm1.OpenHTMdir1Click(Sender: TObject);var browser_name:string;begin if FileExists(StringGrid2.Cells[1,StringGrid2.Row]) then {$IFDEF MSWINDOWS} ExecuteFile('explorer.exe',StringGrid2.Cells[1,StringGrid2.Row],''); {$ENDIF} {$IFDEF UNIX} browser_name:='konqueror'; if browser_konqueror2.Checked then browser_name:='konqueror' else if browser_firefox2.Checked then browser_name:='firefox' else if browser_netscape2.Checked then browser_name:='netscape' else if browser_mozilla2.Checked then browser_name:='mozilla' else if browser_seamonkey2.Checked then browser_name:='seamonkey' else if browser_opera2.Checked then browser_name:='opera'; ExecuteFile(browser_name, StringGrid2.Cells[1,StringGrid2.Row], ''); {$ENDIF}end;procedure TForm1.OpenHTMfile1Click(Sender: TObject);var browser_name:string;begin if FileExists(StringGrid2.Cells[0,StringGrid2.Row]) then {$IFDEF MSWINDOWS} ExecuteFile('explorer.exe',StringGrid2.Cells[0,StringGrid2.Row],''); {$ENDIF} {$IFDEF UNIX} browser_name:='konqueror'; if browser_konqueror2.Checked then browser_name:='konqueror' else if browser_firefox2.Checked then browser_name:='firefox' else if browser_netscape2.Checked then browser_name:='netscape' else if browser_mozilla2.Checked then browser_name:='mozilla' else if browser_seamonkey2.Checked then browser_name:='seamonkey' else if browser_opera2.Checked then browser_name:='opera'; ExecuteFile(browser_name, StringGrid2.Cells[1,StringGrid2.Row], ''); {$ENDIF}end;procedure TForm1.OpenMHTfile1Click(Sender: TObject);var browser_name:string;beginif FileExists(StringGrid2.Cells[1,StringGrid2.Row]+'___start_me.htm') then {$IFDEF MSWINDOWS} ExecuteFile1(StringGrid2.Cells[1,StringGrid2.Row]+'___start_me.htm','',''); {$ENDIF} {$IFDEF UNIX} browser_name:='konqueror'; if browser_konqueror2.Checked then browser_name:='konqueror' else if browser_firefox2.Checked then browser_name:='firefox' else if browser_netscape2.Checked then browser_name:='netscape' else if browser_mozilla2.Checked then browser_name:='mozilla' else if browser_seamonkey2.Checked then browser_name:='seamonkey' else if browser_opera2.Checked then browser_name:='opera'; ExecuteFile(browser_name, StringGrid2.Cells[1,StringGrid2.Row]+'___start_me.htm', ''); {$ENDIF}end;procedure TForm1.StatusBar1DblClick(Sender: TObject);beginend;procedure TForm1.StringGrid1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);begin StatusBar1.SimpleText:=language_strings[language_nr,71];end;procedure TForm1.StringGrid2MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);begin StatusBar1.SimpleText:=language_strings[language_nr,70];end;procedure TForm1.TrackBar1Change(Sender: TObject);begin case TrackBar1.Position of 0:Label15.Caption:=language_strings[language_nr,16]; 1:Label15.Caption:=language_strings[language_nr,17]; 2:Label15.Caption:=language_strings[language_nr,18]; 3:Label15.Caption:=language_strings[language_nr,19]; 4:Label15.Caption:=language_strings[language_nr,20]; end;end;procedure TForm1.TrackBar1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);beginStatusBar1.SimpleText:=language_strings[language_nr,72];end;procedure TForm1.FormCreate(Sender: TObject);var table_tmp:string; i:byte;begin Form1.Caption:='mht2htm v'+PVer+' '+PDat+' '+PExtra; Application.Title:='mht2htm'; tm:=false; dm:=false; table_tmp:='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; for i:=0 to 63 do table[i]:=table_tmp[i+1]; stop:=false; pause:=false; GetDir(0,CDIR); SizeAll:=0; megaNFOlist := TStringList.Create; repso := TStringList.Create; repso.CaseSensitive:=false; repsn := TStringList.Create; delo := TStringList.Create; nizOrig := TStringList.Create; nizNew := TStringList.Create; nizNewName := TStringList.Create; nizType := TStringList.Create; nizCode := TStringList.Create; {$IFDEF MSWINDOWS} browser_default1.Visible:=true; // browser_IE1.Visible:=true; //how to find paths??? // browser_netscape1.Visible:=true; // browser_mozilla1.Visible:=true; // browser_firefox1.Visible:=true; // browser_seamonkey1.Visible:=true; // browser_opera1.Visible:=true; {$ENDIF} {$IFDEF UNIX} browser_konqueror2.Visible:=true; browser_netscape2.Visible:=true; browser_mozilla2.Visible:=true; browser_firefox2.Visible:=true; browser_seamonkey2.Visible:=true; browser_opera2.Visible:=true; {$ENDIF} //move this to consts??? recognized[1,1]:='R0lGOD'; recognized[1,2]:='.gif'; // R0lGODlh // R0lGODdh exception recognized[2,1]:='/9j/4AAQSkZJRgABA'; recognized[2,2]:='.jpg'; recognized[3,1]:='iVBORw0K'; recognized[3,2]:='.png'; //possible 'iVBORw0KGgoAAAANSUhEUgAA' recognized[4,1]:='<!DOCTYPE HTML PUBLIC'; recognized[4,2]:='.htm'; recognized[5,1]:='<HTML>'; recognized[5,2]:='.htm'; recognized[6,1]:='<html>'; recognized[6,2]:='.htm'; recognized[7,1]:='document.'; recognized[7,2]:='.js'; recognized[8,1]:='d.'; recognized[8,2]:='.js'; recognized[9,1]:='var '; recognized[9,2]:='.js'; recognized[10,1]:='BODY'; recognized[10,2]:='.css'; recognized[11,1]:='body'; recognized[11,2]:='.css'; recognized[12,1]:='HTML'; recognized[12,2]:='.css'; recognized[13,1]:='html'; recognized[13,2]:='.css'; recognized[14,1]:='*****not good***htm/js***<!-- '; recognized[14,2]:='.htm'; recognized[15,1]:='<!DOCTYPE HTML'; recognized[15,2]:='.htm'; //'HTML' .->css recognizedcount:=15; language_nr:=0; load_language_strings; set_language(0);end;procedure TForm1.Button1Click(Sender: TObject);var i,j,k :integer; s,sdir,sfile :string; bo :boolean; f :file of Byte;beginif OpenDialog1.Execute thenbeginfor k:=0 to OpenDialog1.Files.Count-1 do begin i:=0; s:=OpenDialog1.Files.Strings[k]; while Pos(DirSep,copy(s,i+1,length(s)-i))>0 do i:=i+Pos(DirSep,copy(s,i+1,length(s)-i)); sdir:=Copy(s,1,i); sfile:=copy(s,i+1,length(s)-i); j:=0; bo:=true; for i:=1 to StringGrid1.RowCount-1 do if (StringGrid1.Cells[2,i]+StringGrid1.Cells[0,i]=OpenDialog1.Files.Strings[k]) then bo:=false; if bo then begin if (StringGrid1.Cells[0,StringGrid1.RowCount-1]+StringGrid1.Cells[1,StringGrid1.RowCount-1]+StringGrid1.Cells[2,StringGrid1.RowCount-1]<>'') then StringGrid1.RowCount:=StringGrid1.RowCount+1; StringGrid1.Cells[0,StringGrid1.RowCount-1]:=sfile; StringGrid1.Cells[2,StringGrid1.RowCount-1]:=sdir; AssignFile(f,OpenDialog1.Files.Strings[k]); Reset(f); j:=FileSize(f); SizeAll:=SizeAll+j; CloseFile(f); StringGrid1.Cells[1,StringGrid1.RowCount-1]:=IntToStr(j); end; end; SizeRem:=SizeAll; Label2.Caption:='0 '+language_strings[language_nr,8]+' '+IntToStr(StringGrid1.RowCount-1)+' '+language_strings[language_nr,9]; Label3.Caption:='0 '+language_strings[language_nr,8]+' 0 '+language_strings[language_nr,10]; ProgressBar1.Position:=0; ProgressBar2.Position:=0; StatusBar1.SimpleText:=IntToStr(StringGrid1.RowCount-1)+' '+language_strings[language_nr,9]+' ('+IntToStr(SizeAll)+' '+language_strings[language_nr,75]+')';end;end;procedure TForm1.Button1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);begin StatusBar1.SimpleText:=language_strings[language_nr,55];end;procedure TForm1.browser_IE1Click(Sender: TObject);begin if Sender=browser_IE1 then browser_IE1.Checked:=true else if Sender=browser_netscape1 then browser_netscape1.Checked:=true else if Sender=browser_mozilla1 then browser_mozilla1.Checked:=true else if Sender=browser_firefox1 then browser_firefox1.Checked:=true else if Sender=browser_seamonkey1 then browser_seamonkey1.Checked:=true else if Sender=browser_opera1 then browser_opera1.Checked:=true else if Sender=browser_konqueror2 then browser_konqueror2.Checked:=true else if Sender=browser_netscape2 then browser_netscape2.Checked:=true else if Sender=browser_mozilla2 then browser_mozilla2.Checked:=true else if Sender=browser_firefox2 then browser_firefox2.Checked:=true else if Sender=browser_seamonkey2 then browser_seamonkey2.Checked:=true else if Sender=browser_opera2 then browser_opera2.Checked:=trueend;procedure TForm1.Button2Click(Sender: TObject);var f :file of Byte; j :integer;begin if StringGrid1.Cells[1,StringGrid1.Row]<>'' then begin SizeAll:=SizeAll-StrToInt(StringGrid1.Cells[1,StringGrid1.Row]); SizeRem:=SizeAll; StatusBar1.SimpleText:=IntToStr(StringGrid1.RowCount-1)+' '+language_strings[language_nr,9]+' ('+IntToStr(SizeAll)+' '+language_strings[language_nr,75]+')'; end;if StringGrid1.RowCount>2 then begin StringGrid1.DeleteColRow(false,StringGrid1.Row); end else begin StringGrid1.Cells[0,StringGrid1.RowCount-1]:=''; StringGrid1.Cells[1,StringGrid1.RowCount-1]:=''; StringGrid1.Cells[2,StringGrid1.RowCount-1]:=''; StatusBar1.SimpleText:='0 '+language_strings[language_nr,9]+' (0 '+language_strings[language_nr,75]+')'; end;end;procedure TForm1.Button2MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);begin StatusBar1.SimpleText:=language_strings[language_nr,56];end;procedure TForm1.Button3Click(Sender: TObject);var BF,i,{i1,}t1,t2,t3:integer;// megaI:Longint; dpom:double; {s,}s1,s2,s3:string;beginif (StringGrid1.RowCount>2) or (StringGrid1.Cells[0,1]<>'') thenbegin if CheckBox2.Checked then Button7.Caption:=language_strings[language_nr,29] else Button7.Caption:=language_strings[language_nr,28]; Button7.Visible:=true; Button3.Visible:=false; Button1.Enabled:=false; Button2.Enabled:=false; Button6.Enabled:=false; CheckBox1.Enabled:=false; CheckBox2.Enabled:=false; Edit1.Enabled:=false; TrackBar1.Enabled:=false; if Button3.Caption=language_strings[language_nr,27] then megaNFOlist.Clear; //Clear if Button3=Start pause:=false; Application.Title:='mht2htm [0% '+language_strings[language_nr,34]+']'; Form1.Caption:='mht2htm [0% '+language_strings[language_nr,34]+']'; StartTime:=Now; //stop:=false; Label13.Caption:='00:00:00 '+language_strings[language_nr,12]; Label14.Caption:=language_strings[language_nr,14]+' '+language_strings[language_nr,13]; BF:=StringGrid1.RowCount-1; ProgressBar2.Visible:=true; Form1.FormResize(Form1); for i:=1 to BF do begin// i1:=0;// s:=StringGrid1.Cells[2,1]+StringGrid1.Cells[0,1]; SourDir:=StringGrid1.Cells[2,1]; MHTFile:=StringGrid1.Cells[0,1]; if CheckBox1.Checked or (Edit1.Text='') then OutpDir:=SourDir else OutpDir:=Edit1.Text; if OutpDir[length(OutpDir)]=DirSep then OutpDir:=OutpDir+MHTFile+'_Files' else OutpDir:=OutpDir+DirSep+MHTFile+'_Files'; OutpDir:=IllegalChar(OutpDir);{$I-} MKDir(OutpDir); if IOResult <> 0 then begin Beep; Exit; end;{$I+} MH2HT;// SizeRem:=SizeRem-StrToInt(copy(StringGrid1.Cells[1,1],1,length(StringGrid1.Cells[1,1])-3)); SizeRem:=SizeRem-StrToInt(StringGrid1.Cells[1,1]); NowTime:=Now; dpom:=NowTime-StartTime; t1:=Trunc(dpom*24); str(t1:2,s1); if s1[1]=' ' then s1[1]:='0'; t2:=Trunc(dpom*24*60)-t1*60; str(t2:2,s2); if s2[1]=' ' then s2[1]:='0'; t3:=Round(dpom*24*3600)-t1*3600-t2*60; str(t3:2,s3); if s3[1]=' ' then s3[1]:='0'; Label13.Caption:=s1+':'+s2+':'+s3+' '+language_strings[language_nr,12]; if SizeRem<>0 then dpom:=SizeAll*dpom/(SizeAll-SizeRem)-dpom else dpom:=0; t1:=Trunc(dpom*24); str(t1:2,s1); if s1[1]=' ' then s1[1]:='0'; t2:=Trunc(dpom*24*60)-t1*60; str(t2:2,s2); if s2[1]=' ' then s2[1]:='0'; t3:=Round(dpom*24*3600)-t1*3600-t2*60; str(t3:2,s3); if s3[1]=' ' then s3[1]:='0'; Label14.Caption:=s1+':'+s2+':'+s3+' '+language_strings[language_nr,13]; StringGrid1.Row:=1; StringGrid2.Cells[0,StringGrid2.RowCount-1]:=StringGrid1.Cells[2,1]+StringGrid1.Cells[0,1]; StringGrid2.Cells[1,StringGrid2.RowCount-1]:=OutpDir+DirSep; StringGrid2.RowCount:=StringGrid2.RowCount+1;// for i1:=1 to StringGrid1.RowCount-2 do// StringGrid1.Rows[i1]:=StringGrid1.Rows[i1+1];// StringGrid1.RowCount:=StringGrid1.RowCount-1; if StringGrid1.RowCount>2 then begin StringGrid1.DeleteColRow(false,StringGrid1.Row); end else begin StringGrid1.Cells[0,StringGrid1.RowCount-1]:=''; StringGrid1.Cells[1,StringGrid1.RowCount-1]:=''; StringGrid1.Cells[2,StringGrid1.RowCount-1]:=''; end; ProgressBar1.Position:=Round(i*100/BF); Label2.Caption:=IntToStr(i)+' '+language_strings[language_nr,8]+' '+IntToStr(BF)+' '+language_strings[language_nr,9]; Application.Title:='mht2htm ['+IntToStr(Round(i*100/BF))+'% '+language_strings[language_nr,34]+']'; Form1.Caption:='mht2htm ['+IntToStr(Round(i*100/BF))+'% '+language_strings[language_nr,34]+']'; if stop then begin Label2.Caption:='0 '+language_strings[language_nr,8]+' '+IntToStr(StringGrid1.RowCount-1)+' '+language_strings[language_nr,9]; Label3.Caption:='0 '+language_strings[language_nr,8]+' 0 '+language_strings[language_nr,10]; Form1.Caption:='mht2htm v'+PVer+' '+PDat+' '+PExtra; Application.Title:='mht2htm'; ProgressBar1.Position:=0; ProgressBar2.Position:=0; stop:=false; pause:=false; SizeAll:=SizeRem;// megaNFOs.Items.SaveToFile(CDIR+'/mega.NFO'); megaNFOlist.SaveToFile(CDIR+'/mega.NFO'); Beep; Button3.Caption:=language_strings[language_nr,27]; Button7.Visible:=false; Button3.Visible:=true; Button1.Enabled:=true; Button2.Enabled:=true; Button6.Enabled:=true; CheckBox1.Enabled:=true; CheckBox2.Enabled:=true; if not(CheckBox1.Checked) then Edit1.Enabled:=true; TrackBar1.Enabled:=true; Form1.FormResize(Form1); exit; end; if pause then begin //is this never happend ??? stop:=false; pause:=false; SizeAll:=SizeRem;// megaNFOs.Items.SaveToFile(CDIR+'/mega.NFO'); megaNFOlist.SaveToFile(CDIR+'/mega.NFO'); Application.Title:='mht2htm ['+language_strings[language_nr,35]+']'; Form1.Caption:='mht2htm ['+language_strings[language_nr,35]+']'; Button3.Caption:=language_strings[language_nr,30]; Button7.Visible:=false; Button3.Visible:=true; Button1.Enabled:=true; Button2.Enabled:=true; Button6.Enabled:=true; CheckBox1.Enabled:=true; CheckBox2.Enabled:=true; if not(CheckBox1.Checked) then Edit1.Enabled:=true; TrackBar1.Enabled:=true; Form1.FormResize(Form1); exit; end; end; if CheckBox2.Checked then begin// megaNFOs.Items.SaveToFile(CDIR+'/mega.NFO'); megaNFOlist.SaveToFile(CDIR+'/mega.NFO'); end; Form1.Caption:='mht2htm v'+PVer+' '+PDat+' '+PExtra; Application.Title:='mht2htm'; SizeAll:=0; stop:=false; pause:=false; Beep; Button3.Caption:=language_strings[language_nr,27]; Button7.Visible:=false; Button3.Visible:=true; Button1.Enabled:=true; Button2.Enabled:=true; Button6.Enabled:=true; CheckBox1.Enabled:=true; CheckBox2.Enabled:=true; if not(CheckBox1.Checked) then Edit1.Enabled:=true; TrackBar1.Enabled:=true; Form1.FormResize(Form1);end;end;procedure TForm1.Button3MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);begin if Button3.Caption=language_strings[language_nr,27] then StatusBar1.SimpleText:=language_strings[language_nr,57] else if Button3.Caption=language_strings[language_nr,30] then StatusBar1.SimpleText:=language_strings[language_nr,58];end;procedure TForm1.Button4Click(Sender: TObject);begin if StringGrid2.Visible thenbegin Label1.Caption:=language_strings[language_nr,1]; //Files to convert: Button4.Caption:=language_strings[language_nr,31]; StringGrid2.Visible:=false; StringGrid1.Visible:=true; Button1.Enabled:=true; Button2.Enabled:=true; Button3.Enabled:=true;endelsebegin Label1.Caption:=language_strings[language_nr,2]; //Converted files: Button4.Caption:=language_strings[language_nr,32]; StringGrid1.Visible:=false; StringGrid2.Visible:=true;end;// Button5.Left:=Button5.Left+Button5.Width; Form1.FormResize(Form1);end;procedure TForm1.Button4MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);begin if Button4.Caption=language_strings[language_nr,31] then StatusBar1.SimpleText:=language_strings[language_nr,61] else if Button4.Caption=language_strings[language_nr,32] then StatusBar1.SimpleText:=language_strings[language_nr,62];end;procedure TForm1.Button5Click(Sender: TObject);var browser_name:string;beginif FileExists(ExtractFilePath(Application.ExeName)+'help'+DirSep+language_strings[language_nr,100]+DirSep+'index.htm') then {$IFDEF MSWINDOWS} ExecuteFile1(ExtractFilePath(Application.ExeName)+'help'+DirSep+language_strings[language_nr,100]+DirSep+'index.htm','',''); {$ENDIF} {$IFDEF UNIX} browser_name:='konqueror'; if browser_konqueror2.Checked then browser_name:='konqueror' else if browser_firefox2.Checked then browser_name:='firefox' else if browser_netscape2.Checked then browser_name:='netscape' else if browser_mozilla2.Checked then browser_name:='mozilla' else if browser_seamonkey2.Checked then browser_name:='seamonkey' else if browser_opera2.Checked then browser_name:='opera'; ExecuteFile(browser_name, ExtractFilePath(Application.ExeName)+'help'+DirSep+language_strings[language_nr,100]+DirSep+'index.htm', ''); {$ENDIF} beep;end;procedure TForm1.Button5MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);begin StatusBar1.SimpleText:=language_strings[language_nr,63];end;procedure TForm1.Button6Click(Sender: TObject);begin if SelectDirectoryDialog1.Execute then begin Edit1.Text:=SelectDirectoryDialog1.FileName; Edit1.Enabled:=true; CheckBox1.Checked:=false; end;end;procedure TForm1.Button6MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);begin StatusBar1.SimpleText:=language_strings[language_nr,65];end;procedure TForm1.Button7Click(Sender: TObject);begin if Button7.Caption=language_strings[language_nr,28] then stop:=true else pause:=true;end;procedure TForm1.Button7MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);begin if Button7.Caption=language_strings[language_nr,28] then StatusBar1.SimpleText:=language_strings[language_nr,59] else if Button7.Caption=language_strings[language_nr,29] then StatusBar1.SimpleText:=language_strings[language_nr,60];end;procedure TForm1.CheckBox1Change(Sender: TObject);begin if CheckBox1.Checked then Edit1.Enabled:=false else Edit1.Enabled:=true;end;procedure TForm1.CheckBox1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);begin StatusBar1.SimpleText:=language_strings[language_nr,66];end;procedure TForm1.CheckBox2MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);beginStatusBar1.SimpleText:=language_strings[language_nr,73];end;procedure TForm1.Edit1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);begin StatusBar1.SimpleText:=language_strings[language_nr,64];end;initialization {$I unit1.lrs}end.