Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

VBScript, COM And TCP/IP

I have a very simple VBScript. and a simple COM object, and I would like to use this COM object with an application
that has a TCP/IP mechanism, BUT NO COM.
   I would like this to be as light weight as possible. I know .NET has a great Sockets library ( class ? ), but that is not available to me in
the app that the VBScript will be hooked into.
   I have read on the Winsock forum that binding in a Winsock control ( also the dll ? ) has some licensing implications that I would
rather not have to deal with.
   I only need to pass strings between the 2 apps, no data objects or databases.

  In summary - I have 2 apps, one that is COM compliant, but no TCP/IP, and one that is TCP/IP compliant, but no COM.

I am also looking at adding a COM mechanism into the TCP/IP compliant app, but thought that adding TCP/IP to the COM object
would be a quicker way to get results

  Ideas and observations gratefully received.

   Thanks in advance for your help - below is the simple COM code - if that helps.
<?xml version="1.0"?>

<?component error="false" debug="true"?>


    <method name="NotifyJO">
        <PARAMETER name="X"/>
        <PARAMETER name="Y"/>
    <method name="ConnectOnPort">
        <PARAMETER name="X"/>
    <method name="SendInfo">
    <method name="GetInfo">
    <event name="CalcError"/>

<implements type="Behavior" id="Behavior"/>

<script language="VBScript">

function NotifyJO(X,Y)
    NotifyJO = "Trying to connect to " & X &" from " & Y
end function

function ConnectOnPort(X)
    ConnectOnPort = "Connecting on port " & X
end function

function GetInfo()
    GetInfo = "Get Info"
end function

function SendInfo()
    SendInfo = "Send Info"
end function

function mNoParameters()
   mNoParameters = "Temporary Value"
end Function

sub MyComponent_MethodCalled()
   'some event handling code
end sub



View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Can I Pass A Parameter To VBSCript And How Can I Get Current Path In VBScript?
Can I pass a parameter to VBSCript ?
How can I get the local path in VBScript?

Vbscript Help
Is it possible to get all the list of files from this ftp ?

VBScript To EXE
Hi All

How Do I convert my VBScript to an executable?



Need Help In Vbscript
I would like to detect whether a text field is clicked in the contact form in outlook, i am toatally new to vb in any form especially vb script, heres what i have:

Sub FullName_Click( )

output something via MsgBox

End Sub

this is all i have and i think the problem is it is not detecting the FullName field as it works fine when i use a command button. I've also tried GotFocus and Enter, like general vb but it didn't work.

Please can you help.

About VBScript {in VB}
Hello all, I'm wondering if its possible to use VBScript in a VB application. For example in a game, where the VBScript files contain the character functions etc, so I dont have to edit the exe everytime I want to change something.
As if VB were interpreting the VBScript.

Thanks in advance.

VB = VBScript?!?!?

I don't know if this is the right place for this question
but I'll give it a shot any way, and here it comes, bit silly...

Is the coding language in VB is VBScript or just VB?

VBScript To EXE
I codes a VBScript file to generate pdf files dynamiclly and send them out to user's email with CDONTS . It works well. But with low efficient. Now my boss ask to change it into vb exe file.
Can I just create a new project with VisualBasic then paste the code into it?
It errors~

I can't seem to be able to get the Val function to work in vbScript. As in:
Dim temp
temp = val("123 fake street")
MsgBox temp
I want the temp var to read only the 123. Is there another way to do this when using vbScript?



Can any one give me a good web site on learin VB scripts?

VB6 From VBScript
Just learning VB6 now after previously learning (with a fair working knowledge) VB Script. Will most of the language translate from VBScript to VB6, particularly from the interaction with Access point of view? I understand that I cannot use response.write and many other I am sure but as far as connecting to the database, executing recordsets, etc. can I just copy it over?

Is their such a resource (a book or on the web) that tells me what works in both languages?

Hi people, i have this simple vbscript:

Public Sub Main()

dim FecDesde30, FecDesde90, Fecha

FecDesde30= DateAdd("d", -30, CDATE(Fecha))
FecDesde90= DateAdd("d", -90, CDATE(Fecha))

msgbox "FecDesc30=" & FecDesde30
msgbox "FecDesc90=" & FecDesde90

End Sub

Well,I have a Script Control in VB6 to execute this script.
The variable 'Fecha' is setted from VB with current date (dd/mm/yyyy format).
My problem is, i have the dd/mm/yyyy format and when i use dateadd function
this returns date with mm/dd/yyyy format.
Any solution?
Thanks in advance!
Merry Xmas to all!

VBScript In VB6
Hey is it possible to program in VB6 and then save or convert to VBScript? It seems like it should be possible, but I haven't found a way to do it yet.

Getting The INI Value In Vbscript!
Forgive me all!
I see some great code here for getting INI values in VB. I need to get the value using VBscript. I have tried to modify the VB code, to no avail. Can any one help?

TIA Bill

How To Use VBScript??
What is the differance between regular VB and VBScript? I'm trying to copy a file using 'fsys.copyfile' and I get an error that says I need an object. Are they 2 totally different things? I'm just a little confused. Is there another way I can copy a file and rename it?

I'm learning VB on the job so all this is new to me.

Any help is greatly appreciated 8^)



i need to modify the name of a file to store it because it is over written all the time. I thoucht of having a text file that will store the counter which will then be used to modify the name. after the name is modified, i would like to over write the "new" value of the counter.

the change of file name works fine, but it doesnot work to read the txt file.

Thanks Eric

my attempted code is here:

Const ForReading = 1, ForWriting = 2, ForAppending = 8

Dim fso, f, val
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("c:...counter.txt", ForReading)

set val = f.ReadAll

val = CInt(val)
val = val + 1
val = CStr(val)

outFileName = "c:...glue_input" + val + "_ts_h_26_38_5.t0"


dim filesys
set filesys=CreateObject("Scripting.FileSystemObject")
filesys.MoveFile "c:... mp s_h_26_38_5.t0", outFileName

Set f = fso.OpenTextFile("c:she2001dataskaaruplayercounter.txt", ForWriting, true)
f.write (val)

i need help writting a script

i am tryin to write a script that will move logs file to a different location then move a new template of that file to the same folder

VBscript Help..
The below code works like a dream, it copies one file and distributes it to a large number of directories on a shared folder located on our server, it also records the directories it has skipped due to error.

Throughout the shared folder, there is a mix of different templates, some get one and some get another. We differentiate between each user by having a folder in each users directory called either 'Normal' or 'Normal_PM', I use the two versions of this script to do this.

When the script run and updates, it records errors but it also records non-errors due to the file path being different IE

K:Named, FolderDatabasesNormal - Path Not Found (this isn't an error it's just a different file path)

Is there a line of code I can add to this script that can say something like -

If file path is "DatabasesNormal_PM" skip and resume next?

Dim fso, f, fc, f1, SourceFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set SourceFile = fso.GetFile("")
Set f = fso.GetFolder("K:")
Set fc = f.SubFolders
For Each f1 In fc

If InStr(f1.Name, ",") > 0 Then
On Error Resume Next
SourceFile.Copy f1 & "Databases
If Err.Number <> 0 Then
Select Case Err.Number ' Evaluate error number.
Case 70
mystr = mystr & F1 & " - Permission Denied" & vbnewline 'add to string here
Case 76
mystr = mystr & f1 & " - Path not found" & vbnewline ' add to string here
Case Else
End Select
End If
On Error GoTo 0
End If

Set F1 = fso.CreateTextFile("K:NoticeboardUpdate Script LogsNormalUpdateScriptLog.txt", True)
f1.Write mystr
Set f1 = nothing
set fso = nothing

VBA To VBScript
I've been trying to develop a File distribution script, with some success, I've managed to get the script to copy one file and then distribute it into the many folders, but now I'd like it to record the folders it has skipped due to errors IE: Error 76 "File path not found". But I can't get it to work, Any suggestions?
Range("A1").Value = "Folders Omitted"
Range("A1").Font.Bold = True
ActiveCell.Offset(1, 0).Select

Dim fso, f, fc, f1, SourceFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set SourceFile = fso.GetFile("E:Test AreaNormalUpdatesNormalPM")
Set f = fso.Getfolder("E:Test Area")
Set fc = f.SubFolders
For Each f1 In fc

If InStr(f1.Name, ",") > 0 Then
On Error Resume Next
SourceFile.Copy f1 & "Databases
If Err.Number <> 0 Then
Select Case Err.Number ' Evaluate error number.
Case 76 ' "Path not found" error.
ActiveCell.Value = f1
ActiveCell.Offset(1, 0).Select
'LogInformation f1
Case Else
ActiveCell.Value = f1
ActiveCell.Offset(1, 0).Select
End Select
End If
On Error GoTo 0
End If

Objexcel.ActiveWorkbook.SaveAs("E:Test AreaNoticeboardNormalUpdatesomitted files.xls")

VB && VBscript
Hi, I have some vbscript code that I launch from a vb platform. The script produces some results when ran with the use of Wscript.Echo which produces message box like responses.

How can I retrieve information from a script unto my vb platform hence avoiding the use of Wscript.Echo . Thanks

How To Run A VBscript From VB6
Hi Happy New Year I would be grateful if told how to run vb scripts via the VB6 platform. Thanks

Can VBScript Help Me On This?

I have an url ( that is re-directed to another name. When the user enters, however, I want the other (re-directed to) domain to show in the Browser History List* and not

(*The Browser History List is the drop-down box of 25 or so recently visited url's).

So to recap, I am looking for the 're-directed to' url to be shown in the BHL record and not Either that, or no url is to be recorded/shown at all.

If you can help, please get in touch with me here or at:


Exe To Vbscript
Hi . I want to transform a .bat like .exe wich connects to a shoutcast server then sends .nsv files to stream. this is how it works n in cmd you cd to the place where the .exe is located and type :

nsvscsrc host:port:pass:headers.txt dir1 [dir2 ...]

here is the .exe : .

i want to transform that to vb code. Also the way i want it to work is that i made several text boxes for host , port,pass ,headers.txt and dir1 in wich the user inputs the information into the text boxes , then clicks connect and it will gather the information and use it to connect.

If anyone can tell me how to do this it would be much appreciated

VB Or VBScript?
Hey, posted this over in VBScript also. I am very new to VBScript. I know VB pretty good though, so hopefully this helps. I am trying to use VB or VBScript to open or pass a command line to Monarch Pro to take a report and put it into a template, that is already created, load it to a certain website, login automatically w/ username and password, and give it the template for the website to do whatever to it. My question is, do I need to use VBScript for this or can I use regular VB? Do I use the script tags in VB if I hve to use VBScript? Just trying to figure out how I would even start something like this. Thanks.

VBScript Help
I have got the vbscript function workin well, but i want it to compare two text boxes and change text in them accordingly but it doesn't accept the simple if statement i write?

Does the vbscript function not support if statements etc...???



VBScript: NOT LIKE.....
ok, in vb,

VB Code:
If Not (sCurData Like "<" & curUser.sName & "> " & curUser.sName & " is kicking * because: *") Then

would say that

sCurData is not like....


<SOMEBODY> SOMEBODY is kicking NE_1_Else because: This is the reason.....

Now, i tried to use this in a vbscript, and for some reason it throws up the error of:


Error #35 - Sub or Function not defined on line 71

now, i know that curUser.sName is defined, and sCurData is defined, so it means either NOT or LIKE doesnt work in VB Script, so can somebody give me another way / the correct syntax to do this code plz?

tnx guys


Help For VBScript Please
Hi, I use a webpage in a webbrowser control of my main form. And i'd like to be able to comunicate from the VBCript on my html page to my main vbapplication. Exemple :

<script language="vbscript">
sub YourFunction()
frmMain.text1.text = "Hiya"
end sub

<a href="#" onclick="YourFunction()">Click here!</a>

I think everyone see what I mean but ofcourse here the VBScript crash cause he don't recognize frmMain which is the main form of my VB applciation. So anyone can tell me how to be able to use control on my main application from a VBScript on a web page displayed in a WebBrowser control.

Thanks in advance.

I am using the following VBScript code for loading notepad.

Set objWScript = CreateObject("WScript.Shell")
Set objExec = objWScript.Exec("notepad")

In WindowsXP, it runs fine, but on Windows 2000 and earlier the script give this error:
Object doesn't support this property or method: 'objWScript.Exec'

Is there a way to re-write the code to open notepad in Windows 2000 and earlier or is there an update for the older OS's to be able to support that method?

Thanks in advance!

VBScript-What Can I Do With It?
I've recently learned of VBscript, and I've read a few tutorials, done a little coding...

My question is: Where does VBScript become incapable of doing what VB can do?
Can it do APIs?
Can it use controls? (RTF, Picbox, slider...)
Can it make control arrays?
Userdefined objects and types?(yeah, data in javascript/vbscript is weird)

what are its limits?

VBScript Help
I am not sure about VBScript because I use Javascript on the client side (which is where this would need to happen). For Javascript you would do:

<script language="javascript">
total = 10
function uncheck(num,me){


if(i != num-1)


num is the number checkbox starting at the top with 0.
me is the checkbox, i.e. document.userform.check2
total is the total number of check boxes

Hi all.
I have obtained the Microsoft VBScript Regular Expressions 5.5 install package and ran it. It apparently installed correctly. But, upon looking at my project's references I have noticed that particular reference says it has installed to WINNTSystem32vbscript.dll3. However, I am unable to locate such folder on my HDD.
I bring this up because I have noticed that any installation package I create for my app does not appear to be installing this version of the .dll.

Has anyone else noticed this or have any explanation for this situation?

How Can I Do This In VBScript?
Declare Function CoCreateGuid Lib"ole32"(ByRef IpGUID As GUID, ByVal IpSTR As String, ByVal ISize As Long) As Long

Public Function GetGUID() As String
Dim pGuid As GUID
Dim IResult As Long
Dim S As String
s="String(100, "")
IResult=CoCreateGuid(pGuid, s, 100)
GetGUID= StrConv(s, vbFromUnicode)

End Function

Any help on this would really be appreciated!!!

I'm not stupid enough to run .vbs files, but what about VBScript embedded into HTML pages? How do I stop those?

This is on a Windows NT/2k computer.

I tried turning off Active Scripting in the Security options but that disabled javascript also.

What is wrong on this sentece?

mRowCount = 3
REDim mavarData(1 To 3, 1 To mRowCount)
I am using VBSCRIPT

P.S.: mavarData is previous defined as DIM mavardata()

VBScript SQL Help
Hi Everyone,

Why doesn't this VBScript SQL statement work correctly? The First example works just fine but the other does not work at all. They are both located in an ASP page. Basically I want to load a second combo box based upon what was loaded in the first combo box. Here is the code for the second combo box. I would appreciate nay help. Thanks.

This code works for the second combo box.


rs.Open "SELECT Format(PDate, 'mmmm') FROM " & _
"History GROUP BY Format(PDate, 'mmmm'), " & _
"MemID, Year(PDate), CLng(Month(PDate)) " & _
"Having Year(PDate) = 2002 " & _
" And MemID = " & NewID & " ORDER BY CLng(Month(PDate))"

This code does not work for the second combo box.


rs.Open "SELECT Format(PDate, 'mmmm') FROM " & _
"History GROUP BY Format(PDate, 'mmmm'), " & _
"MemID, Year(PDate), CLng(Month(PDate)) " & _
"Having Year(PDate) = '" & Request.Form("cboYear") & "' " & _
" And MemID = " & NewID & " ORDER BY CLng(Month(PDate))"

I think the error is here, but I am not sure. Thanks for any help.


"Having Year(PDate) = '" & Request.Form("cboYear") & "' " & _


Could anybody help me?

I'm trying to find help file with vbscripting methods functions and other. I found a lot of sites there all information I need is, but I don't have much time to read all of them and whee I work there is no network. Could anybody say me where I can download it in single file or mayby upload it here?


Sorry for my englsih...

VBScript Help
Hi Everyone,

I am trying to highlight every other row of data that is retrieved and displayed in the ASP page in a different color. So far so good. My question is this. I cannot figure out how to break the data into rows. I have tried using the <br> command but it either breaks into a new row at every item or it breaks after all items have been written to the same row. Please help if you can. Here is the code.


Dim mcnAP
Dim Connect
Dim rs
Dim lngCount
Dim Count
Dim NewID
Dim i

mcnAP="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("TESTTestData.mdb")

Set Connect = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")
Connect.Open mcnAP

NewID = Request.Cookies("NewID")

rs.Open "SELECT * FROM Vendors WHERE VendorID = " & NewID & "", mcnAP, 1, 3

For i = 0 To rs.Fields.Count - 1

<th bgcolor="#c0c0c0">
= rs(i).Name



Count = 0

While Not rs.EOF

For i = 0 To rs.Fields.Count - 1

If Count = 0 Then

<td bgcolor="#f1f1f1">

= rs(i)


<td bgcolor="#c0c0c0">
= rs(i)

End If


Count = Count + 1

If Count = 2 Then Count = 0




End If

Set rs = Nothing


where can i get it? and are there ant good tuts on it?

I am trying to use the onChange event in a combo box to send a query to a db. So far I am completely not getting it. Below is my code, what am I doing wrong?

<!-- Instruct non-IE browsers to skip over VBScript modules.

Sub cmbOffices_OnChange
dim objCon, objRS, strSQL, strSite
set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:appslueslipdbdbPhone.mdb"

strSite = request.querystring("cmbOffices")
msgbox "Site" & strSite
strSQL = "Select * from tblEmp where site = " & strSite

set objRs = Server.CreateObject("ADODB.Recordset")
objrs.Open strSQL, objConn

End Sub
<FORM NAME="frmOffices" action="bslip.asp?cmbOffices=">
<SELECT id="cmbOffices" name="cmbOffices">
<OPTION selected="">Select an Office</OPTION>
<OPTION value="2">Clarkston</OPTION>
<OPTION value="38">Colfax</OPTION>
<OPTION value="33">Colville</OPTION>
<OPTION value="22">Davenport</OPTION>
<OPTION value="129">Mattawa</OPTION>
<OPTION value="13">Moses Lake</OPTION>
<OPTION value="26">Newport</OPTION>
<OPTION value="24">Okanogan</OPTION>
<OPTION value="1">Othello</OPTION>
<OPTION value="111">Region</OPTION>
<OPTION value="10">Republic</OPTION>
<OPTION value="59">Spokane North</OPTION>
<OPTION value="60">Spokane SW</OPTION>
<OPTION value="58">Spokane Valley</OPTION>
<OPTION value="4">Wenatchee</OPTION>

VB, VBscript And VB.NET
Which particularities have VBscript and VB.NET to make them different from VB.

Is VB.NET the VB substitut?

Vbscript Or VBA?
Hi there, I'm looking for a littel advice on what VBScript will do in OUtlook.

I need to design a form that users can send to each other, as the fields are filled in and the form sent on it needs to populate a SQL db.

Can I use ADO to do the SQL db connection from within an Outlook form using VBScript?? Or do I need to use VBA?

I think I may need to use VBA but am not sure how I can set up a form that'll go between users, keeping all its code all the while.

Any suggestions would be greatly appreciated.


Hi guys.

i use VBScript on my sampe web site, and i implement an interface to some activex control. But when i use IE to browse my web, it report that "ActiveX Server can't create component", so i disable IE security option. It run well, but bring up a message box "An activex control on this page might be unsafe to interact with other parts of the page. Do you want.....".
does any body know how to prevent IE brings up warning message programatically with VBScript???

thanks a lot..

VBScript In VB
I wish to run a vbscript code when a Command button is clicked.
I dont wish to call the statement:

ShellExecute "vbsfile.vbs"

Is it possible through MS Scripting control?

Help me out.

I have a text file in c:windowsdesktop ext1.txt.
It contains a vbscript.

I want to run that file with my programme at runtime.

Please tell me how.

A example project would be vey helpful.

does anybody know of any good places that give you source code for vbscript some place besides i need to get as much as i can. thank i apreshate any help

How do I display the date/time in a label when a webpage loads? In VBSCRIPT.

Help With Vbscript...
i was wanting to make easy update for news on my page and was wondering how to use vbscript to append to the file containing the news can anyone help me plz...

I was wanting to setup a webpage i have with the ablilty to post news and such without having to login to the server and editing it by hand. Is there a way i can setup a form to do this with vbscript or am i going to need cgi or java?...

How Is VB Different From VBscript
i know Vb and VBscript are different. but i would like to what are some of the common things(procedures, properties) etc. that are restricted in VBscript and can be found in VB.

I know this is might not be the best forum to post in, but is there a quick way (in VBScript) to tell if there is more than one occurance of a "." in a string?


????(0_0)???? Towards VBScript....
How do i go about using vbscript????
I Have vb 6 pro but i dont have a clue as to how i use vbscript??

can someone fill me in?

NewBee Vbeer6.0()
End Sub

Copyright 2005-08, All rights reserved