Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
HI,

i want to pass parameter from run section.That parameter is result of function written in code section.

[Code]
var Dbserver := function RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\services\MA Service','DBServer', DBServer);


[run]
Filename: "{app}\Installdb.bat"; Parameters: {code:RegQueryStringValue};


Please the correct the above code.
Posted
Updated 21-Jan-16 2:56am
v3

1 solution

The [run] section looks good (besides using the same name as an InnoSetup function) but not your code. It should look like:
Delphi
[Code]
function GetDbServer(Default: String): String;
var 
    DBServer: String;
begin
    result := '';
    if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\services\MA Service','DBServer', DBServer) then
    begin
        result := DBServer;
    end;
end;

The corresponding [run] section:
[Run]
Filename: "{app}\Installdb.bat"; Parameters: {code:GetDbServer};

But it may be neccessary to add a Check condition to the Filename command to avoid executing it when the registry key is not found.
 
Share this answer
 
v2
Comments
Mangesh9692 21-Jan-16 23:50pm    
Thanks for u r response but its shown error colon(:) expected at var DBServer;
Jochen Arndt 22-Jan-16 3:01am    
Oops. It misses the type. See udated solution.
Mangesh9692 22-Jan-16 4:05am    
Thanks it working

for %%G in (%*) do (
set /a count+=1
call :exec1 %%~G
)



:exec1
set mapArray[%count%]=%*
After this for loop should continue

Here how to contine for lopp....sorry i dont have idea about batch scripting..
Jochen Arndt 22-Jan-16 4:19am    
Sorry, I haven't used batch scripts since many years and therefore don't know much about it today. I suggest to raise a new question for that because it is not related to the setup script and you will probably get helpful replies from others.

When doing so, describe the parameters and what you want to achieve (e.g. with an example).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900