-1

I used Inno Setup to build myapp (webapp) final setup, also used custom Pascal code to set prerequisites and create config file which has base_URL.

I defined the servername as 'Domain' and port as 'HostPort', and there is a dialog in setup progress to allow user put domain and hostport.

I want to open URL contains (http//domain:port) after setup finished. This process should execute within 5 second after run myapp to work correctly.

Inno script executed myapp as below:

[Run]

Filename: "{app}\{#MyAppExeName}"; Flags: runascurrentuser nowait postinstall skipifsilent hidewizard runhidden; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"
Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164
M.A_55
  • 135
  • 17

1 Answers1

0

myapp.exe launch in background after setup finished, and execute it's modules, it takes around 3 seconds, so if the URL open before myapp launched it's modules, the URL (domain:port) will not open, and will get "This page can not be displayed). The URL used to login in to myapp (it's web app), so it myapp.exe doesn't load all it's modules, the login page will not open.

Waiting an arbitrary time and hoping that some background process finishes, is an unreliable hack.

Instead, make your application open the URL after it finishes loading.

Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • No you didn't ask the question in a wrong way. But you have a solution in your mind, which is wrong, and you keep insisting on it. This is called [XY problem](https://meta.stackexchange.com/q/66377/218578). – Martin Prikryl Dec 06 '18 at 06:24
  • Let me try again: You run some app that needs to finish *something*, before you can open an URL. I see two solutions: 1) The application can signal back that it finished loading, e.g. by a) finishing itself (does the app keep running in background, or does it close after it does its "loading"). b) sending some signal (e.g. creating some file, setting mutex/semaphore) - And you make Inno Setup wait for the signal. 2) Or make the app itself do what you need after it finished loading. If the app does not know on its own, what URL to open, make the application accept the URL on its command-line. – Martin Prikryl Dec 06 '18 at 06:25
  • it's a web application, use postgresql as db engine, after the installation of my app has finished, the last gialog of setup appear, and it have checkbook (Run App), this check box it related to app.exe which i put it under [run] in inno script, app.exe (is the same: run.py in source code), so when i clicked Finish setup and i selected the checkbox the app running (from app.exe which located in .\program files\myapp\ ), but i set in inno scrip to make app run in background (like services), – M.A_55 Dec 06 '18 at 07:34
  • so the pop up cmd which it shows the modules the the app running will not shown to user, and created 2 shortcuts on desktop to (start server - stop server). the app is keep running in background (appears in task manger normally) till the user clicked on shortcut (stop server). All What I need is to run the web interface of my app, the url is depends on what user has been chosen in setup progress, for example, if the user entered domain: localhost, and port 20000, then the url of myapp will be http://localhost:2000 – M.A_55 Dec 06 '18 at 07:34
  • so user can login to the app by providing username and password which he set also within setup and this credentials was recorded in postgresql server. – M.A_55 Dec 06 '18 at 07:34
  • it's the usual behavior of web application running on windows environment, i just want it like odoo (open erp) or manage engine. i worked before on this apps and it open the web interface to allow user to login to the application, that's all what i need in myapp, open the web interface of myapp after setup finished to make user login and use it's modules, and app.exe is running normally in background – M.A_55 Dec 06 '18 at 07:40
  • OK, clear. That's what I assumed. Though you didn't really commented on my suggestions. Btw, what about checking if port 2000 is ready? Is that a sufficient signal that your "app" is ready? – Martin Prikryl Dec 06 '18 at 07:46
  • No, i didn't attention to that in fact, i left it to user to decided, but whould you mind if you explain me how to do this check ?, and i commented on your suggestion and asked also how to do that. app is not ready yet, the whole code is ready, but i need to make the final build so the normal user can used it – M.A_55 Dec 06 '18 at 08:14
  • how can i set the url in the application code, and its value it set in inno scrip in setup porgres by user himself?? – M.A_55 Dec 06 '18 at 08:18
  • Sorry, but your last comment in incomprehensible. – Martin Prikryl Dec 06 '18 at 08:19
  • Are you asking how to provide user-specified input to the app in `Run` section? – Martin Prikryl Dec 06 '18 at 08:19
  • No, the attributes of Base_url of myapp set in pascal code under [code] section as shown: SaveStringToFile(BaseConfig, 'BASE_URL = "'+Domain+':'+HostPort+'"', False); so i know it's not possible to set this attributes under [run] section, i just want the web application open login page (the url) to allow user start using the app. – M.A_55 Dec 06 '18 at 08:25
  • So are you asking how to open the URL in your app? – Martin Prikryl Dec 06 '18 at 08:28
  • after finish installation , that's all – M.A_55 Dec 06 '18 at 08:29
  • Sorry, I give up. I do not understand you. – Martin Prikryl Dec 06 '18 at 08:44
  • Thanks Martin , I appreciated your efforts – M.A_55 Dec 06 '18 at 08:48