论坛风格切换切换到宽版
  • 2699阅读
  • 6回复

请教老虎版主怎么修正这个脚本? [复制链接]

上一主题 下一主题
离线546242502
 

发帖
332
金钱
-3060
威望
-306
只看楼主 倒序阅读 0 发表于: 2015-08-30
  1. ; Inno Setup
  2. ; Copyright (C) 1997-2012 Jordan Russell. All rights reserved.
  3. ; Portions by Martijn Laan
  4. ; For conditions of distribution and use, see LICENSE.TXT.
  5. ;
  6. ; Setup script
  7. [Setup]
  8. AppName=Inno Setup
  9. AppId=Inno Setup 5
  10. AppVersion=5.5.6
  11. AppPublisher=jrsoftware.org
  12. AppPublisherURL=http://www.innosetup.com/
  13. AppSupportURL=http://www.innosetup.com/
  14. AppUpdatesURL=http://www.innosetup.com/
  15. VersionInfoCopyright=Copyright (C) 1997-2012 Jordan Russell. Portions Copyright (C) 2000-2012 Martijn Laan.
  16. AppMutex=InnoSetupCompilerAppMutex,Global\InnoSetupCompilerAppMutex
  17. SetupMutex=InnoSetupCompilerSetupMutex,Global\InnoSetupCompilerSetupMutex
  18. MinVersion=0,5.0
  19. DefaultDirName={pf}\Inno Setup 5
  20. DefaultGroupName=Inno Setup 5
  21. AllowNoIcons=yes
  22. Compression=lzma2/max
  23. SolidCompression=yes
  24. Uninstallable=not PortableCheck
  25. UninstallDisplayIcon={app}\Compil32.exe
  26. LicenseFile=license.txt
  27. TimeStampsInUTC=yes
  28. TouchDate=none
  29. TouchTime=00:00
  30. WizardImageFile=compiler:WizModernImage-IS.bmp
  31. WizardSmallImageFile=compiler:WizModernSmallImage-IS.bmp
  32. #ifndef NOSIGNTOOL
  33. SignTool=issigntool
  34. SignedUninstaller=yes
  35. #endif
  36. [Languages]
  37. Name: en; MessagesFile: "files\Default.isl"
  38. Name: br; MessagesFile: "files\Languages\BrazilianPortuguese.isl"
  39. Name: ca; MessagesFile: "files\Languages\Catalan.isl"
  40. Name: co; MessagesFile: "files\Languages\Corsican.isl"
  41. Name: cz; MessagesFile: "files\Languages\Czech.isl"
  42. Name: da; MessagesFile: "files\Languages\Danish.isl"
  43. Name: nl; MessagesFile: "files\Languages\Dutch.isl"
  44. Name: fi; MessagesFile: "files\Languages\Finnish.isl"
  45. Name: fr; MessagesFile: "files\Languages\French.isl"
  46. Name: de; MessagesFile: "files\Languages\German.isl"
  47. Name: gr; MessagesFile: "files\Languages\Greek.isl"
  48. Name: he; MessagesFile: "files\Languages\Hebrew.isl"
  49. Name: hu; MessagesFile: "files\Languages\Hungarian.isl"
  50. Name: it; MessagesFile: "files\Languages\Italian.isl"
  51. Name: ja; MessagesFile: "files\Languages\Japanese.isl"
  52. #ifdef UNICODE
  53. Name: nep; MessagesFile: "files\Languages\Nepali.islu"
  54. #endif
  55. Name: no; MessagesFile: "files\Languages\Norwegian.isl"
  56. Name: pl; MessagesFile: "files\Languages\Polish.isl"
  57. Name: pt; MessagesFile: "files\Languages\Portuguese.isl"
  58. Name: ru; MessagesFile: "files\Languages\Russian.isl"
  59. Name: sg; MessagesFile: "files\Languages\ScottishGaelic.isl"
  60. Name: se; MessagesFile: "files\Languages\SerbianLatin.isl"
  61. Name: se2; MessagesFile: "files\Languages\SerbianCyrillic.isl"
  62. Name: sl2; MessagesFile: "files\Languages\Slovenian.isl"
  63. Name: sp; MessagesFile: "files\Languages\Spanish.isl"
  64. Name: tu; MessagesFile: "files\Languages\Turkish.isl"
  65. Name: uk; MessagesFile: "files\Languages\Ukrainian.isl"
  66. [Messages]
  67. ; two "Setup" on the same line looks weird, so put a line break in between
  68. en.WelcomeLabel1=Welcome to the Inno Setup%nSetup Wizard
  69. [Tasks]
  70. Name: desktopicon; Description: "{cm:CreateDesktopIcon}"; Flags: unchecked
  71. Name: fileassoc; Description: "{cm:AssocFileExtension,Inno Setup,.iss}"
  72. [InstallDelete]
  73. ; Remove Unicode-only files if needed
  74. #ifndef UNICODE
  75. Type: files; Name: "{app}\Languages\Nepali.islu"
  76. #endif
  77. ; Remove ISPP files if needed
  78. Type: files; Name: "{app}\ISPP.dll"; Check: not ISPPCheck
  79. Type: files; Name: "{app}\ISPPBuiltins.iss"; Check: not ISPPCheck
  80. ; Remove old ISPP files
  81. Type: files; Name: "{app}\ISCmplr.dls"
  82. Type: files; Name: "{app}\Builtins.iss"
  83. ; Older versions created the desktop icon under {userdesktop}
  84. Type: files; Name: "{userdesktop}\Inno Setup Compiler.lnk"
  85. [Files]
  86. ; Files used by [Code] first so these can be quickly decompressed despite solid compression
  87. Source: "files\ISPP.ico"; Flags: dontcopy
  88. ; Other files
  89. Source: "license.txt"; DestDir: "{app}"; Flags: ignoreversion touch
  90. Source: "ishelp\Staging\ISetup.chm"; DestDir: "{app}"; Flags: ignoreversion touch
  91. Source: "files\Compil32.exe"; DestDir: "{app}"; Flags: ignoreversion touch
  92. Source: "files\isscint.dll"; DestDir: "{app}"; Flags: ignoreversion touch
  93. Source: "files\ISCC.exe"; DestDir: "{app}"; Flags: ignoreversion touch
  94. Source: "files\ISCmplr.dll"; DestDir: "{app}"; Flags: ignoreversion touch
  95. Source: "files\Setup.e32"; DestDir: "{app}"; Flags: ignoreversion touch
  96. Source: "files\SetupLdr.e32"; DestDir: "{app}"; Flags: ignoreversion touch
  97. Source: "files\Default.isl"; DestDir: "{app}"; Flags: ignoreversion touch
  98. Source: "files\Languages\BrazilianPortuguese.isl"; DestDir: "{app}\Languages"; Flags: ignoreversion touch
  99. Source: "files\Languages\Catalan.isl"; DestDir: "{app}\Languages"; Flags: ignoreversion touch
  100. Source: "files\Languages\Corsican.isl"; DestDir: "{app}\Languages"; Flags: ignoreversion touch
  101. Source: "files\Languages\Czech.isl"; DestDir: "{app}\Languages"; Flags: ignoreversion touch
  102. Source: "files\Languages\Danish.isl"; DestDir: "{app}\Languages"; Flags: ignoreversion touch
  103. Source: "files\Languages\Dutch.isl"; DestDir: "{app}\Languages"; Flags: ignoreversion touch
  104. Source: "files\Languages\French.isl"; DestDir: "{app}\Languages"; Flags: ignoreversion touch
  105. Source: "files\Languages\Finnish.isl"; DestDir: "{app}\Languages"; Flags: ignoreversion touch
  106. Source: "files\Languages\German.isl"; DestDir: "{app}\Languages"; Flags: ignoreversion touch
  107. Source: "files\Languages\Greek.isl"; DestDir: "{app}\Languages"; Flags: ignoreversion touch
  108. Source: "files\Languages\Hebrew.isl"; DestDir: "{app}\Languages"; Flags: ignoreversion touch
  109. Source: "files\Languages\Hungarian.isl"; DestDir: "{app}\Languages"; Flags: ignoreversion touch
  110. Source: "files\Languages\Italian.isl"; DestDir: "{app}\Languages"; Flags: ignoreversion touch
  111. Source: "files\Languages\Japanese.isl"; DestDir: "{app}\Languages"; Flags: ignoreversion touch
  112. #ifdef UNICODE
  113. Source: "files\Languages\Nepali.islu"; DestDir: "{app}\Languages"; Flags: ignoreversion touch
  114. #endif
  115. Source: "files\Languages\Norwegian.isl"; DestDir: "{app}\Languages"; Flags: ignoreversion touch
  116. Source: "files\Languages\Polish.isl"; DestDir: "{app}\Languages"; Flags: ignoreversion touch
  117. Source: "files\Languages\Portuguese.isl"; DestDir: "{app}\Languages"; Flags: ignoreversion touch
  118. Source: "files\Languages\Russian.isl"; DestDir: "{app}\Languages"; Flags: ignoreversion touch
  119. Source: "files\Languages\ScottishGaelic.isl"; DestDir: "{app}\Languages"; Flags: ignoreversion touch
  120. Source: "files\Languages\SerbianCyrillic.isl"; DestDir: "{app}\Languages"; Flags: ignoreversion touch
  121. Source: "files\Languages\SerbianLatin.isl"; DestDir: "{app}\Languages"; Flags: ignoreversion touch
  122. Source: "files\Languages\Slovenian.isl"; DestDir: "{app}\Languages"; Flags: ignoreversion touch
  123. Source: "files\Languages\Spanish.isl"; DestDir: "{app}\Languages"; Flags: ignoreversion touch
  124. Source: "files\Languages\Turkish.isl"; DestDir: "{app}\Languages"; Flags: ignoreversion touch
  125. Source: "files\Languages\Ukrainian.isl"; DestDir: "{app}\Languages"; Flags: ignoreversion touch
  126. Source: "files\WizModernImage.bmp"; DestDir: "{app}"; Flags: ignoreversion touch
  127. Source: "files\WizModernImage-IS.bmp"; DestDir: "{app}"; Flags: ignoreversion touch
  128. Source: "files\WizModernSmallImage.bmp"; DestDir: "{app}"; Flags: ignoreversion touch
  129. Source: "files\WizModernSmallImage-IS.bmp"; DestDir: "{app}"; Flags: ignoreversion touch
  130. Source: "files\iszlib.dll"; DestDir: "{app}"; Flags: ignoreversion touch
  131. Source: "files\isunzlib.dll"; DestDir: "{app}"; Flags: ignoreversion touch
  132. Source: "files\isbzip.dll"; DestDir: "{app}"; Flags: ignoreversion touch
  133. Source: "files\isbunzip.dll"; DestDir: "{app}"; Flags: ignoreversion touch
  134. Source: "files\islzma.dll"; DestDir: "{app}"; Flags: ignoreversion touch
  135. Source: "files\islzma32.exe"; DestDir: "{app}"; Flags: ignoreversion touch
  136. Source: "files\islzma64.exe"; DestDir: "{app}"; Flags: ignoreversion touch
  137. Source: "whatsnew.htm"; DestDir: "{app}"; Flags: ignoreversion touch
  138. Source: "ishelp\isfaq.htm"; DestDir: "{app}"; Flags: ignoreversion touch
  139. Source: "Examples\Example1.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
  140. Source: "Examples\Example2.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
  141. Source: "Examples\Example3.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
  142. Source: "Examples\64Bit.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
  143. Source: "Examples\64BitTwoArch.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
  144. Source: "Examples\Components.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
  145. Source: "Examples\Languages.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
  146. Source: "Examples\MyProg.exe"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
  147. Source: "Examples\MyProg-x64.exe"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
  148. Source: "Examples\MyProg.chm"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
  149. Source: "Examples\Readme.txt"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
  150. Source: "Examples\Readme-Dutch.txt"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
  151. Source: "Examples\Readme-German.txt"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
  152. Source: "Examples\CodeExample1.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
  153. Source: "Examples\CodeDlg.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
  154. Source: "Examples\CodeClasses.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
  155. Source: "Examples\CodeDll.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
  156. Source: "Examples\CodeAutomation.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
  157. Source: "Examples\CodeAutomation2.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
  158. Source: "Examples\CodePrepareToInstall.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
  159. Source: "Examples\UninstallCodeExample1.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
  160. Source: "Examples\MyDll.dll"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
  161. Source: "Examples\MyDll\C\MyDll.c"; DestDir: "{app}\Examples\MyDll\C"; Flags: ignoreversion touch
  162. Source: "Examples\MyDll\C\MyDll.def"; DestDir: "{app}\Examples\MyDll\C"; Flags: ignoreversion touch
  163. Source: "Examples\MyDll\C\MyDll.dsp"; DestDir: "{app}\Examples\MyDll\C"; Flags: ignoreversion touch
  164. Source: "Examples\MyDll\Delphi\MyDll.dpr"; DestDir: "{app}\Examples\MyDll\Delphi"; Flags: ignoreversion touch
  165. Source: "Examples\ISPPExample1.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
  166. Source: "Examples\ISPPExample1License.txt"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
  167. ; ISPP files
  168. Source: "Projects\ISPP\Help\Staging\ISPP.chm"; DestDir: "{app}"; Flags: ignoreversion touch
  169. Source: "files\ISPP.dll"; DestDir: "{app}"; Flags: ignoreversion touch; Check: ISPPCheck
  170. Source: "files\ISPPBuiltins.iss"; DestDir: "{app}"; Flags: ignoreversion touch; Check: ISPPCheck
  171. [Icons]
  172. Name: "{group}\Inno Setup Compiler"; Filename: "{app}\Compil32.exe"; WorkingDir: "{app}"; AppUserModelID: "JR.InnoSetup.IDE.5"
  173. Name: "{group}\Inno Setup Documentation"; Filename: "{app}\ISetup.chm"
  174. Name: "{group}\Inno Setup Example Scripts"; Filename: "{app}\Examples\"
  175. Name: "{group}\Inno Setup FAQ"; Filename: "{app}\isfaq.htm"
  176. Name: "{group}\Inno Setup Revision History"; Filename: "{app}\whatsnew.htm"
  177. Name: "{commondesktop}\Inno Setup Compiler"; Filename: "{app}\Compil32.exe"; WorkingDir: "{app}"; AppUserModelID: "JR.InnoSetup.IDE.5"; Tasks: desktopicon
  178. [Run]
  179. Filename: "{app}\Compil32.exe"; Parameters: "/ASSOC"; StatusMsg: "{cm:AssocingFileExtension,Inno Setup,.iss}"; Tasks: fileassoc
  180. Filename: "{app}\Compil32.exe"; WorkingDir: "{app}"; Description: "{cm:LaunchProgram,Inno Setup}"; Flags: nowait postinstall skipifsilent
  181. [UninstallRun]
  182. Filename: "{app}\Compil32.exe"; Parameters: "/UNASSOC"; RunOnceId: "RemoveISSAssoc"
  183. [CustomMessages]
  184. ISPPTitle=Inno Setup Preprocessor
  185. ISPPSubtitle=Would you like to install Inno Setup Preprocessor?
  186. ISPPText=Inno Setup Preprocessor (ISPP) is an official add-on for Inno Setup. ISPP allows you to conditionally compile parts of scripts, to use compile time variables in your scripts and to use built-in functions which for example can read from the registry or INI files at compile time.%n%nISPP also contains a special version of the ISCC command line compiler which can take variable definitions as command line parameters and use them during compilation.
  187. ISPPText2=Select whether you would like to install ISPP, then click Next.
  188. ISPPCheck=&Install Inno Setup Preprocessor
  189. [Code]
  190. var
  191.   ISPPPage: TWizardPage;
  192.   ISPPCheckBox: TCheckBox;
  193.   
  194. function GetModuleHandle(lpModuleName: LongInt): LongInt;
  195. external 'GetModuleHandleA@kernel32.dll stdcall';
  196. function ExtractIcon(hInst: LongInt; lpszExeFileName: AnsiString; nIconIndex: LongInt): LongInt;
  197. external 'ExtractIconA@shell32.dll stdcall';
  198. function DrawIconEx(hdc: LongInt; xLeft, yTop: Integer; hIcon: LongInt; cxWidth, cyWidth: Integer; istepIfAniCur: LongInt; hbrFlickerFreeDraw, diFlags: LongInt): LongInt;
  199. external 'DrawIconEx@user32.dll stdcall';
  200. function DestroyIcon(hIcon: LongInt): LongInt;
  201. external 'DestroyIcon@user32.dll stdcall';
  202. const
  203.   DI_NORMAL = 3;
  204.   
  205. function CreateCustomOptionPage(AAfterId: Integer; ACaption, ASubCaption, AIconFileName, ALabel1Caption, ALabel2Caption,
  206.   ACheckCaption: String; var CheckBox: TCheckBox): TWizardPage;
  207. var
  208.   Page: TWizardPage;
  209.   Rect: TRect;
  210.   hIcon: LongInt;
  211.   Label1, Label2: TNewStaticText;
  212. begin
  213.   Page := CreateCustomPage(AAfterID, ACaption, ASubCaption);
  214.   
  215.   try
  216.     AIconFileName := ExpandConstant('{tmp}\' + AIconFileName);
  217.     if not FileExists(AIconFileName) then
  218.       ExtractTemporaryFile(ExtractFileName(AIconFileName));
  219.     Rect.Left := 0;
  220.     Rect.Top := 0;
  221.     Rect.Right := 32;
  222.     Rect.Bottom := 32;
  223.     hIcon := ExtractIcon(GetModuleHandle(0), AIconFileName, 0);
  224.     try
  225.       with TBitmapImage.Create(Page) do begin
  226.         with Bitmap do begin
  227.           Width := 32;
  228.           Height := 32;
  229.           Canvas.Brush.Color := WizardForm.Color;
  230.           Canvas.FillRect(Rect);
  231.           DrawIconEx(Canvas.Handle, 0, 0, hIcon, 32, 32, 0, 0, DI_NORMAL);
  232.         end;
  233.         Parent := Page.Surface;
  234.       end;
  235.     finally
  236.       DestroyIcon(hIcon);
  237.     end;
  238.   except
  239.   end;
  240.   Label1 := TNewStaticText.Create(Page);
  241.   with Label1 do begin
  242.     AutoSize := False;
  243.     Left := WizardForm.SelectDirLabel.Left;
  244.     Width := Page.SurfaceWidth - Left;
  245.     WordWrap := True;
  246.     Caption := ALabel1Caption;
  247.     Parent := Page.Surface;
  248.   end;
  249.   WizardForm.AdjustLabelHeight(Label1);
  250.   Label2 := TNewStaticText.Create(Page);
  251.   with Label2 do begin
  252.     Top := Label1.Top + Label1.Height + ScaleY(12);
  253.     Caption := ALabel2Caption;
  254.     Parent := Page.Surface;
  255.   end;
  256.   WizardForm.AdjustLabelHeight(Label2);
  257.   CheckBox := TCheckBox.Create(Page);
  258.   with CheckBox do begin
  259.     Top := Label2.Top + Label2.Height + ScaleY(12);
  260.     Width := Page.SurfaceWidth;
  261.     Caption := ACheckCaption;
  262.     Parent := Page.Surface;
  263.   end;
  264.   
  265.   Result := Page;
  266. end;
  267. procedure CreateCustomPages;
  268. var
  269.   Caption, SubCaption1, IconFileName, Label1Caption, Label2Caption, CheckCaption: String;
  270. begin
  271.   Caption := CustomMessage('ISPPTitle');
  272.   SubCaption1 := CustomMessage('ISPPSubtitle');
  273.   IconFileName := 'ISPP.ico';
  274.   Label1Caption := CustomMessage('ISPPText');
  275.   Label2Caption := CustomMessage('ISPPText2');
  276.   CheckCaption := CustomMessage('ISPPCheck');
  277.   ISPPPage := CreateCustomOptionPage(wpSelectProgramGroup, Caption, SubCaption1, IconFileName, Label1Caption, Label2Caption, CheckCaption, ISPPCheckBox);
  278. end;
  279. procedure InitializeWizard;
  280. begin
  281.   CreateCustomPages;
  282.   
  283.   ISPPCheckBox.Checked := (GetPreviousData('ISPP', '1') = '1') or (ExpandConstant('{param:ispp|0}') = '1');
  284. end;
  285. procedure RegisterPreviousData(PreviousDataKey: Integer);
  286. begin
  287.   SetPreviousData(PreviousDataKey, 'ISPP', IntToStr(Ord(ISPPCheckBox.Checked)));
  288. end;
  289. function ISPPCheck: Boolean;
  290. begin
  291.   Result := ISPPCheckBox.Checked;
  292. end;
  293. function PortableCheck: Boolean;
  294. begin
  295.   Result := ExpandConstant('{param:portable|0}') = '1';
  296. end;


本帖提到的人: @gnatix
离线gnatix

发帖
7696
金钱
-8279
威望
-828
只看该作者 1 发表于: 2015-08-31
很难进入你的思路。不过这些问题你应该可以自己找到原因的。

提示一下:
这样的代码:
function allversion: Boolean;
begin
  if (IsComponentSelected('ALL\ANSI')) and (IsComponentSelected('ALL\Unicode')) then
  Result := true;
end;
最好换成下面的代码才严谨
function allversion: Boolean;
begin
  if (IsComponentSelected('ALL\ANSI')) and (IsComponentSelected('ALL\Unicode')) then
  Result := true
  else
  Result:=false;
end;
离线gnatix

发帖
7696
金钱
-8279
威望
-828
只看该作者 2 发表于: 2015-08-31
INNO 官方说明里面没有说编译器可以用参数 /ASSOC 和 /UNASSOC 来创建和取消文件关联。不过我相信你肯定已经确定过了。
离线546242502

发帖
332
金钱
-3060
威望
-306
只看该作者 3 发表于: 2015-08-31
回 2楼(gnatix) 的帖子
老虎版主, /ASSOC 和 /UNASSOC 是别人公开的脚本里的,就拿来用来,懒的去写注册表了;
老虎版主你这种写法报错,必须加上 begin 和 end ;

我自己还真没发现问题在哪里,如果实在不行就只有用很笨的方法写了;
离线546242502

发帖
332
金钱
-3060
威望
-306
只看该作者 4 发表于: 2015-08-31
回 1楼(gnatix) 的帖子
gnatix:很难进入你的思路。不过这些问题你应该可以自己找到原因的。提示一下:这样的代码:function allversion: Boolean;....... (2015-08-31 01:31) 

还有,这种一般只有真、假两种情况吧,不是真就是假,所以感觉不出有什么更好
离线gnatix

发帖
7696
金钱
-8279
威望
-828
只看该作者 5 发表于: 2015-08-31
一:关于你3楼说的出错,是因为你没有完全按照我给你的例子做的缘故,而不是没有用 begin ... end 的原因。你再仔细比较我说的和你的代码就知道了。我说的代码的 else 前面是没有分号 ; 的。这个是最最基本常识,我当然知道,你也应该知道了。

二:关于你4楼的问题,看来你还没有懂我提示的含义。真假两种情况没错,但是你的代码只是说了满足某种条件下的情况,而不满足该条件下的情况你没有说,这就取决于变量初始化的状态了。注意:我没有说你的代码是错误,而是“最好换成下面的代码才严谨”。因为在另外的场合下,用你的代码方式就可能是错误。参看下面的帖子:
http://bbs.hanzify.org/read-htm-tid-98469.html
离线546242502

发帖
332
金钱
-3060
威望
-306
只看该作者 6 发表于: 2015-08-31
回 5楼(gnatix) 的帖子
gnatix:一:关于你3楼说的出错,是因为你没有完全按照我给你的例子做的缘故,而不是没有用 begin ... end 的原因。你再仔细比较我说的和你的代码就知道了。我说的代码的 else 前面是没有分号 ; 的。这个 .. (2015-08-31 14:53) 

老虎版主一指点,恍然大悟
老虎版主,看来只有自己用笨方法去修正了!