Pascal Scripting: Scripted Constants The Pascal script can contain several functions which are called when Setup wants to know the value of a scripted {code:...} constant. The called function must have 1 String parameter named Param, and must return a String value.The syntax of a {code:...} constant is: {code:FunctionName|Param}FunctionName specifies the name of the Pascal script function. Param specifies the string parameter to pass to the function. If you omit Param, an empty string will be passed. If you wish to include a comma, vertical bar ("|"), or closing brace ("}") inside the constant, you must escape it via "%-encoding." Replace the character with a "%" character, followed by its two-digit hex code. A comma is "%2c", a vertical bar is "%7c", and a closing brace is "%7d". If you want to include an actual "%" character, use "%25". Param may include constants. Note that you do not need to escape the closing brace of a constant as described above; that is only necessary when the closing brace is used elsewhere. Example: DefaultDirName={code:MyConst}\My ProgramHere is an example of a [Code] section containing the MyConst function used above.[Code] function MyConst(Param: String): String; begin Result := ExpandConstant('{pf}'); end; If the function specified by the {code:...} constant is not included in the [Code] section, it must be a support function. Here is an example.[INI] FileName: "{app}\MyIni.ini"; Section: "MySettings"; Key: "ShortApp"; String: "{code:GetShortName|{app}}"See also Constants
第二个问题,可以截获返回值,404(不一定对,又肯能是400)表示无法找到该页,或者你直接判断返回是否是200(表示正常)就可以了。
IDHTTP是不是同样这么判断的?
2..Navigate根本没有返回值
The Pascal script can contain several functions which are called when Setup wants to know the value of a scripted {code:...} constant. The called function must have 1 String parameter named Param, and must return a String value.The syntax of a {code:...} constant is: {code:FunctionName|Param}FunctionName specifies the name of the Pascal script function.
Param specifies the string parameter to pass to the function. If you omit Param, an empty string will be passed.
If you wish to include a comma, vertical bar ("|"), or closing brace ("}") inside the constant, you must escape it via "%-encoding." Replace the character with a "%" character, followed by its two-digit hex code. A comma is "%2c", a vertical bar is "%7c", and a closing brace is "%7d". If you want to include an actual "%" character, use "%25".
Param may include constants. Note that you do not need to escape the closing brace of a constant as described above; that is only necessary when the closing brace is used elsewhere.
Example:
DefaultDirName={code:MyConst}\My ProgramHere is an example of a [Code] section containing the MyConst function used above.[Code]
function MyConst(Param: String): String;
begin
Result := ExpandConstant('{pf}');
end;
If the function specified by the {code:...} constant is not included in the [Code] section, it must be a support function. Here is an example.[INI]
FileName: "{app}\MyIni.ini"; Section: "MySettings"; Key: "ShortApp"; String: "{code:GetShortName|{app}}"See also
Constants
老实说这方法比较笨,我不信twebbrowser根本没提供失败时的返回??