Archive: How to start function running immediately?


How to start function running immediately?
  Hello.

I have the following part of code


...

>Page custom ShowDownloadingPage PressButton
>!insertmacro MUI_PAGE_INSTFILES
>...
...
...
Function ShowDownloadingPage
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "DLPage.ini"
>FunctionEnd

>Function PressButton
inetc
::get /TIMEOUT 10000 /RESUME "One more time?" "http://mydomain/myfile" "$TEMP\\myfile"
Pop $0
FunctionEnd
>
Unfortunately downloading starts only if I press "Install" button on my own page.
My question is how to start it when I press "Next" button on the previous (MUI_PAGE_STARTMENU) page?

Thank you for your answers.

Doesn't work like this?

Start the download right after setting up the custom page.

...

page custom SetCustom

...

Function SetCustom
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "my_page.ini"
inetc::get /TIMEOUT 10000 /RESUME "One more time?" "http://mydomain/myfile" "$TEMP\myfile"
FunctionEnd

...

Thank you, LoRd_MuldeR, for your answer.

Unfortunately, it doesn't work so and I still need to press button for downloading. In addition progress bar of the inetc downloading is not shown.


Maybe the inetc plugin simply was not designed to work on custom pages. Why you can't use it on the normal "instfiles" page?


InstallOptions pauses execution of code. You will have to use it on the install files page.

Stu


Thank you for your answers.

Originally posted by LoRd_MuldeR
Maybe the inetc plugin simply was not designed to work on custom pages. Why you can't use it on the normal "instfiles" page?
Well, it works fine and I don't think it depends of inetc as all other functions wouldn't work too if "Install" button is not pressed.

Originally posted by Afrow UK
InstallOptions pauses execution of code. You will have to use it on the install files page.
Actually, I use my own page for checking regisrty and depending of results I start or don't start installing. I can't use downloading on the installation page at all.

Like I said, InstallOptions will pause code execution until you leave the page.

You can't run InstallOptions and inetc asynchronously without modifying one or the other plug-ins. For example, I (and takhir) modifed the ExecDos to run a program asynchronously allowing someone to display information on their custom page. You would need to modify inetc to allow this.

Stu


Apologies if I misunderstood the point here :)

I assume that your start menu page is just before the custom page, am I right?

If so, why you need the custom page? You could add the required for download code in start menu leave function.

If the custom page is mandatory then use nsDialogs.


Thank you again for your answers

Originally posted by Afrow UK
Like I said, InstallOptions will pause code execution until you leave the page.

You can't run InstallOptions and inetc asynchronously without modifying one or the other plug-ins. For example, I (and takhir) modifed the ExecDos to run a program asynchronously allowing someone to display information on their custom page. You would need to modify inetc to allow this.
Modify sources you mean? I'm not so good for this :) But will try as a last resort...

Originally posted by Red Wine
Apologies if I misunderstood the point here
I assume that your start menu page is just before the custom page, am I right?
If so, why you need the custom page? You could add the required for download code in start menu leave function.
If the custom page is mandatory then use nsDialogs.
You are right and my page goes exactly after start menu page. I need my page to show downloading progress and couldn't find any other ay to display it. As I said before I can't do this on the installation page as I need to dowbload files and check registry before and depending of check start or don't installation.

Maybe stupid question but is nsDialogs compatible with Modern UI?

Originally posted by oldfriend
You are right and my page goes exactly after start menu page. I need my page to show downloading progress and couldn't find any other ay to display it. As I said before I can't do this on the installation page as I need to dowbload files and check registry before and depending of check start or don't installation.

Maybe stupid question but is nsDialogs compatible with Modern UI?
While you're using inetc, you don't need a page, it is able to load in a function with /POPUP parameter, you will find more info in the inetc docs.

Absolutely compatible, preferable with MUI2.

Thank you very much, Red Wine. Seems like I need inetc with /BANNER option instead of custom page and connected problems))


Had to look into the sources of inetc and modified /BANNER mode, so that instead of it the window with the same size is displayed with the progress bar and text (sure parent window is hidden at that moment).

Thanks to all. The problem is solved.