Archive: cool wish: installer status updates for exec commands


cool wish: installer status updates for exec commands
I read it is not possible to monitor an executed file and then display its progress on the NSIS install screen. Cool.

How about a psuedo solution? What I mean is I know a good average time an executed file takes to complete. About one minute. During that one minute it appears NSIS has frozen when it hasn't. It just seems to stop installing and displays the message "Execute: File".

My proposed solution I believe is really quite simple. It could look something like this.

ExecWait "$INSTDIR\Application.exe" "+60" "+40"


"+60" means the application will take around 60 seconds to complete.
"+40" means 40% of the progress bar should progress in 60 seconds.

I believe this though it might seem simple can help ease users into not thinking the application froze or locked up. I have no real idea on how to implement such an idea but leave it to the NSIS developers to implement it.

A lot can happen in one minute and with the NSIS message of "Execute: File" might lead some users to believe they should go and execute a file...

I would also propose that upon displaying a message like that during install it says "Executing..." rather than "Execute". Executing will probably convince the user something is executing rather than making the user think it is up to them to now execute something.

Just some ideas. They might be minor but I believe they're helpful.

Thanks for the super application. Excellent work indeed.

nsExec::ExecToLog "$INSTDIR\Application.exe"
Pop $0
StrCmp $0 0 0 +3
DetailPrint "Program shut itself down and never finished!"
Goto +2
DetailPrint "Program completed successfully!"

-Stu


Thanks Afrow UK,

Does your snippet work with the progress bar, changes the displayed text of Execute or something else? I am sorry but am still quite new. I read this wasn't possible on another post so is this a workaround?

Thank you in advance


nsExec::ExecToLog will capture the output of the command-line executable (which is an MS-DOS executable) and prints it into the LogWindow.
It prints the output as it goes along, line-by-line.

This does not, however, make changes to the progress-bar.
The progress-bar currently only works on which sections are selected, and what is in the sections.

You cannot currently change the progress-bar in any way (except for adding Sleep's, doing jump's, running executables, extracting files etc)

-Stu


You can also use the Banner plug-in to make sure the user knows the installer is doing something. Put a message that describes the ran process, that's the standard on most installers I have seen.

As for your suggestion, I don't know how good this idea would be. What if the process takes longer than 60 seconds? Then the user, again, will think the process is stuck. There is absolutley no way you can predict how long the sub-process will take, even if all it does is sleeping for 60 seconds.


Thank you Kichik,

I searched the archive for "banner" but came up empty. I only found frozen bubble and system hardware detection with that keyword.

My idea for an updating progress bar is simple and if it can tie into Afrow UKs solution then NSIS will never seem frozen unless it freezes.

I could understand your arguement of every system being different, finishing jobs at random times but if the progress bar never moves then it'll seem frozen from the start.

My idea is only cosmetic in trying to convince the user that even on executables in which could take a while to finish NSIS is indeed working, installing files, etc.

If an executable takes on average 60 seconds to complete then to be on the safe side and keep the progress bar moving the dev could simply state it will complete on average in two minutes (40% of the progress bar).

If the program then exceeds the two minute time limit and the progress bar stops dead I think its better it stops after two minutes than at execution.

I am not trying to argue anything, in no way trying to state this is a must have. I think NSIS is awesome and I truly appreciate your work on it. It is awesome the way it is now. This is just a wish to keep the progress bar moving.

Thank you Afrow UK,

It seems like I will have nothing but trouble with my current knowledge in trying to nest the "nsExec::ExecToLog" command. Currently the way I have it setup, it works as advertised.

Section "Project_Files" SEC01
SetOutPath "$INSTDIR"
SetOverwrite on
File "Project_Meat.7z"
File "Core_Unpack_Light.bat"
File "7za.exe"
ExecWait "$INSTDIR\Core_Unpack_Light.bat"
...

The above works. But the below presents an unsual problem my knowledge can't get me out of...
Section "Project_Files" SEC01
SetOutPath "$INSTDIR"
SetOverwrite on
File "Project_Meat.7z"
File "Core_Unpack_Light.bat"
File "7za.exe"
nsExec::ExecToLog "$INSTDIR\Core_Unpack_Light.bat"
Pop $0
StrCmp $0 0 0 +3
DetailPrint "Program shut itself down and never finished!"
Goto +2
DetailPrint "Program completed successfully!"

What seems to happen is NSIS now looks for the following files "Project_Meat.7z" "Core_Unpack_Light.bat" "7za.exe" in the executed directory. In other words, if I place those three files in the same directory where I execute the installer from those three files will do their magic. But no magic happens in the "$INSTDIR" directory the way ExecWait does it.

I really do not know what I am doing wrong... It might seem like a bug because its definitely bugging me but most likely I am doing something wrong. My current command in the "Core_Unpack_Light.bat" is
"7za.exe" x -y Project_Meat.7z


I feel really stumped. Just trying to prove to the user something is happening without displaying the dos box and the nsExec command looks like the trick. It just doesn't work for me... Someone help tell me where I am going wrong or please give me an idea on what to try.

Thank you

Thank you Afrow UK,

I made the bat file log into the NSIS window but I can't get it to log "at the time I need it to". I would like to put the nsExec command "within" "Section "Project_Files" SEC01" right after the 7za.exe extracted file but it'll never work.

Section "Project_Files" SEC01 ;default
SetOutPath "$INSTDIR"
SetOverwrite on
File "Project_Meat.7z" ;This file needs to be executed!
File "Core_Unpack_Light.bat" ;"7za.exe" x -y Project_Meat.7z
File "7za.exe" ;Required file for 7z execution.
nsExec::ExecToLog "$INSTDIR\Core_Unpack_Light.bat" ;Won't work here!
Pop $0
StrCmp $0 0 0 +3
DetailPrint "Program shut itself down and never finished!"
Goto +2
DetailPrint "Program completed successfully!"

The above code comes first in the file installation section. If I replace nsExec with ExecWait everything works out perfectly but I cannot log the bats contents into the NSIS window.

If I use nsExec "regardless of which" right at that very moment in the script for some reason the script will execute it "BUT" their is no waiting. The rest of the NSIS script kicks in and always shuts it down prematurely.

*If* I place the nsExec command into a section which comes directly after "Section "Project_Files" SEC01" *then* nsExec will work as it is supposed too.

How do I get it nsExec to execute the 7z file *correctly* and wait before any of the other files are installed?

Thank you Afrow UK

I think I figured it out. I had to add another setOutPath for the actual files...Before

Section "Project_Files" SEC01 ;default
SetOutPath "$INSTDIR"
SetOverwrite on
File "Project_Meat.7z" ;This file needs to be executed!
File "Core_Unpack_Light.bat" ;"7za.exe" x -y Project_Meat.7z
File "7za.exe" ;Required file for 7z execution.
nsExec::ExecToLog "$INSTDIR\Core_Unpack_Light.bat" ;Won't work here!
After
Section "Project_Files" SEC01 ;default
SetOutPath "$INSTDIR"
SetOverwrite on
SetOutPath "$INSTDIR"
File "Project_Meat.7z" ;This file needs to be executed!
File "7za.exe" ;Required file for 7z execution.
nsExec::ExecToLog '"$INSTDIR\7za.exe" x -y Project_Meat.7z'
If you've notice I also removed the bat file and simply added the command direct to nsExec. It worked with the bat file but I was simply missing the the extra SetOutPath above the files.

It works, sorry for posting early, just don't want to leave this unanswered as it is indeed rude to do so. Thank you Kichik and Afrow UK for your help and pointers. It is very appreciated :)