Archive: Roll up roll up, execwait question


Roll up roll up, execwait question
Hi guys, gotta nother one for you. I hope it hasn't been asked before, I try and ask only the questions I have to...

I want to (very simply) pipe the output from an unzip program to a text file.

On the command line I'd do this:

unzip.exe -ddirectory-name -o compressed-file.war > C:\temp.txt

However this doesn't seem to work:

Execwait "unzip.exe -ddirectory-name -o compressed-file.war > C:\temp.txt"

Any ideas? Can I treat Execwait as a shell interface, or is it less flexible than that?

Thanks guys

Rob


You need the command line interpreter for that. Search for MySQL and you'll find your answer. If you want to later read that text file you should skip that and just use nsExec.


Er I hate to be the idiot, but is there some documentation anywhere for nsExec?


<NSIS folder>\Contrib\nsExec.


you're clearly the person driving these boards as well as maintaining the project well done mate :)


Oh er yeah, can I just chuck

nsExec::Exec "unzip.exe -ddirectory-name -o compressed-file.war" into a script without anything else and expect it to do something good? And if it does something good, how do I get the output from that into a text file or whatever?

Love and hugs

Rob


Use nsExec::ExecToLog to print the output into the installation log (the one in the install page, not the text file) or nsExec::ExecToStack to get the output on the stack.


Aah ok I don't use the default one. Incidentally you are almost replying faster than I'm asking, thank you :)


Not quite sure how I get a rather huge number of lines from the stack when I don't know how many there will be but that's tomorrow's problem :)

Laters

Rob


nsExec pushes it all as one string. You just use Pop to get it. Note that a stack element size is limited to 1024 by default.


Hm right ok, I'm probably looking at more like 800Kb of data. Can the stack be made to cope with that sort of input?


Oh also this command simply gives an output of 0 in the log:

nsExec::ExecToStack "c:\temp\unzip.exe -ddirectory-name -o file-to-unzip.war"
Pop $R1
LogText $R1


You can recompile NSIS with a string size (also affect stack) of 800k, but that won't be a good idea. It means NSIS will use at least 16MB more memory on runtime. If it's that much data, you need to go back to redirecting the output to a text file.

nsExec pushes two strings when ExecToStack is used. See the example.


Oh duh sorry yes I did know about the 2nd param just forgot.

And AH so do I look for that command line interpreter thing?


Yes, you need the command line interpreter. Look for "mysql" in this forum.


Ooh fantastic it works! You're a star kichik, and I don't care who hears me say it! :p