I made a little program what I want to start from VBscript with some arguments.
This is the script
Dim Argument
Argument = "> out.xml"
set oShell = CreateObject("Shell.Application")
oShell.ShellExecute "D:\Program Files (x86)\HouseBot\Config\Scripts|Phone\CallLog\Calllog.exe" & " " & Argument
When I start 'Calllog.exe > out.xml' in a commandbox it is working but not from vbScript.
When I use the ExecuteProgramDevice it also did't work.
Can someone help me with this?
Regards,
Jacco
Start program with arguments
-
- Senior Member
- Posts: 136
- Joined: Tue Oct 21, 2003 4:16 pm
- Location: The Netherlands
-
- HouseBot Guru Extraordinaire
- Posts: 1121
- Joined: Tue Sep 28, 2004 7:49 am
- Location: The Netherlands
Re: Start program with arguments
Not sure if you can use the pipe | symbol in a string like that.
Sometimes Progra~1 or something like that will work.
Or use the example from the code below.
Sometimes Progra~1 or something like that will work.
Or use the example from the code below.
Code: Select all
Function Get_WhoIs(Data)
Dim objShell
Dim objExec
Dim objStdOut
Dim arrContent
Dim strCountry
Dim strNetwork
Dim strOwner
Set objShell = CreateObject ("WScript.Shell")
Set objExec = objShell.Exec ("C:\Program Files\Meedio\Meedio HouseBot\Config\AutoHome\Programs\whosip.exe " & Data)
Set objStdOut = objExec.StdOut
arrContent = Split(objStdOut.ReadAll, vbLF)
strCountry = Replace(LTrim(Split(arrContent(3), ":")(1)), vbCR, "")
strNetwork = Replace(LTrim(Split(arrContent(4), ":")(1)), vbCR, "")
strOwner = Replace(LTrim(Split(arrContent(5), ":")(1)), vbCR, "")
Get_WhoIs = strOwner & " (" & strNetwork & ") - " & strCountry
Set objStdOut = Nothing
Set objExec = Nothing
Set objShell = Nothing
End Function
-
- Senior Member
- Posts: 136
- Joined: Tue Oct 21, 2003 4:16 pm
- Location: The Netherlands
Re: Start program with arguments
Hi Richard,
I try to run my program with some arguments.
==> CallLog.exe > out.xml
If I run this in a command box, the CallLog.exe will make a file called out.xml
I tried your code, the exe will start but there is no output file..
I try to run my program with some arguments.
==> CallLog.exe > out.xml
If I run this in a command box, the CallLog.exe will make a file called out.xml
I tried your code, the exe will start but there is no output file..
-
- HouseBot Guru Extraordinaire
- Posts: 1121
- Joined: Tue Sep 28, 2004 7:49 am
- Location: The Netherlands
Re: Start program with arguments
In my example the output should be found in: objStdOut.ReadAll and parse it or save it to an .xml file from there.
-
- Senior Member
- Posts: 136
- Joined: Tue Oct 21, 2003 4:16 pm
- Location: The Netherlands
Re: Start program with arguments
Yes, thanks it is working now...