Project1.dpr Dosyası
program Project1;
uses
Forms,
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
Unit1.pas
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, FolderDialog, ComCtrls,shellapi;
type
TForm1 = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
FolderDialog1: TFolderDialog;
ComboBox1: TComboBox;
Label1: TLabel;
Button1: TButton;
ComboBox2: TComboBox;
Button2: TButton;
ComboBox3: TComboBox;
CheckBox1: TCheckBox;
Edit1: TEdit;
Label2: TLabel;
ComboBox4: TComboBox;
Label3: TLabel;
Label4: TLabel;
Button3: TButton;
Edit2: TEdit;
Label5: TLabel;
Memo1: TMemo;
TabSheet3: TTabSheet;
Button4: TButton;
ComboBox5: TComboBox;
Button5: TButton;
OpenDialog1: TOpenDialog;
ComboBox6: TComboBox;
Edit3: TEdit;
Label6: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function GetTempDir: string;
var
lng: DWORD;
begin
SetLength(Result, MAX_PATH);
lng := GetTempPath(MAX_PATH, PChar(Result));
SetLength(Result, lng);
end;
function ShortPathName(const LongPathName: string): string;
var
Retval: DWORD;
Buff: array [0..MAX_PATH-1] of Char;
begin
Retval := GetShortPathName(PChar(LongPathName), Buff, Length(Buff));
Win32Check(Retval <> 0);
Result := Buff;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if FolderDialog1.Execute then begin
ComboBox1.Text:=FolderDialog1.Directory+'\winrar.exe';
ComboBox2.Text:=FolderDialog1.Directory+'\unrar.exe';
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if folderDialog1.Execute then begin
combobox3.Text:=FolderDialog1.Directory;
end;
button2.Enabled:=false;
button3.Enabled:=true;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
if FolderDialog1.Execute then begin
combobox4.Text:=FolderDialog1.Directory+'\'+edit2.Text;
end;
button2.Enabled:=true;
button3.Enabled:=false;
//------rar işlemi cmd -------------
memo1.Clear;
if checkbox1.Checked=true then begin
memo1.Lines.Add(combobox1.Text+' a -r -M1 -MD4096 -ibck -Y -k -O+ -ac -ep1 -HP'+edit1.text+' -ag+YYYY-MM-DD-HHMI_ "'+combobox4.Text+'" "'+shortPathName(combobox3.Text)+'"');
memo1.Lines.Add('Close');
end;
if checkbox1.Checked=false then begin
memo1.Lines.Add(combobox1.Text+' a -r -M1 -MD4096 -ibck -Y -k -O+ -ac -ep1 -HP'+edit1.text+' "'+combobox4.Text+'" "'+ShortPathname(combobox3.Text)+'"');
memo1.Lines.Add('Close');
end;
MEMO1.Lines.SaveToFile(GetTempDir+'RAR_CMD_001.BAT');
ShellExecute(Handle, 'open', PChar(GetTempDir+'RAR_CMD_001.BAT'), nil, nil, SW_SHOW);
// PChar(GetTempDir+'RAR_CMD_001.BAT'), nil, nil, SW_HIDE); // İsteğe göre işlem gizli
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
if OpenDialog1.Execute then begin
combobox5.Text:=OpenDialog1.FileName;
end;
Button4.Enabled:=false;
Button5.Enabled:=true;
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
if FolderDialog1.Execute then begin
combobox6.Text:=FolderDialog1.Directory;
end;
memo1.Clear;
memo1.Lines.Add(combobox2.Text+' x '+' -p'+edit3.Text+' '+combobox5.Text+' '+combobox6.Text);
memo1.Lines.Add('close');
MEMO1.Lines.SaveToFile(GetTempDir+'UNRAR_CMD_001.BAT');
ShellExecute(Handle, 'open', PChar(GetTempDir+'UNRAR_CMD_001.BAT'), nil, nil, SW_SHOW);
// PChar(GetTempDir+'UNRAR_CMD_001.BAT'), nil, nil, SW_HIDE); // İsteğe göre işlem gizli
end;
end.
unit1.dfm
object Form1: TForm1
Left = 192
Top = 107
Width = 558
Height = 252
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object PageControl1: TPageControl
Left = 0
Top = 0
Width = 550
Height = 168
ActivePage = TabSheet3
Align = alClient
TabOrder = 0
object TabSheet1: TTabSheet
Caption = 'S'#305'k'#305#351't'#305'r-RAR'
object Label2: TLabel
Left = 104
Top = 12
Width = 41
Height = 13
Caption = 'Rar '#350'ifre'
end
object Label3: TLabel
Left = 2
Top = 37
Width = 93
Height = 13
Caption = 'Ar'#351'ivlenecek Klas'#246'r'
end
object Label4: TLabel
Left = 6
Top = 75
Width = 47
Height = 13
Caption = 'Ar'#351'iv Yolu'
end
object Label5: TLabel
Left = 241
Top = 10
Width = 74
Height = 13
Caption = 'Ar'#351'iv Dosya Ad'#305
end
object Button2: TButton
Left = 344
Top = 30
Width = 121
Height = 25
Caption = 'Ar'#351'ivlenecek Klas'#246'r-Se'#231
TabOrder = 0
OnClick = Button2Click
end
object ComboBox3: TComboBox
Left = 96
Top = 32
Width = 249
Height = 21
ItemHeight = 13
TabOrder = 1
end
object CheckBox1: TCheckBox
Left = 3
Top = 11
Width = 97
Height = 17
Caption = 'Tarihle S'#305'k'#305#351't'#305'r'
TabOrder = 2
end
object Edit1: TEdit
Left = 153
Top = 8
Width = 81
Height = 21
TabOrder = 3
Text = '123456'
end
object ComboBox4: TComboBox
Left = 96
Top = 72
Width = 249
Height = 21
ItemHeight = 13
TabOrder = 4
end
object Button3: TButton
Left = 344
Top = 69
Width = 121
Height = 25
Caption = 'Ar'#351'ivle (Nereye)'
Enabled = False
TabOrder = 5
OnClick = Button3Click
end
object Edit2: TEdit
Left = 320
Top = 4
Width = 145
Height = 21
TabOrder = 6
Text = 'deneme.rar'
end
end
object TabSheet3: TTabSheet
Caption = #199#246'z-UNRAR'
ImageIndex = 2
object Label6: TLabel
Left = 48
Top = 13
Width = 132
Height = 13
Caption = 'Varsa Rar Dosyas'#305'n'#305'n '#350'ifresi'
end
object Button4: TButton
Left = 408
Top = 42
Width = 131
Height = 25
Caption = 'Rar Nerede'
TabOrder = 0
OnClick = Button4Click
end
object ComboBox5: TComboBox
Left = 6
Top = 43
Width = 401
Height = 21
ItemHeight = 13
TabOrder = 1
Text = 'RAR dosyan'#305'z'#305' Se'#231'in'
end
object Button5: TButton
Left = 408
Top = 74
Width = 129
Height = 25
Caption = 'Rar Nerede A'#231#305'ls'#305'n'
TabOrder = 2
OnClick = Button5Click
end
object ComboBox6: TComboBox
Left = 4
Top = 77
Width = 403
Height = 21
ItemHeight = 13
TabOrder = 3
end
object Edit3: TEdit
Left = 192
Top = 8
Width = 121
Height = 21
TabOrder = 4
Text = '123456'
end
end
object TabSheet2: TTabSheet
Caption = 'Ayarlar'
ImageIndex = 1
object Label1: TLabel
Left = 0
Top = 8
Width = 31
Height = 13
Caption = 'Winrar'
end
object ComboBox1: TComboBox
Left = 48
Top = 4
Width = 361
Height = 21
ItemHeight = 13
TabOrder = 0
Text = 'C:\Progra~1\WinRAR\Winrar.exe'
Items.Strings = (
'C:\Program Files\WinRAR\winrar.exe'
'C:\Program Files (x86)\WinRAR\winrar.exe')
end
object Button1: TButton
Left = 416
Top = 0
Width = 113
Height = 25
Caption = 'Winrar Klas'#246'r'#252' Nerede'
TabOrder = 1
OnClick = Button1Click
end
object ComboBox2: TComboBox
Left = 48
Top = 32
Width = 361
Height = 21
ItemHeight = 13
TabOrder = 2
Text = 'C:\Progra~1\WinRAR\Unrar.exe'
Items.Strings = (
'C:\Program Files\WinRAR\unrar.exe'
'C:\Program Files (x86)\WinRAR\unrar.exe')
end
end
end
object Memo1: TMemo
Left = 0
Top = 168
Width = 550
Height = 57
Align = alBottom
ScrollBars = ssVertical
TabOrder = 1
end
object FolderDialog1: TFolderDialog
Caption = 'Winrar Klas'#246'r'#252' Nerede'
DialogX = 0
DialogY = 0
Version = '1.1.0.0'
Left = 8
Top = 184
end
object OpenDialog1: TOpenDialog
Left = 264
Top = 112
end
end