Start program with arguments

General HouseBot discussion. Any issues that don't fit into any of the other topics belong here.
Post Reply
jacco van der Ven
Senior Member
Posts: 136
Joined: Tue Oct 21, 2003 4:16 pm
Location: The Netherlands

Start program with arguments

Post by jacco van der Ven »

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
Richard Naninck
HouseBot Guru Extraordinaire
Posts: 1121
Joined: Tue Sep 28, 2004 7:49 am
Location: The Netherlands

Re: Start program with arguments

Post by Richard Naninck »

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.

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
jacco van der Ven
Senior Member
Posts: 136
Joined: Tue Oct 21, 2003 4:16 pm
Location: The Netherlands

Re: Start program with arguments

Post by jacco van der Ven »

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..
Richard Naninck
HouseBot Guru Extraordinaire
Posts: 1121
Joined: Tue Sep 28, 2004 7:49 am
Location: The Netherlands

Re: Start program with arguments

Post by Richard Naninck »

In my example the output should be found in: objStdOut.ReadAll and parse it or save it to an .xml file from there.
jacco van der Ven
Senior Member
Posts: 136
Joined: Tue Oct 21, 2003 4:16 pm
Location: The Netherlands

Re: Start program with arguments

Post by jacco van der Ven »

Yes, thanks it is working now...
Post Reply