我想从.ini文件中读取值.然后写一个条件 - 如果这个值等于"1",那么做某事(执行一个动作).我尝试了getinistring,但我没有得到任何值(只显示默认值).我不知道如何在我下面的代码中实现readini.感谢您的帮助,IS初学者:)
//编辑这是一个代码:
#include ReadReg(HKEY_LOCAL_MACHINE,'Software\Sherlock Software\InnoTools\Downloader','ScriptPath','');
#include ReadReg(HKEY_LOCAL_MACHINE,'Software\Sherlock Software\InnoTools\Tray','ScriptPath','');
[Languages]
Name: english; MessagesFile: compiler:Default.isl
[Code]
function isxdl_Download(hWnd: Integer; URL, Filename: AnsiString): Integer;
external 'isxdl_Download@files:isxdl.dll stdcall';
function isxdl_SetOption(Option, Value: AnsiString): Integer;
external 'isxdl_SetOption@files:isxdl.dll stdcall';
var
a :string;
b :string;
//Downloading a component depending on component choice in another setup(read from .ini)
procedure CurStepChanged(CurStep: TSetupStep);
begin
a:=GetIniString('Select', 'First', 'false', '{pf}/SP_Settings.ini');
b:=GetIniString('Select', 'Should', 'true', {pf}\SP_Settings.ini');
begin
if CompareStr(a,b)=0 then
if CurStep=ssInstall then begin
isxdl_SetOption('title', 'File Download');
isxdl_SetOption('label', 'Download');
isxdl_SetOption('description', 'Setup is downloading a file.');
isxdl_Download(0,'url', ExpandConstant('{app}\x.rar'));
end;
end;
end;
[Files]
Source: C:\Documents and Settings\user\Pulpit\XML\Project\isxdl.dll; DestDir: {tmp}; Flags: dontcopy
Run Code Online (Sandbox Code Playgroud)
有Pascal脚本函数,GetIniInt或者GetIniString您可以用来从ini文件中读取.请参阅此参考.
我想请注意,我在OP改变他的问题之前写了这个回复,告诉我们他已经尝试了GetIniString和ReadIni功能.是的:在写这个答案之前我确实读过这个问题:-)
从您发布的代码中我可以看到您正在尝试从Program Files文件夹中读取ini文件.但是,这仅在使用该ExpandConstant函数时有效,因此应该阅读
a:=GetIniString('Select', 'First', 'false', ExpandConstant('{pf}') + '\SP_Settings.ini');
b:=GetIniString('Select', 'Should', 'true', ExpandConstant('{pf}') + '\SP_Settings.ini');
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7570 次 |
| 最近记录: |