在代码部分预期的innosetup分号

时间:2014-07-17 08:54:42

标签: inno-setup

编译我的inno脚本的代码部分时出错。

代码部分

var
  ServerID: String;
  EditServerID: TEdit;
  PageIDServer: TWizardPage;

function getServerID(Param: String): String;
begin
  Result := ServerID.Text; <--- Error here
end;

程序部分:

if InstallService(ExpandConstant('"{app}\Client.exe -{code:GetServerID}" Client'),'Client','Client','Client',SERVICE_WIN32_OWN_PROCESS,SERVICE_AUTO_START) = true then
begin
  StartService('Client');
  Sleep(500);
end
else
  MsgBox('Client service could not be installed',mbInformation, MB_OK);

我读到此错误可能与{code:}相关联,但不知道原因。

感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

您尝试访问字符串变量Text的{​​{1}}属性,但您当然希望从ServerID编辑框中获取该值。如果是这样,那就这样写:

EditServerID

同样适用于function GetServerID(Param: string): string; begin Result := EditServerID.Text; end; 事件方法中的代码。顺便说一句。 NextButtonClick变量似乎在您的脚本中未使用,您只需在创建编辑框时将其值分配给ServerID属性,但此时变量为空,所以我认为你可以将它从你的脚本中删除,不再误导你了。