inno setup - Run post install file replace before creating service -


i have configured below script ask user ip address part of install wizard, address gets written config file application reference know communicate with. currently, service created before configuration file updated (run section happens before curstep = sspostinstall), default value has been read file before updated. means further manual service restart required application communicate.

i understand possible have run section happen after sspostinstall.

i have read article inno setup: how run code procedure in run section or before run section? suggests can use beforeinstall: parameter part of run command perform curstepchanged procedure first. however, leads error of

required function or procedure 'curstepchanged' found not compatible prototype.

i tried moving run line , command above curstepchanged section (to match article mentioned closely possible), still returned same error.

can offer guidance going wrong configuration?

[code]  var   primaryserverpage: tinputquerywizardpage;  function filereplacestring(replacestring: string):boolean; var   myfile : tstrings;   mytext : string; begin   log('replacing in file');   myfile := tstringlist.create;    try     result := true;      try       myfile.loadfromfile(expandconstant('{app}' + '\providers\print\win\print-provider.conf'));       log('file loaded');       mytext := myfile.text;        { save if text has been changed. }       if stringchangeex(mytext, 'replace_with_customer_ip', replacestring, true) > 0       begin;         log('ip address inserted');         myfile.text := mytext;         myfile.savetofile(expandconstant('{app}' + '\providers\print\win\print-provider.conf'));         log('file saved');       end;     except       result := false;     end;       myfile.free;   end;    result := true; end;  procedure initializewizard; begin   primaryserverpage :=     createinputquerypage(       wpwelcome, 'application server details', 'where installed?',       'please specify ip address or hostname of ' +         'primary application server, click next.');   primaryserverpage.add('primary application server ip/hostname:', false); end;     procedure curstepchanged(curstep: tsetupstep); begin   if curstep = sspostinstall   begin     log('file installed, replacing ip address');     filereplacestring(primaryserverpage.values[0]);   end; end;   [run] filename: {sys}\sc.exe; parameters: "create pcprintprovider start= auto binpath= ""{app}\providers\print\win\pc-print.exe pcprintprovider"" depend= spooler" ; flags: runhidden ; beforeinstall: curstepchanged filename: {sys}\sc.exe; parameters: "start pcprintprovider" ; flags: runhidden ; beforeinstall: curstepchanged 

you have define own procedure beforeinstall parameter:

[run] filename: {sys}\sc.exe; \     parameters: "create pcprintprovider start= auto binpath= ""{app}\providers\print\win\pc-print.exe pcprintprovider"" depend= spooler"; \     flags: runhidden; beforeinstall: replaceipaddress 
[code]  procedure replaceipaddress; begin   filereplacestring(primaryserverpage.values[0]); end; 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -