Bladeren bron

Make TDownloadWizardPage.LastBaseNameOrUrl available to [Code].

Martijn Laan 3 maanden geleden
bovenliggende
commit
21b160026c

+ 6 - 2
Examples/CodeDownloadFiles.iss

@@ -59,6 +59,8 @@ begin
 end;
 
 function NextButtonClick(CurPageID: Integer): Boolean;
+var
+  Error: String;
 begin
   if CurPageID = wpReady then begin
     DownloadPage.Clear;
@@ -80,8 +82,10 @@ begin
       except
         if DownloadPage.AbortedByUser then
           Log('Aborted by user.')
-        else
-          SuppressibleMsgBox(AddPeriod(GetExceptionMessage), mbCriticalError, MB_OK, IDOK);
+        else begin
+          Error := Format('%s: %s', [DownloadPage.LastBaseNameOrUrl, GetExceptionMessage]);
+          SuppressibleMsgBox(AddPeriod(Error), mbCriticalError, MB_OK, IDOK);
+        end;
         Result := False;
       end;
     finally

+ 1 - 0
ISHelp/isxclasses.pas

@@ -783,6 +783,7 @@ TDownloadWizardPage = class(TOutputProgressWizardPage)
   function AddExWithISSigVerify(const Url, ISSigUrl, BaseName, UserName, Password: String; const AllowedKeysRuntimeIDs: TStringList: Integer;
   procedure Clear;
   function Download: Int64;
+  property LastBaseNameOrUrl: String; read;
   property ShowBaseNameInsteadOfUrl: Boolean; read write;
 end;
 

+ 19 - 18
ISHelp/isxclasses_wordlists_generated.pas

@@ -182,24 +182,25 @@ var
     'InfoAfterPage', 'InfoBeforeClickLabel', 'InfoBeforeMemo', 'InfoBeforePage', 'InnerNotebook',
     'InnerPage', 'InstallingPage', 'IsSaveButton', 'ItemCaption', 'ItemEnabled', 'ItemFontStyle',
     'ItemIndex', 'ItemLevel', 'ItemObject', 'Items', 'ItemSubItem', 'KeepSizeY', 'KeyPreview',
-    'Left', 'LicenseAcceptedRadio', 'LicenseLabel1', 'LicenseMemo', 'LicenseNotAcceptedRadio',
-    'LicensePage', 'Lines', 'MainPanel', 'Max', 'MaxHeight', 'MaxLength', 'MaxWidth', 'Min',
-    'MinHeight', 'MinItemHeight', 'MinWidth', 'ModalResult', 'Mode', 'Modified', 'Msg1Label',
-    'Msg2Label', 'MsgLabel', 'MultiSelect', 'Name', 'NewFolderName', 'NextButton', 'NoIconsCheck',
-    'NoRadio', 'Notebook', 'Objects', 'Offset', 'OnActivate', 'OnBackButtonClick', 'OnCancelButtonClick',
-    'OnChange', 'OnChanging', 'OnClick', 'OnClickCheck', 'OnClose', 'OnCloseQuery', 'OnCreate',
-    'OnDblClick', 'OnDeactivate', 'OnDestroy', 'OnDropDown', 'OnHide', 'OnKeyDown', 'OnKeyPress',
-    'OnKeyUp', 'OnLinkClick', 'OnNextButtonClick', 'OnRename', 'OnResize', 'OnShouldSkipPage',
-    'OnShow', 'OuterNotebook', 'Owner', 'PageCount', 'PageDescriptionLabel', 'PageIndex',
-    'PageNameLabel', 'Pages', 'Parent', 'ParentBackground', 'Password', 'PasswordChar',
-    'PasswordEdit', 'PasswordEditLabel', 'PasswordLabel', 'PasswordPage', 'Pen', 'Pitch',
-    'Pixels', 'PixelsPerInch', 'PopupMode', 'PopupParent', 'Position', 'PreparingErrorBitmapImage',
-    'PreparingLabel', 'PreparingMemo', 'PreparingNoRadio', 'PreparingPage', 'PreparingYesRadio',
-    'PrevAppDir', 'ProgressBar', 'ProgressGauge', 'PromptLabels', 'ReadOnly', 'ReadyLabel',
-    'ReadyMemo', 'ReadyPage', 'ReplaceColor', 'ReplaceWithColor', 'RequireRadioSelection',
-    'RichEditViewer', 'RightToLeft', 'RTFText', 'RunList', 'ScrollBars', 'SelCount', 'SelectComponentsLabel',
-    'SelectComponentsPage', 'SelectDirBitmapImage', 'SelectDirBrowseLabel', 'SelectDirLabel',
-    'SelectDirPage', 'Selected', 'SelectedValueIndex', 'SelectGroupBitmapImage', 'SelectProgramGroupPage',
+    'LastBaseNameOrUrl', 'Left', 'LicenseAcceptedRadio', 'LicenseLabel1', 'LicenseMemo',
+    'LicenseNotAcceptedRadio', 'LicensePage', 'Lines', 'MainPanel', 'Max', 'MaxHeight',
+    'MaxLength', 'MaxWidth', 'Min', 'MinHeight', 'MinItemHeight', 'MinWidth', 'ModalResult',
+    'Mode', 'Modified', 'Msg1Label', 'Msg2Label', 'MsgLabel', 'MultiSelect', 'Name', 'NewFolderName',
+    'NextButton', 'NoIconsCheck', 'NoRadio', 'Notebook', 'Objects', 'Offset', 'OnActivate',
+    'OnBackButtonClick', 'OnCancelButtonClick', 'OnChange', 'OnChanging', 'OnClick', 'OnClickCheck',
+    'OnClose', 'OnCloseQuery', 'OnCreate', 'OnDblClick', 'OnDeactivate', 'OnDestroy', 'OnDropDown',
+    'OnHide', 'OnKeyDown', 'OnKeyPress', 'OnKeyUp', 'OnLinkClick', 'OnNextButtonClick',
+    'OnRename', 'OnResize', 'OnShouldSkipPage', 'OnShow', 'OuterNotebook', 'Owner', 'PageCount',
+    'PageDescriptionLabel', 'PageIndex', 'PageNameLabel', 'Pages', 'Parent', 'ParentBackground',
+    'Password', 'PasswordChar', 'PasswordEdit', 'PasswordEditLabel', 'PasswordLabel', 'PasswordPage',
+    'Pen', 'Pitch', 'Pixels', 'PixelsPerInch', 'PopupMode', 'PopupParent', 'Position',
+    'PreparingErrorBitmapImage', 'PreparingLabel', 'PreparingMemo', 'PreparingNoRadio',
+    'PreparingPage', 'PreparingYesRadio', 'PrevAppDir', 'ProgressBar', 'ProgressGauge',
+    'PromptLabels', 'ReadOnly', 'ReadyLabel', 'ReadyMemo', 'ReadyPage', 'ReplaceColor',
+    'ReplaceWithColor', 'RequireRadioSelection', 'RichEditViewer', 'RightToLeft', 'RTFText',
+    'RunList', 'ScrollBars', 'SelCount', 'SelectComponentsLabel', 'SelectComponentsPage',
+    'SelectDirBitmapImage', 'SelectDirBrowseLabel', 'SelectDirLabel', 'SelectDirPage',
+    'Selected', 'SelectedValueIndex', 'SelectGroupBitmapImage', 'SelectProgramGroupPage',
     'SelectStartMenuFolderBrowseLabel', 'SelectStartMenuFolderLabel', 'SelectTasksLabel',
     'SelectTasksPage', 'SelLength', 'SelStart', 'SelText', 'Shape', 'ShowAccelChar', 'ShowArchiveInsteadOfFile',
     'ShowBaseNameInsteadOfUrl', 'ShowHint', 'Showing', 'ShowLines', 'Size', 'SizeAndCenterOnShow',

+ 1 - 0
Projects/Src/Compiler.ScriptClasses.pas

@@ -550,6 +550,7 @@ begin
   begin
     RegisterProperty('AbortButton', 'TNewButton', iptr);
     RegisterProperty('AbortedByUser', 'Boolean', iptr);
+    RegisterProperty('LastBaseNameOrUrl', 'String', iptr);
     RegisterProperty('ShowBaseNameInsteadOfUrl', 'Boolean', iptrw);
     RegisterMethod('function Add(const Url, BaseName, RequiredSHA256OfFile: String): Integer');
     RegisterMethod('function AddWithISSigVerify(const Url, ISSigUrl, BaseName: String; const AllowedKeysRuntimeIDs: TStringList): Integer;');

+ 6 - 1
whatsnew.htm

@@ -208,7 +208,12 @@ Source: "https://jrsoftware.org/download.php/iscrypt.dll?dontcount=1"; DestName:
       <li><i>Fix:</i> The return value of support function <tt>ExtractFilePath</tt> did not always include a trailing backslash as intended.</li>
     </ul>
   </li>
-  <li>Pascal Scripting change: Added new <tt>GetSHA256OfStream</tt> support function.</li>
+  <li>Pascal Scripting changes: 
+    <ul>
+      <li>Added new <tt>LastBaseNameOrUrl</tt> property to support class <tt>TDownloadWizardPage</tt>. See updated example script <i>CodeDownloadFiles.iss</i> for an example.</li>
+      <li>Added new <tt>GetSHA256OfStream</tt> support function.</li>
+    </ul>
+  </li>
   <li>Inno Setup 6.4.3 increased the maximum width of all task dialogs by about 50%, which helps to keep long paths from being truncated with ellipses. It now only does this if the task dialog's content actually contains a path.</li>
   <li>All translations which still had an UTF-8 BOM had their BOM removed. Using a BOM in UTF-8 encoded files is not needed and not recommended since Inno Setup 6.3.0.</li>
   <li>Inno Setup is now built using Delphi 12.3 Athens instead of Delphi 12.1 Athens. Thanks to Ian Barker from Embarcadero for providing us with a license!</li>