Old 10th July 2007, 07:34   #1
daisywheel
Junior Member
 
Join Date: May 2007
Posts: 40
Get results of executable

...sorry for maybe usual question...but I spent half an hour and can't find an answer

How can I get result of silent executable file? Let's say I want to run some.exe with some_params and get output from console(of course some.exe is console app).

tnx,
Roman
daisywheel is offline   Reply With Quote
Old 10th July 2007, 07:39   #2
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
See the included NsExec plugin.

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 10th July 2007, 12:15   #3
daisywheel
Junior Member
 
Join Date: May 2007
Posts: 40
Quote:
Originally posted by Red Wine
See the included NsExec plugin.
I use
ExecWait '"$TEMP\WhoUses.exe -m kernel32.dll" > "c:\WhoUses.txt"'

or
nsExec::Exec '"$TEMP\WhoUses.exe -m kernel32.dll" > "c:\WhoUses.txt"'

but it doesn't work.
Can you help?
daisywheel is offline   Reply With Quote
Old 10th July 2007, 12:32   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
try using nsExec::ExecToStack without the redirection

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 10th July 2007, 13:24   #5
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Yeh, use ExecToStack.
The reason your output redirection was not working was because you need to use COMSPEC.

By the way, I'm working on a plugin so that you don't have to use WhoUses.exe. It uses the same Windows NT+ only undocumented API's but with an embedded NSIS list displaying programs to close.

Stu
Afrow UK is offline   Reply With Quote
Old 10th July 2007, 14:02   #6
daisywheel
Junior Member
 
Join Date: May 2007
Posts: 40
I feel lack of info on nsExec. Where can find the description of this plugin?
daisywheel is offline   Reply With Quote
Old 10th July 2007, 14:11   #7
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
http://nsis.sourceforge.net/Docs/nsExec/nsExec.txt (First hit on google btw)

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 10th July 2007, 14:14   #8
daisywheel
Junior Member
 
Join Date: May 2007
Posts: 40
yes, you are right but I was looking in plugins and nsExec::Exec in google
daisywheel is offline   Reply With Quote
Old 10th July 2007, 14:39   #9
daisywheel
Junior Member
 
Join Date: May 2007
Posts: 40
guys, it doesn't work...

StrCpy $3 '$TEMP\WhoUses.exe -m kernel32.dll > c:\WhoUses.txt'

nsExec::ExecToStack $3

FileOpen $0 'c:\WhoUses1.txt' 'w'
FileWrite $0 $3
FileClose $0

but command stored in c:\WhoUses1.txt is ok
daisywheel is offline   Reply With Quote
Old 10th July 2007, 15:36   #10
daisywheel
Junior Member
 
Join Date: May 2007
Posts: 40
finally I've done it

StrCpy $3 '$TEMP\WhoUses.exe -m kernel32.dll'
nsExec::ExecToStack $3
Pop $0
Pop $1
MessageBox MB_OK "$1"

NSIS become really challenging. Feel like I'm a first week in IT
daisywheel is offline   Reply With Quote
Old 10th July 2007, 16:04   #11
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
My NSIS plugin will be ready soon which works faster than WhoUses.exe and does not use Microsoft Foundation Classes.
It also avoids the awful use of TerminateThread which results in a memory leak that WhoUses.exe has. Last of all, it avoids the system latch up of NtQueryObject which occurs on file handles that it does not have access to.

Stu
Afrow UK is offline   Reply With Quote
Old 11th July 2007, 06:00   #12
daisywheel
Junior Member
 
Join Date: May 2007
Posts: 40
I'm really looking forward to your plugin. I even was going to write similar plugin to implement some my requirements. I have some troubles with WhoUses and I'd really like to have NSIS functionality similar to embedded in InstallShield when it says what applications are using/blocking system resources your want to have access to.
One more comment: it would be useful to get not only exe file name like firefox.exe but also description of application which will help user to find it in tray. In my case: WINAMP.COM | Forums - Reply to Topic - Mozilla Firefox

So, when can we expect your great plugin?
daisywheel is offline   Reply With Quote
Old 11th July 2007, 09:56   #13
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Sorry, I should have said;
http://forums.winamp.com/showthread.php?threadid=274168

Stu
Afrow UK is offline   Reply With Quote
Old 11th July 2007, 10:01   #14
daisywheel
Junior Member
 
Join Date: May 2007
Posts: 40
Thumbs up cool!

Great job!
I'll test it asap
daisywheel is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump