I am trying to build a script using Pascal scripting to return the name of a folder (but I want later to use the same function for wider results).
My scrip is here:
;This is a test script
#define MySourceDir "D:\Temp\InnoTestSrc"
#define MyDestDir "D:\Temp\InnoTest"
[Setup]
DefaultDirName={#MyDestDir}
DisableDirPage=no
AppName="MyTestApp"
AppVersion=1
[Code]
function GetMyConstant(Param: String): String;
var
strConst: string;
begin
strConst := '{#' + Param + '}';
MsgBox(strConst, mbInformation, MB_OK);
Result := expandconstant(strConst);
end;
function GetDataDir(Param: String): String;
begin
{ Return the selected DataDir }
Result := 'DummyString';
end;
[Files]
Source: {#MySourceDir}\TestFile.pdf; DestDir: {code: GetDataDir}
However, when I try to compile it, I get
Compile Error!
Line: 29
Error: Required function or procedure ‘ GetDataDir’ not found.
I am trying to understand why the compiler cannot find the function, but I do not understand.
Any help to my (probably obvious) error would be highly appreciated
Does it work if you do
instead? I think it does. Indeed, you should listen to the compiler, which says that there is no function called
<space>GetDataDir. Of course there is not! Your function is calledGetDataDir!