Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with WSHShell 1

Status
Not open for further replies.

Netman06

Technical User
Aug 15, 2006
70
US
Hello,

I know that I have a problem with the wshshell line, because the program does not create the text file. so what I'm I missing here.

Code:

Dim WSHShell ' declare the object variable
Dim Message1
Dim Message2
Dim Title1
Dim result1
Dim result2


Message1 = "Variable A"
Message2 = "Variable B"
Title = "SMTP Utility"
Text1 = "Operation has been canceled!"
Text2 = "I got the input:" + vbCRLF



Set WSHShell = WScript.CreateObject("WScript.Shell")

result1 = InputBox(Message1,Title,"Born", 100, 100)
result2 = InputBox(Message2,Title,"Born", 100, 100)

If result1 = "" Then
WScript.Echo Text1
Else
WScript.Echo Text2 + result1
WScript.Echo result1
WScript.Echo result2
WSHShell.Run strPath & "smtpdiag.exe" & result1 & result2 & > smtpdiagTest.txt, 1, TRUE)

End If
WScript.Quit()

Thanks,

Mike
 
.Run "%comspec% /c " & strPath & "smtpdiag.exe" & result1 & result2 & " > smtpdiagTest.txt"

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
Hello dm4ever,

thanks for the infor above

I still have a problem with the results not spacing correctly, so do I have to use the space varilble.

Here is what I'm getting:

test1.user@aol.comtest2.user@aol.com

I need this:

test1.user@aol.com test2.user@aol.com
 
I figure it out and yesy it was a space issue.

I have one more question.

With using the "%comspec% /c command, is there any way that I can hide this windows at run time.

Thanks for your help.

Mike
 
Change the 1 to a 0

.Run xxxxx, 0, TRUE

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
Thanks dm4ever.

Where is a good reference to "%comspec% /c variables.

So that I can check out other options.

Thanks as always.

Mike
 
%comspec% is simply calling cmd.exe

If you want to see the options go to the command prompt and type in %comspec% /?

The changing from 1 to a 0 is part of the Run Method of WSHShell


--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
thanks for the link and information.

I'll check it out.

Mike
 
Hi dm4ever,

What if I wanted to name the smtpdiagText file with the results2 added.

Like this:
WSHShell.Run "%comspec% /c " & strPath & "smtpdiag" & Space (1) & result1 & Space (1) & result2 & Space (1) & " > smtpdiagTest" & result2 & .txt",0,True

I'm getting an error and I think it has to do with this area of the above line of code.

" > smtpdiagTest" & result2 & .txt",0,True

so if this is a string how do I break it up and apppend results2 to it.

Like this with example of testuser as results2

smtpdiagtestuser.txt

let me know what you think on this one.

Thanks,

Mike
 
I think you're missing the " before the .txt

"%comspec% /c " & strPath & "smtpdiag" & Space (1) & result1 & Space (1) & result2 & Space (1) & " > smtpdiagTest" & result2 & ".txt"

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
Hi, dm4ever

Good Eye! That was the little bugger.

Thanks for taking time out and helping me.

Take Care,

-Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top