Old 1st November 2006, 22:22   #1
neil.benn
Junior Member
 
Join Date: May 2005
Posts: 8
nsExec::execToStack w/ spaces

Hello,

I am using nsExec::execToStack to call a program I have written,I am passing it:

48#"\windows\CrEme\bin\CrEme.exe" -Of -vkb -wd '|PROGRAM_FILES|\DropPaq' -jar 'bin\DropPaq.jar' etc\RippleConfig.xml fire default

as a parameter. the program then returns:

48#"\windows\CrEme\bin\CrEme.exe" -Of -vkb -wd 'Programme\DropPaq' -jar 'bin\DropPaq.jar' etc\RippleConfig.xml fire default

basically, it interrrogates a PDA to find out the names of the special directories and returns the result from the string to stdout. When I'm popping the result off the stack I only get the text up to the space :

48#"\windows\CrEme\bin\CrEme.exe"

I'mnot sure if it is the quotes or the space that is giving me the problem, I've tried popping the data off twice to see if I get the next bit but nothing is happening. Has anyone ever seen this effect? If so do you know what is going on and do you know how to circumvent it?

Thanks for your help.

Cheers,

Neil
neil.benn is offline   Reply With Quote
Old 2nd November 2006, 07:40   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Works fine for me with invalid input. It just pushes "error" on the stack. What's the exact code you're using?

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 2nd November 2006, 19:08   #3
neil.benn
Junior Member
 
Join Date: May 2005
Posts: 8
Hello,

Thanks for the response, the program gives the base response works as seen above when run from the command prompt. The NSIS code that calls this is as follows:

---
DetailPrint "Accessing PDA"
nsExec::Exec '$INSTDIR\CEFileOp.exe /c dev:"|PROGRAMS|\DropPaq Fire.lnk" desk:"DropPaq Fire.lnk"'
call CheckCESuccess
IfErrors FailedMod
DetailPrint "Checking system"
FileOpen $3 "DropPaq Fire.lnk" r
FileRead $3 $4
FileClose $3
MessageBox MB_OK '"$INSTDIR\CEFileOp.exe" /r $4'
nsExec::ExecToStack '"$INSTDIR\CEFileOp.exe" /r $4'
call CheckCESuccess
Pop $0
MessageBox MB_OK $0
Pop $1
MessageBox MB_OK $1
IfErrors FailedMod SuccessMod

FailedMod:
SetErrors
Return
SuccessMod:
DetailPrint "Successful Access"

---

Basically this connects to the handheld, retrieves the file 'Droppaq Fire.lnk', reads th contents out nto a string and then calls the replace on that string. I have checked that the file is being read correctly as the correct data shows up on the messagebox, this calls the exe with the details as used on the command line. However the return via nsExec::ExecToStack only shows the following bit, however this is missing the quotes I actually get returned -

48#\windows\CrEme\bin\CrEme.exe

Note, this is without the quotes, so I assume that the quotes in the return string are causing me a problem. In addition,when I pop off the stack twice, the second time gives me an error so there is no more to retrieve from stdout.

I'm going to try making a batch file which returns a string with quotes in to see what that does when called with nsExec:ExecToStack.

However,if anyone has seen this before - tips would be great .

Cheers,

Neil
neil.benn is offline   Reply With Quote
Old 2nd November 2006, 19:27   #4
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
What about the code for CheckCESuccess? Does it not touch the stack at all?

Make sure you're not passing new line characters along with $4 after you FileRead it. Use TrimNewLines to remove them.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 8th November 2006, 12:08   #5
neil.benn
Junior Member
 
Join Date: May 2005
Posts: 8
Hello,

Apologies, the error was with my code - I had rogue speechmarks in the execution string that I was not escaping - I escaped them and it now works fine.

Cheers,

Neil
neil.benn 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