2014-11-21 28 views
0

这里是我的Inno Setup的脚本:Inno-检查如果一个进程正在运行,并显示一个消息框,如果它的运行和...做一些其他的事情

;InnoSetupVersion=5.5.0 
;Script made in Inno Setup Ultra v5.5.1.ee2 

[Setup] 
AppName=Adobe Flash Player 15 + Shockwave Player 12 + Adobe Air 15 - AiO 
AppVersion=15.12.15 
AppPublisher=Adobe Systems, Inc. 
AppPublisherURL=www.adobe.com 
OutputBaseFilename=AdobeRuntimes_AiO_15.12.15_niTe.RiDeR 
Compression=lzma2/ultra64 
Uninstallable=no 
DisableProgramGroupPage=yes 
WizardImageFile=embedded\WizardImage.bmp 
LicenseFile=embedded\LicenseAgreement.rtf 
SolidCompression=yes 
InternalCompressLevel=ultra 
SetupIconFile=embedded\SetupIcon.ico 
WizardSmallImageFile=embedded\WizardSmallImage.bmp 
VersionInfoVersion=15.12.15 
VersionInfoCompany=Adobe Systems Incorporated 
VersionInfoDescription=Adobe Runtimes AiO (Adobe Shockwave Player v12.1.4.154 + Flash Player v15.0.0.223 + Adobe AIR) RePacked Setup 
VersionInfoProductName=Adobe Runtimes AiO 
VersionInfoProductVersion=15.12.15 
VersionInfoProductTextVersion=12.12.15 
CreateAppDir=False 

[Files] 
Source: "{app}\install_flash_player_15_active_x.exe"; DestDir: "{tmp}"; Components: flashactivex; MinVersion: 0.0,5.01; Flags: deleteafterinstall 
Source: "{app}\install_flash_player_15_plugin.exe"; DestDir: "{tmp}"; Components: flashplugin; MinVersion: 0.0,5.01; Flags: deleteafterinstall 
Source: "{app}\sw_lic_full_installer.msi"; DestDir: "{tmp}"; Components: shockwave; MinVersion: 0.0,5.01; Flags: deleteafterinstall 
Source: "{app}\AdobeAIRInstaller.exe"; DestDir: "{tmp}"; Components: air; MinVersion: 0.0,5.01; Flags: deleteafterinstall 
Source: "embedded\ISWin7.dll"; DestDir: "{tmp}"; Flags: dontcopy nocompression 

[Run] 
Filename: "{tmp}\install_flash_player_15_active_x.exe"; Parameters: "-install"; StatusMsg: "Installing Flash Player 15 ActiveX; This can take a few minutes & the installer will freeze for a few seconds, so please wait..."; Components: flashactivex; MinVersion: 0.0,5.01; 
Filename: "{tmp}\install_flash_player_15_plugin.exe"; Parameters: "-install"; StatusMsg: "Installing Flash Player 15 Plugin; this can take few minutes & the installer will freeze for a few seconds, so please wait..."; Components: flashplugin; MinVersion: 0.0,5.01; 
Filename: "{tmp}\sw_lic_full_installer.exe"; Parameters: "/qb"; StatusMsg: "Installing Shockwave Player 12; This could take a few minutes & the installer will freeze for a few seconds, so please wait..."; Components: shockwave; MinVersion: 0.0,5.01; 
Filename: "{tmp}\AdobeAIRInstaller.exe"; Parameters: "-silent"; StatusMsg: "Installing Adobe AIR 15; this may take a few minutes & the installer will freeze for a few seconds, so please wait..."; Components: air; MinVersion: 0.0,5.01; 

[Components] 
Name: "flashplugin"; Description: "Adobe Flash Player v15.0.0.223 Plugin"; Types: "compact full"; MinVersion: 0.0,5.01; ExtraDiskSpaceRequired: 10485760 
Name: "flashactivex"; Description: "Adobe Flash Player v15.0.0.223 ActiveX"; Types: "compact full"; MinVersion: 0.0,5.01; ExtraDiskSpaceRequired: 10485760 
Name: "shockwave"; Description: "Adobe Shockwave Player v12.1.4.154"; Types: "compact full"; MinVersion: 0.0,5.01; ExtraDiskSpaceRequired: 10485760 
Name: "air"; Description: "Adobe AIR v15.0.0.356"; Types: "full"; MinVersion: 0.0,5.01; ExtraDiskSpaceRequired: 10485760 

[Messages] 
SelectComponentsLabel2=Select the runtimes you want to install; clear the runtimes you do not want to install. Click Next when you are ready to continue. 
WizardSelectComponents=Select Runtimes 
SelectComponentsDesc=Which runtimes should be installed? 

[Code] 
{ RedesignWizardFormBegin } // Don't remove this line! 
// Don't modify this section. It is generated automatically. 
var 
    ISCustomPage2: TWizardPage; 
    ISCustomPage3: TWizardPage; 
    ISCustomPage1: TWizardPage; 
    ISCustomPage4: TWizardPage; 
    Label1: TLabel; 
    Label2: TLabel; 
    Label3: TLabel; 
    Label4: TLabel; 
    Label5: TLabel; 
    Label6: TLabel; 
    Label7: TLabel; 

procedure RedesignWizardForm; 
begin 
    { Creates custom wizard page } 
    ISCustomPage4 := CreateCustomPage(wpWelcome, 'Description', 'A Description of the Runtimes (Components)'); 

    with WizardForm do 
    begin 
    AutoScroll := False; 
    ClientHeight := ScaleY(363); 
    ClientWidth := ScaleX(490); 
    Caption := 'Setup - Adobe Runtimes AiO RePack'; 
    end; 

    with WizardForm.CancelButton do 
    begin 
    Left := ScaleX(404); 
    end; 

    with WizardForm.NextButton do 
    begin 
    Left := ScaleX(319); 
    end; 

    with WizardForm.BackButton do 
    begin 
    Left := ScaleX(244); 
    end; 

    with WizardForm.WizardBitmapImage do 
    begin 
    Width := ScaleX(180); 
    end; 

    with WizardForm.WelcomeLabel2 do 
    begin 
    Caption := 'This will install Adobe Flash Player 15 + Shockwave Player 12 + Adobe Air 15 - AiO on your computer.' + #13#10 + 
     '' + #13#10 + 
     'It is recommended that you close all other applications before continuing.' + #13#10 + 
     'You can choose which runtimes to install.' + #13#10 + 
     '' + #13#10 + 
     'Click Next to continue, or Cancel to exit Setup.'; 
    Left := ScaleX(184); 
    Top := ScaleY(96); 
    Width := ScaleX(293); 
    Height := ScaleY(212); 
    end; 

    with WizardForm.WelcomeLabel1 do 
    begin 
    Caption := 'Welcome to the Adobe Runtimes AIO Setup Wizard by -=niTe_RiDeR_Pro=-'; 
    Left := ScaleX(184); 
    Width := ScaleX(307); 
    Height := ScaleY(78); 
    end; 

    with WizardForm.ComponentsList do 
    begin 
    Top := ScaleY(69); 
    end; 

    { Label7 } 
    Label7 := TLabel.Create(WizardForm); 
    with Label7 do 
    begin 
    Name := 'Label7'; 
    Parent := WizardForm; 
    Caption := 'RePack by niTe_RiDeR_Pro'; 
    Font.Color := clWindowText; 
    Font.Height := -11; 
    Font.Name := 'Tahoma'; 
    Font.Style := [fsItalic]; 
    ParentFont := False; 
    Left := ScaleX(14); 
    Top := ScaleY(331); 
    Width := ScaleX(130); 
    Height := ScaleY(13); 
    end; 

    { ISCustomPage4 } 
    with ISCustomPage4.Surface do 
    begin 
    Color := clBtnFace; 
    end; 

    { Label1 } 
    Label1 := TLabel.Create(WizardForm); 
    with Label1 do 
    begin 
    Parent := ISCustomPage4.Surface; 
    Caption := 'Adobe Flash Player:'; 
    Font.Color := clWindowText; 
    Font.Height := -11; 
    Font.Name := 'Tahoma'; 
    Font.Style := [fsBold]; 
    ParentFont := False; 
    Left := ScaleX(8); 
    Top := ScaleY(8); 
    Width := ScaleX(110); 
    Height := ScaleY(13); 
    end; 

    { Label2 } 
    Label2 := TLabel.Create(WizardForm); 
    with Label2 do 
    begin 
    Parent := ISCustomPage4.Surface; 
    AutoSize := False; 
    Caption := 'Adobe Flash Player is the standard for delivering high-impact, rich Web content. ' + #13#10 + 
     'Designs, animation, and application user interfaces are deployed immediately across' + #13#10 + 
     'attracting and engaging users with a rich Web experience.'; 
    Left := ScaleX(8); 
    Top := ScaleY(24); 
    Width := ScaleX(407); 
    Height := ScaleY(61); 
    end; 

    { Label3 } 
    Label3 := TLabel.Create(WizardForm); 
    with Label3 do 
    begin 
    Parent := ISCustomPage4.Surface; 
    Caption := 'Adobe Shockwave Player:'; 
    Font.Color := clWindowText; 
    Font.Height := -11; 
    Font.Name := 'Tahoma'; 
    Font.Style := [fsBold]; 
    ParentFont := False; 
    Left := ScaleX(8); 
    Top := ScaleY(80); 
    Width := ScaleX(145); 
    Height := ScaleY(13); 
    end; 

    { Label4 } 
    Label4 := TLabel.Create(WizardForm); 
    with Label4 do 
    begin 
    Parent := ISCustomPage4.Surface; 
    Caption := 'Shockwave Player is the web standard for powerful multimedia playback. The ' + #13#10 + 
     'Shockwave Player allows you to view interactive web content like games,' + #13#10 + 
     ' business presentations, entertainment, and advertisements from your web browser. '; 
    Left := ScaleX(8); 
    Top := ScaleY(96); 
    Width := ScaleX(412); 
    Height := ScaleY(39); 
    end; 

    { Label5 } 
    Label5 := TLabel.Create(WizardForm); 
    with Label5 do 
    begin 
    Parent := ISCustomPage4.Surface; 
    Caption := 'Adobe AIR:'; 
    Font.Color := clWindowText; 
    Font.Height := -11; 
    Font.Name := 'Tahoma'; 
    Font.Style := [fsBold]; 
    ParentFont := False; 
    Left := ScaleX(8); 
    Top := ScaleY(152); 
    Width := ScaleX(63); 
    Height := ScaleY(13); 
    end; 

    { Label6 } 
    Label6 := TLabel.Create(WizardForm); 
    with Label6 do 
    begin 
    Parent := ISCustomPage4.Surface; 
    Caption := 'Adobe AIR is a cross-operating-system runtime that lets developers combine HTML, ' + #13#10 + 
     'JavaScript, Adobe Flash® and Flex technologies, and ActionScript®; and also lets ' + #13#10 + 
     'users to deploy rich Internet applications (RIAs) on a broad range of devices including ' + #13#10 + 
     'desktop computers, netbooks, tablets, smartphones, and TVs. '; 
    Left := ScaleX(8); 
    Top := ScaleY(168); 
    Width := ScaleX(415); 
    Height := ScaleY(52); 
    end; 

    with WizardForm.MainPanel do 
    begin 
    Left := ScaleX(0); 
    Top := ScaleY(0); 
    end; 

    with WizardForm.PageDescriptionLabel do 
    begin 
    Transparent := True; 
    Left := ScaleX(24); 
    Top := ScaleY(29); 
    end; 

    with WizardForm.PageNameLabel do 
    begin 
    AutoSize := True; 
    Left := ScaleX(16); 
    Top := ScaleY(8); 
    Width := ScaleX(4); 
    end; 

{ 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 ISCustomPage1Activate(Sender: TWizardPage); 
begin 

end; 

procedure iswin7_add_glass(Handle:HWND; Left, Top, Right, Bottom : Integer; GDIPLoadMode: boolean); 
external '[email protected]:iswin7.dll stdcall'; 
procedure iswin7_add_button(Handle:HWND); 
external '[email protected]:iswin7.dll stdcall'; 
procedure iswin7_free; 
external '[email protected]:iswin7.dll stdcall'; 

procedure InitializeWizard(); 
begin 
    RedesignWizardForm; 
    iswin7_add_button(WizardForm.BackButton.Handle); 
    iswin7_add_button(WizardForm.NextButton.Handle); 
    iswin7_add_button(WizardForm.CancelButton.Handle); 
    iswin7_add_glass(WizardForm.Handle, 0, 0, 0, ScaleY(50), True); 
end; 

procedure DeinitializeSetup(); 
begin 
    iswin7_free; 
end; 

在安装的时候,我想做下面的事情,如果用户选择了名为“flashplugin”的成分:

  • 检查是否进程“的chrome.exe” &“firefox.exe”运行,并显示一个消息框,如果它正在运行。如果谷歌浏览器正在运行,消息框应显示“谷歌浏览器正在运行。请关闭它,否则设置会自动关闭它。如果Firefox正在运行,那么messsage框应显示'Mozilla Firefox正在运行。请关闭它,否则安装程序会自动关闭它。如果用户选择“确定”,并且仍然有任何进程打开,则安装程序应该自动将其终止。

这是什么pascal编码?

我将不胜感激这个答案。谢谢:)

回答

0

可能是重复的,但是这个answer可能对您有所帮助。感谢Andrew Seaford:

[Code] 
function IsAppRunning(const FileName: string): Boolean; 
var 
    FWMIService: Variant; 
    FSWbemLocator: Variant; 
    FWbemObjectSet: Variant; 
begin 
    Result := false; 
    FSWbemLocator := CreateOleObject('WBEMScripting.SWBEMLocator'); 
    FWMIService := FSWbemLocator.ConnectServer('', 'root\CIMV2', '', ''); 
    FWbemObjectSet := FWMIService.ExecQuery(Format('SELECT Name FROM Win32_Process Where Name="%s"',[FileName])); 
    Result := (FWbemObjectSet.Count > 0); 
    FWbemObjectSet := Unassigned; 
    FWMIService := Unassigned; 
    FSWbemLocator := Unassigned; 
end; 

function InitializeSetup: boolean; 
begin 
    Result := not IsAppRunning('notepad.exe'); 
    if not Result then 
    MsgBox('notepad.exe is running. Please close the application before running the installer ', mbError, MB_OK); 
end; 
+0

很酷的提示:它不是礼貌的(需要等)来粘贴你的整个代码:p – 2015-09-18 13:56:43

相关问题