Foro de elhacker.net

Programación => Scripting => Mensaje iniciado por: Eleкtro en 17 Abril 2013, 13:21 pm



Título: [APORTE] [Inno Setup] Plantilla para usarla como script por defecto.
Publicado por: Eleкtro en 17 Abril 2013, 13:21 pm
A petición de un usuario aquí tienen la plantilla por defecto que uso para mis instaladores...


Setup.iss

Código
  1. ; = = = = = = = = = = = = = = = = = = =
  2. ; Default Template (by Elektro H@cker) |
  3. ;                                      |
  4. ;            InnoSetup 5.5.3           |
  5. ; = = = = = = = = = = = = = = = = = = =
  6.  
  7. [Setup]
  8.  
  9. ; Info
  10. ; ----
  11. #define Name "Application"
  12. #define Version "1.0"
  13. #define EXE "Application.exe"
  14. AppName={#Name}
  15. AppVersion={#Version}
  16. AppVerName={#Name} {#Version}
  17. AppCopyright=Elektro H@cker
  18. AppPublisher=Elektro H@cker
  19.  
  20. ; Paths
  21. ; -----
  22. DefaultDirName={pf}\{#Name}
  23. DefaultGroupName={#Name}
  24. OutputDir=.\Output\
  25. OutputBaseFilename={#Name}
  26. UninstallDisplayIcon={app}\{#EXE}
  27.  
  28. ; Resources
  29. ; ---------
  30. ;SetupIconFile=Icon.ico
  31. ;WizardImageFile=Icon.bmp
  32. ;WizardSmallImageFile=Icon.bmp
  33. ;InfoBeforeFile=Info.txt
  34.  
  35. ; Compression
  36. ; -----------
  37. Compression=lzma/ultra
  38. InternalCompressLevel=Ultra
  39. SolidCompression=True
  40.  
  41. ; Appearance
  42. ; ----------
  43. AlwaysShowComponentsList=False
  44. DisableDirPage=True
  45. DisableProgramGroupPage=True
  46. DisableReadyPage=True
  47. DisableStartupPrompt=True
  48. FlatComponentsList=False
  49. LanguageDetectionMethod=None
  50. PrivilegesRequired=PowerUser
  51. RestartIfNeededByRun=False
  52. ShowLanguageDialog=NO
  53. ShowTasksTreeLines=True
  54. Uninstallable=True
  55. ArchitecturesAllowed=x86 x64
  56. ;ArchitecturesInstallIn64BitMode=x64
  57.  
  58. [Languages]
  59. Name: spanish; MessagesFile: compiler:Languages\Spanish.isl
  60.  
  61. [Dirs]
  62. ;{sd}                  = C:\
  63. ;{commonappdata}       = C:\ProgramData
  64. ;{sd}\Users\{username} = C:\Users\UserName
  65. ;{userdesktop}         = C:\Users\UserName\Desktop
  66. ;{localappdata}        = C:\Users\UserName\AppData\Local
  67. ;{userappdata}         = C:\Users\UserName\AppData\Roaming
  68. ;{userstartmenu}       = C:\Users\UserName\AppData\Roaming\Microsoft\Windows\Start Menu
  69.  
  70. [Files]
  71. ;Source: {app}\*.*; DestDir: {app}; DestName:; Attribs:; Flags:;
  72. ;Attribs: ReadOnly Hidden System
  73. ;DestName: Example.exe
  74. ;Flags: 32bit 64bit Deleteafterinstall IgnoreVersion NoCompression Onlyifdoesntexist recursesubdirs uninsneveruninstall
  75.  
  76. [Registry]
  77. ;Root: HKCR; Subkey: SystemFileAssociations\.ext\Shell\OPTION; ValueName: Icon; ValueType: String; ValueData: {app}\{#Exe}; Flags: ;
  78. ;Root: HKCR; Subkey: SystemFileAssociations\.ext\Shell\OPTION\Command; ValueType: String; ValueData: """{app}\{#Exe}"" ""%1"""; Flags: ;
  79. ;Flags: uninsdeletevalue uninsdeletekey
  80.  
  81. [Tasks]
  82. ;Name: Identifier; Description: Title; GroupDescription: Group; Flags:;
  83. ;Flags: Unchecked
  84.  
  85. [Run]
  86. ;Filename: "{cmd}"; Parameters: "/C command"; StatusMsg: "Installing..."; Flags: RunHidden WaitUntilTerminated
  87. ;Filename: {app}\{#Exe}; Description: {cm:LaunchProgram,{#Nombre}}; Flags: NoWait PostInstall SkipIfSilent ShellExec Unchecked
  88. ;Flags: 32bit 64bit RunHidden WaitUntilTerminated NoWait PostInstall SkipIfSilent ShellExec Unchecked
  89.  
  90. [Icons]
  91. Name: {userstartmenu}\Programs\{#Name}; Filename: {app}\{#Exe}; Iconfilename: {app}\{#Exe}; WorkingDir: {app}
  92.  
  93. [Code]
  94.  
  95. const
  96.  Custom_Height = 440;
  97.  Custom_ProgressBar_Height = 20;
  98.  Page_Color = clwhite;
  99.  Page_Color_Alternative1 = clblack;
  100.  Page_Color_Alternative2 = clwhite;
  101.  Font_Color = clblack;
  102.  
  103.  
  104. var
  105.  DefaultTop,
  106.  DefaultLeft,
  107.  DefaultHeight,
  108.  DefaultBackTop,
  109.  DefaultNextTop,
  110.  DefaultCancelTop,
  111.  DefaultBevelTop,
  112.  DefaultOuterHeight: Integer;
  113.  
  114.  
  115. procedure InitializeWizard();
  116. begin
  117.  
  118.  DefaultTop := WizardForm.Top;
  119.  DefaultLeft := WizardForm.Left;
  120.  DefaultHeight := WizardForm.Height;
  121.  DefaultBackTop := WizardForm.BackButton.Top;
  122.  DefaultNextTop := WizardForm.NextButton.Top;
  123.  DefaultCancelTop := WizardForm.CancelButton.Top;
  124.  DefaultBevelTop := WizardForm.Bevel.Top;
  125.  DefaultOuterHeight := WizardForm.OuterNotebook.Height;
  126.  
  127.  
  128.  // Pages (Size)
  129.  WizardForm.Height := Custom_Height;
  130.  WizardForm.InnerPage.Height := WizardForm.InnerPage.Height + (Custom_Height - DefaultHeight);
  131.  WizardForm.LicensePage.Height := WizardForm.LicensePage.Height + (Custom_Height - DefaultHeight);
  132.  
  133.  
  134.  // Pages (Color)
  135.  WizardForm.color := Page_Color_Alternative1;
  136.  WizardForm.FinishedPage.Color  := Page_Color;
  137.  WizardForm.InfoAfterPage.Color := Page_Color;
  138.  WizardForm.InfoBeforePage.Color := Page_Color;
  139.  WizardForm.InnerPage.Color := Page_Color;
  140.  WizardForm.InstallingPage.color := Page_Color;
  141.  WizardForm.LicensePage.Color := Page_Color;
  142.  WizardForm.PasswordPage.color := Page_Color;
  143.  WizardForm.PreparingPage.color := Page_Color;
  144.  WizardForm.ReadyPage.Color := Page_Color;
  145.  WizardForm.SelectComponentsPage.Color  := Page_Color;
  146.  WizardForm.SelectDirPage.Color  := Page_Color;
  147.  WizardForm.SelectProgramGroupPage.color := Page_Color;
  148.  WizardForm.SelectTasksPage.color := Page_Color;
  149.  WizardForm.UserInfoPage.color := Page_Color;
  150.  WizardForm.WelcomePage.color := Page_Color;
  151.  
  152.  
  153.  // Controls (Size)
  154.  WizardForm.InfoAfterMemo.Height := (Custom_Height - (DefaultHeight / 2));
  155.  WizardForm.InfoBeforeMemo.Height := (Custom_Height - (DefaultHeight / 2));
  156.  WizardForm.InnerNotebook.Height :=  WizardForm.InnerNotebook.Height + (Custom_Height - DefaultHeight);
  157.  WizardForm.LicenseMemo.Height := WizardForm.LicenseMemo.Height + (Custom_Height - DefaultHeight);
  158.  WizardForm.OuterNotebook.Height := WizardForm.OuterNotebook.Height + (Custom_Height - DefaultHeight);
  159.  WizardForm.ProgressGauge.Height := Custom_ProgressBar_Height
  160.  WizardForm.ReadyMemo.Height := (Custom_Height - (DefaultHeight / 2));
  161.  WizardForm.Taskslist.Height := (Custom_Height - (DefaultHeight / 2));
  162.  WizardForm.WizardBitmapImage.Height := (Custom_Height - (DefaultHeight - DefaultBevelTop));
  163.  WizardForm.WizardBitmapImage2.Height  := (Custom_Height - (DefaultHeight - DefaultBevelTop));
  164.  
  165.  
  166.  // Controls (Location)
  167.  WizardForm.BackButton.Top := DefaultBackTop + (Custom_Height - DefaultHeight);
  168.  WizardForm.Bevel.Top := DefaultBevelTop + (Custom_Height - DefaultHeight);
  169.  WizardForm.CancelButton.Top := DefaultCancelTop + (Custom_Height - DefaultHeight);
  170.  WizardForm.LicenseAcceptedRadio.Top := WizardForm.LicenseAcceptedRadio.Top + (Custom_Height - DefaultHeight);
  171.  WizardForm.LicenseNotAcceptedRadio.Top := WizardForm.LicenseNotAcceptedRadio.Top + (Custom_Height - DefaultHeight);
  172.  WizardForm.NextButton.Top := DefaultNextTop + (Custom_Height - DefaultHeight);
  173.  WizardForm.Top := DefaultTop - (Custom_Height - DefaultHeight) div 2;
  174.  //WizardForm.ProgressGauge.Top := (DefaultHeight / 2)
  175.  
  176.  
  177.  // Controls (Back Color)
  178.  WizardForm.DirEdit.Color  := Page_Color_Alternative2;
  179.  WizardForm.GroupEdit.Color  := Page_Color_Alternative2;
  180.  WizardForm.InfoAfterMemo.Color := Page_Color_Alternative2;
  181.  WizardForm.InfoBeforeMemo.Color := Page_Color_Alternative2;
  182.  WizardForm.LicenseMemo.Color := Page_Color_Alternative2;
  183.  WizardForm.MainPanel.Color := Page_Color;
  184.  WizardForm.PasswordEdit.Color  := Page_Color_Alternative2;
  185.  WizardForm.ReadyMemo.Color := Page_Color_Alternative2;
  186.  WizardForm.Taskslist.Color := Page_Color;
  187.  WizardForm.UserInfoNameEdit.Color  := Page_Color_Alternative2;
  188.  WizardForm.UserInfoOrgEdit.Color  := Page_Color_Alternative2;
  189.  WizardForm.UserInfoSerialEdit.Color  := Page_Color_Alternative2;
  190.  
  191.  
  192.  // Controls (Font Color)
  193.  WizardForm.FinishedHeadingLabel.font.color  := Font_Color;
  194.  WizardForm.InfoafterMemo.font.Color  := Font_Color;
  195.  WizardForm.FinishedLabel.font.color  := Font_Color;
  196.  WizardForm.DirEdit.font.Color  := Page_Color_Alternative1;
  197.  WizardForm.Font.color := Font_Color;
  198.  WizardForm.GroupEdit.font.Color  := Page_Color_Alternative1;
  199.  WizardForm.InfoBeforeMemo.font.Color  := Page_Color_Alternative1;
  200.  WizardForm.LicenseMemo.font.Color  := Page_Color_Alternative1;
  201.  WizardForm.MainPanel.font.Color := Font_Color;
  202.  WizardForm.PageDescriptionLabel.font.color  := Font_Color;
  203.  WizardForm.PageNameLabel.font.color  := Font_Color;
  204.  WizardForm.PasswordEdit.font.Color  := Page_Color_Alternative1;
  205.  WizardForm.Taskslist.font.Color  := Font_Color;
  206.  WizardForm.UserInfoNameEdit.font.Color  := Page_Color_Alternative1;
  207.  WizardForm.UserInfoOrgEdit.font.Color  := Page_Color_Alternative1;
  208.  WizardForm.UserInfoSerialEdit.font.Color  := Page_Color_Alternative1;
  209.  WizardForm.WelcomeLabel1.font.color  := Font_Color;
  210.  WizardForm.WelcomeLabel2.font.color  := Font_Color;
  211.  WizardForm.ReadyMemo.font.Color := Page_Color_Alternative1;
  212.  
  213. end;


Este es el aspecto por defecto:

(http://img560.imageshack.us/img560/6462/prtscrcaptureyq.jpg)


Y se puede customizar un poco el aspecto para conseguir algo parecido a esto, sólamente cambiando las variables de la plantilla...

(http://img4.imageshack.us/img4/3879/prtscrcapturelh.jpg)[/code]