Einzelnen Beitrag anzeigen

greenmile

Registriert seit: 17. Apr 2003
1.107 Beiträge
 
Delphi 10.3 Rio
 
#7

AW: Inno Setup Script gesucht

  Alt 17. Dez 2020, 15:38
Quick and Dirty, aber für den Moment besser als nix.
Wenn "temporär" angeklickt ist, überspringe ich einfach alles bis zur "Fertig für die Installation" Seite. Dort entpacke ich die EXE ins Temp Verzeichnis, starte sie und breche das Setup dann ab.

Code:
var
  UsagePage: TInputOptionWizardPage;

const
  Url        = 'https://www.google.de';
  Url_Caption = 'Google';

procedure UrlLabelClick(Sender: TObject);
  var
    errorCode : integer;
    myURL: String;
begin
  myURL := Url;
  ShellExec('open',myURL,'','',SW_SHOWNORMAL,ewNoWait,errorCode);
end;

procedure InitializeWizard;
  var
    UrlLabel :TNewStaticText;
    CancelBtn :TButton;
begin
  CancelBtn          := WizardForm.CancelButton;
  UrlLabel           := TNewStaticText.Create(WizardForm);
  UrlLabel.Top       := CancelBtn.Top + (CancelBtn.Height div 2) -(UrlLabel.Height div 2);
  UrlLabel.Left      := WizardForm.ClientWidth - CancelBtn.Left -CancelBtn.Width;
  UrlLabel.Font.Style := UrlLabel.Font.Style + [fsUnderline];
  UrlLabel.Cursor    := crHand;
  UrlLabel.Font.Color := clHighlight;
  UrlLabel.OnClick   := @UrlLabelClick;
  UrlLabel.Parent    := WizardForm;
  UrlLabel.Anchors   := [akLeft, akBottom];

  UrlLabel.Caption := ExpandConstant(Url_Caption);

  UsagePage := CreateInputOptionPage(wpInfoBefore,CustomMessage('ProgMode_What1'), '',CustomMessage('ProgMode_SelectTxt'),True, False);
  UsagePage.Add(CustomMessage('ProgMode_Txt_Install'));
  UsagePage.Add(CustomMessage('ProgMode_Txt_TempRun'));

  UsagePage.SelectedValueIndex := 0;
end;

function NextButtonClick(CurPageID: Integer): Boolean;
 var ResultCode: Integer;
begin
  Result := true;
  if (CurPageID=wpReady) and (UsagePage.SelectedValueIndex=1) then begin
    ExtractTemporaryFile('myapp.exe');
    ExecAsOriginalUser(ExpandConstant('{tmp}\myapp.exe'), '-temp', '',SW_SHOWNORMAL, ewNoWait, ResultCode);
    WizardForm.Close;
    Result := false;
  end;
end;

procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
  Confirm := (UsagePage.SelectedValueIndex=0);
end;

function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
begin
  if (UsagePage.SelectedValueIndex=1) then Result := '';
end;

function ShouldSkipPage(PageID: Integer): Boolean;
begin
  Result := false;
  If (UsagePage.SelectedValueIndex=1) then begin
    If (PageID = wpSelectDir) or (PageID = wpSelectProgramGroup) or (PageID = wpSelectTasks) or (PageID=wpFinished) then Result := true;
  End;
end;
  Mit Zitat antworten Zitat