- NSIS Discussion
- Roll up roll up, execwait question
Archive: Roll up roll up, execwait question
RobGrant
29th September 2004 15:41 UTC
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
kichik
29th September 2004 15:43 UTC
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.
RobGrant
29th September 2004 16:00 UTC
Er I hate to be the idiot, but is there some documentation anywhere for nsExec?
kichik
29th September 2004 16:01 UTC
<NSIS folder>\Contrib\nsExec.
RobGrant
29th September 2004 16:03 UTC
you're clearly the person driving these boards as well as maintaining the project well done mate :)
RobGrant
29th September 2004 16:25 UTC
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
kichik
29th September 2004 16:26 UTC
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.
RobGrant
29th September 2004 16:29 UTC
Aah ok I don't use the default one. Incidentally you are almost replying faster than I'm asking, thank you :)
RobGrant
29th September 2004 16:31 UTC
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
kichik
29th September 2004 16:33 UTC
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.
RobGrant
30th September 2004 09:02 UTC
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?
RobGrant
30th September 2004 09:22 UTC
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
kichik
30th September 2004 09:26 UTC
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.
RobGrant
30th September 2004 09:33 UTC
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?
kichik
30th September 2004 09:36 UTC
Yes, you need the command line interpreter. Look for "mysql" in this forum.
RobGrant
30th September 2004 10:10 UTC
Ooh fantastic it works! You're a star kichik, and I don't care who hears me say it! :p