Page 1 of 1

Execute a EXE and redirects to a variable

PostPosted: Mon Feb 09, 2009 5:43 pm
by Apoleo
Hi. I've tried to run a EXE (console application) and to redirect the result in a variable which I send to Neobook. I've been looking for information but I've no success.

What I do:
Code: Select all
Function F1()
    dim oWs
    Set oWs = CreateObject("WScript.Shell")

    strCommand = oWs.Run ("[PubDir]app.exe",1,True)
    Set objExecObject = objShell.Exec(strCommand)
    Set objStdOut = objWshScriptExec.StdOut
    F1 = objStdOut
End Function

publication.nbSetVar "[%1]", F1()

Anyone knows how to do it? Thanks!

Saludos.

PostPosted: Mon Feb 09, 2009 5:47 pm
by Neosoft Support
You might try the Exec method instead. Here's some info:

http://msdn.microsoft.com/en-us/library/ateytk4a(VS.85).aspx

PostPosted: Thu May 21, 2009 6:29 am
by aguilar955
Apoleo
┬┐Al final conseguiste que funcionara?
After all that work?
I am interested in the function to capture the text or the text output from the Shell.

Salu2

PostPosted: Thu May 21, 2009 8:11 am
by Apoleo
Hi, I did this code and it works. However the Windows command shell is shown for a little while. I don't know if there are any way to hide the shell completely.

Code: Select all
{NeoBook Function}
Version=5,60
Language=VBScript
Param=[%1]|FileName|Exe File
Param=[%2]|Mixed|Params
Param=[%3]|Variable|Store In...
{End}
Function ExeRun()
    Set oWs = CreateObject("WScript.Shell")
    Set objScriptExec = oWs.Exec("[%1] [%2]")
    strRes = objScriptExec.StdOut.ReadAll
    ExeRun = strRes
End Function

publication.nbSetVar "[%3]", ExeRun()


Saludos

PostPosted: Thu May 21, 2009 8:30 am
by aguilar955
Thank you very much.

Salu2

PostPosted: Mon Jun 01, 2009 6:06 pm
by aguilar955
Apoleo Can not get it to work I always throw error can give an example.pub

Salu2

PostPosted: Tue Jun 02, 2009 4:01 am
by Apoleo
Yeah, here the example:

:arrow: http://www.box.net/shared/igcm10695g

Must say the VBScript function only works with Win32 Console Applications.

Saludos

PostPosted: Fri Jun 12, 2009 4:47 pm
by aguilar955
Thank you very much Apoleo I got it to work, you are undoubtedly a master.

PostPosted: Mon Apr 26, 2010 1:21 am
by aguilar955
Run "cmd" "/c [#34][CurrentDir]wget.exe[#34] -c http://archivo.exe > lista.txt 2>&1" "Wait+Hidden" "" ""
Run "cmd" "/c [#34][CurrentDir]wget.exe[#34] -c http://archivo.exe 2> lista2.txt" "Wait+Hidden" "" ""

lista.txt and lista2.txt, Ok.

Salu2

PostPosted: Wed Jun 02, 2010 6:25 am
by aguilar955
Run "cmd" "/c wget.exe -c -O [#34][CurrentDir]\file.xxx[#34] [#34]http://file.xxx[#34] 2> out.txt" "Hidden" "" ""
Run "cmd" "/c wget.exe -c -O [#34][CurrentDir]\file.xxx[#34] [#34]http://file.xxx[#34] > out.txt 2>&1" "Hidden" "" ""

stdin, stdout and stderr

Code: Select all
http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-3.html

PostPosted: Wed Jun 02, 2010 11:06 am
by Neosoft Support
I think you have a typo. Both commands are attempting to write to the same file at the same time.

Run "cmd" "/c wget.exe -c -O [#34][CurrentDir]\file.xxx[#34] [#34]http://file.xxx[#34] 2> out.txt" "Hidden" "" ""
Run "cmd" "/c wget.exe -c -O [#34][CurrentDir]\file.xxx[#34] [#34]http://file.xxx[#34] > out.txt 2>&1" "Hidden" "" ""

PostPosted: Wed Jun 02, 2010 1:01 pm
by aguilar955
Neosoft Support wrote:I think you have a typo. Both commands are attempting to write to the same file at the same time.

Run "cmd" "/c wget.exe -c -O [#34][CurrentDir]\file.xxx[#34] [#34]http://file.xxx[#34] 2> out.txt" "Hidden" "" ""
Run "cmd" "/c wget.exe -c -O [#34][CurrentDir]\file.xxx[#34] [#34]http://file.xxx[#34] > out.txt 2>&1" "Hidden" "" ""


ImageImageImage

There are two options for the same function.

Choose the one that but like it or agree.

Regards

pub

PostPosted: Thu Jun 03, 2010 12:11 am
by naglieri
Is possible have all your pub as example?
Thanks



aguilar955 wrote:
Neosoft Support wrote:I think you have a typo. Both commands are attempting to write to the same file at the same time.

Run "cmd" "/c wget.exe -c -O [#34][CurrentDir]\file.xxx[#34] [#34]http://file.xxx[#34] 2> out.txt" "Hidden" "" ""
Run "cmd" "/c wget.exe -c -O [#34][CurrentDir]\file.xxx[#34] [#34]http://file.xxx[#34] > out.txt 2>&1" "Hidden" "" ""


ImageImageImage

There are two options for the same function.

Choose the one that but like it or agree.

Regards

PostPosted: Thu Jun 03, 2010 6:17 am
by aguilar955
Test Cmd

Code: Select all
http://www.megaupload.com/?d=G13FUKWG


Test Wget.exe

Code: Select all
http://www.megaupload.com/?d=Q8PI766N


Saludos