Новый участник
Сообщения: 4
Благодарности: 0
|
Профиль
|
Отправить PM
| Цитировать
Привет можыте памагати
как правилина писати код в секции Exec
Код: 
procedure CurStepChanged(CurStep: TSetupStep);
begin
If NewCheckBox1.Checked then
begin
Exec('{sys}\net.exe, user 1csupport {code:GetUser|Password1}', '/add, /fullname:""1csupport"", /comment:""1csupport"", /active:yes, /expires:never, /passwordchg:no'), '',;
end;
end;
Вот веси код
Скрытый текст
[code]
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
DisableProgramGroupPage=yes
UninstallDisplayIcon={app}\MyProg.exe
OutputDir=Output
Код: 
{ RedesignWizardFormBegin } // Don't remove this line!
// Don't modify this section. It is generated automatically.
var
authentication: TWizardPage;
PasswordEdit1: TPasswordEdit;
PasswordEdit2: TPasswordEdit;
PasswordEdit3: TPasswordEdit;
PasswordEdit4: TPasswordEdit;
PasswordEdit5: TPasswordEdit;
NewCheckBox1: TNewCheckBox;
NewCheckBox2: TNewCheckBox;
NewCheckBox3: TNewCheckBox;
NewCheckBox4: TNewCheckBox;
NewCheckBox5: TNewCheckBox;
function _NextButtonClick(Sender: TWizardPage): Boolean; forward;
procedure RedesignWizardForm;
begin
{ Creates custom wizard page }
authentication := CreateCustomPage(wpSelectDir, 'ISCustomPage1_Caption', 'ISCustomPage1_Description');
{ authentication }
with authentication.Surface do
begin
authentication.OnNextButtonClick := @_NextButtonClick;
end;
{ PasswordEdit1 }
PasswordEdit1 := TPasswordEdit.Create(WizardForm);
with PasswordEdit1 do
begin
Parent := authentication.Surface;
Left := ScaleX(240);
Top := ScaleY(24);
Width := ScaleX(121);
Height := ScaleY(21);
Text := '';
end;
{ PasswordEdit2 }
PasswordEdit2 := TPasswordEdit.Create(WizardForm);
with PasswordEdit2 do
begin
Parent := authentication.Surface;
Left := ScaleX(240);
Top := ScaleY(64);
Width := ScaleX(121);
Height := ScaleY(21);
Text := '';
end;
{ PasswordEdit3 }
PasswordEdit3 := TPasswordEdit.Create(WizardForm);
with PasswordEdit3 do
begin
Parent := authentication.Surface;
Left := ScaleX(240);
Top := ScaleY(104);
Width := ScaleX(121);
Height := ScaleY(21);
Text := '';
end;
{ PasswordEdit4 }
PasswordEdit4 := TPasswordEdit.Create(WizardForm);
with PasswordEdit4 do
begin
Parent := authentication.Surface;
Left := ScaleX(240);
Top := ScaleY(148);
Width := ScaleX(121);
Height := ScaleY(21);
Text := '';
end;
{ PasswordEdit5 }
PasswordEdit5 := TPasswordEdit.Create(WizardForm);
with PasswordEdit5 do
begin
Parent := authentication.Surface;
Left := ScaleX(240);
Top := ScaleY(192);
Width := ScaleX(121);
Height := ScaleY(21);
Text := '';
end;
{ NewCheckBox1 }
NewCheckBox1 := TNewCheckBox.Create(WizardForm);
with NewCheckBox1 do
begin
Parent := authentication.Surface;
Left := ScaleX(32);
Top := ScaleY(24);
Width := ScaleX(193);
Height := ScaleY(17);
Caption := '1csupport/1csupport2/1csupport3';
end;
{ NewCheckBox2 }
NewCheckBox2 := TNewCheckBox.Create(WizardForm);
with NewCheckBox2 do
begin
Parent := authentication.Surface;
Left := ScaleX(32);
Top := ScaleY(64);
Width := ScaleX(153);
Height := ScaleY(17);
Caption := 'Boss';
end;
{ NewCheckBox3 }
NewCheckBox3 := TNewCheckBox.Create(WizardForm);
with NewCheckBox3 do
begin
Parent := authentication.Surface;
Left := ScaleX(32);
Top := ScaleY(104);
Width := ScaleX(97);
Height := ScaleY(17);
Caption := 'Contabil1';
end;
{ NewCheckBox4 }
NewCheckBox4 := TNewCheckBox.Create(WizardForm);
with NewCheckBox4 do
begin
Parent := authentication.Surface;
Left := ScaleX(32);
Top := ScaleY(148);
Width := ScaleX(177);
Height := ScaleY(17);
Caption := 'Contabil2';
end;
{ NewCheckBox5 }
NewCheckBox5 := TNewCheckBox.Create(WizardForm);
with NewCheckBox5 do
begin
Parent := authentication.Surface;
Left := ScaleX(32);
Top := ScaleY(192);
Width := ScaleX(97);
Height := ScaleY(17);
Caption := 'Contabil3';
end;
PasswordEdit1.TabOrder := 0;
PasswordEdit2.TabOrder := 1;
PasswordEdit3.TabOrder := 2;
PasswordEdit4.TabOrder := 3;
PasswordEdit5.TabOrder := 4;
NewCheckBox1.TabOrder := 5;
NewCheckBox2.TabOrder := 6;
NewCheckBox3.TabOrder := 7;
NewCheckBox4.TabOrder := 8;
NewCheckBox5.TabOrder := 9;
{ ReservationBegin }
// This part is for you. Add your specialized code here.
{ ReservationEnd }
end;
// Don't modify this section. It is generated automatically.
{ RedesignWizardFormEnd } // Don't remove this line!
procedure PasswordEdit1Change(Sender: TObject);
begin
end;
procedure InitializeWizard();
begin
RedesignWizardForm;
end;
function GetUser(Param: String ): String;
begin
if Param = 'Password1' then
Result := PasswordEdit1.Text;
begin
if Param = 'Password2' then
Result := PasswordEdit1.Text;
begin
if Param = 'Password3' then
Result := PasswordEdit1.Text;
begin
if Param = 'Password4' then
Result := PasswordEdit1.Text;
begin
if Param = 'Password5' then
Result := PasswordEdit1.Text;
end;
end;
end;
end;
end;
function _NextButtonClick(authentication: TWizardPage): Boolean;
var
ResultCode: Integer;
begin
if NewCheckBox1.Checked then begin
if PasswordEdit1.Text = '' then begin
MsgBox('Введите пароль 1csupport/1csupport2/1csupport3!', mbError, MB_OK);
Result := False;
end;
end;
if NewCheckBox2.Checked then begin
if PasswordEdit2.Text = '' then begin
MsgBox('Введите пароль Boss!', mbError, MB_OK);
Result := False;
end;
end;
if NewCheckBox3.Checked then begin
if PasswordEdit3.Text = '' then begin
MsgBox('Введите пароль Contabil1!', mbError, MB_OK);
Result := False;
end;
end;
if NewCheckBox4.Checked then begin
if PasswordEdit4.Text = '' then begin
MsgBox('Введите пароль Contabil2!', mbError, MB_OK);
Result := False;
end;
end;
if NewCheckBox5.Checked then begin
if PasswordEdit5.Text = '' then begin
MsgBox('Введите пароль Contabil3!', mbError, MB_OK);
Result := False;
end;
end;
end;
function GetCheckBox1(): Boolean;
begin
if Param = 'Password1' then
Result := PasswordEdit1.Text;
begin
if Param = 'Password2' then
Result := PasswordEdit1.Text;
begin
if Param = 'Password3' then
Result := PasswordEdit1.Text;
begin
if Param = 'Password4' then
Result := PasswordEdit1.Text;
begin
if Param = 'Password5' then
Result := PasswordEdit1.Text;
end;
end;
end;
end;
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
If NewCheckBox1.Checked then
begin
Exec('{sys}\net.exe, user 1csupport {code:GetUser|Password1}', '/add, /fullname:""1csupport"", /comment:""1csupport"", /active:yes, /expires:never, /passwordchg:no'), '',;
end;
begin
If NewCheckBox2.Checked then
begin
Exec('{sys}\net.exe', 'user 1csupport {code:GetUser|Password1}', '/add', '/fullname:""1csupport""', '/comment:""1csupport""', '/active:yes', '/expires:never', '/passwordchg:no');
end;
begin
If NewCheckBox3.Checked then
begin
Exec('{sys}\net.exe', 'user 1csupport {code:GetUser|Password1}', '/add', '/fullname:""1csupport""', '/comment:""1csupport""', '/active:yes', '/expires:never', '/passwordchg:no');
end;
begin
If NewCheckBox4.Checked then
begin
Exec('{sys}\net.exe', 'user 1csupport {code:GetUser|Password1}', '/add', '/fullname:""1csupport""', '/comment:""1csupport""', '/active:yes', '/expires:never', '/passwordchg:no');
end;
begin
If NewCheckBox5.Checked then
begin
Exec('{sys}\net.exe', 'user 1csupport {code:GetUser|Password1}', '/add', '/fullname:""1csupport""', '/comment:""1csupport""', '/active:yes', '/expires:never', '/passwordchg:no');
end;
end;
end;
end;
end;
end;
|