Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


VB Script ERROR

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,41583
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VB Script ERROR
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 VB Script ERROR - 1/2/2007 3:55:50 AM   
  edc

 

Posts: 12
Score: 0
Joined: 3/22/2005
From:
Status: offline
I am getting an error when running my VB script. The error states:
Line: 7
Char: 1
Error: Type mismatch: 'temp'

I have this vb script running on box but not another. The OS is WindowsServer 2003.
 
 
Post #: 1
 
 RE: VB Script ERROR - 1/2/2007 4:34:38 AM   
  ebgreen


Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
There isn't much we can do without seeing the code.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to edc)
 
 
Post #: 2
 
 RE: VB Script ERROR - 1/2/2007 5:59:50 AM   
  edc

 

Posts: 12
Score: 0
Joined: 3/22/2005
From:
Status: offline
Here is the vb code:
=============================
Dim shell
strComputerName="etlddd"
set shell = createobject("wscript.shell")
set exec = shell.exec("cmd /c net start | find /C ""Informatica""")
temp = exec.stdout.readline
'msgbox temp
if temp <> 2 then
Dim iMsg
Set iMsg = CreateObject("CDO.Message")
Dim iConf
Set iConf = CreateObject("CDO.Configuration")
Dim Flds
Set Flds = iConf.Fields
Const cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdoSendUsingPort = "25"
Const cdoSMTPServer = "http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const cdoSMTPServerPort = "http://schemas.microsoft.com/cdo/configuration/smtpserverport"
Const cdoSMTPConnectionTimeout = "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
Const cdoSMTPAuthenticate = "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
Const cdoBasic = "1"
Const cdoSendUserName = "http://schemas.microsoft.com/cdo/configuration/sendusername"
Const cdoSendPassword = "http://schemas.microsoft.com/cdo/configuration/sendpassword"

With Flds
' assume constants are defined within script file
.Item(cdoSendUsingMethod)       = 2 ' cdoSendUsingPort
.Item(cdoSMTPServer)            = "EXCCCT"
.Item(cdoSMTPConnectionTimeout) = 100 ' quick timeout
.Item(cdoSMTPAuthenticate)      = cdoBasics
.Item(cdoSendUserName)          = "Info"
.Item(cdoSendPassword)          = "PPPPP"
'.Item(cdoURLProxyServer)        = "server:80"
'.Item(cdoURLProxyBypass)        = "<local>"
'.Item(cdoURLGetLatestVersion)   = True
.Update
End With
With iMsg
Set .Configuration = iConf
   .To       = "develos@abc.com"
   .From     = "develos@abc.com"
   .Subject  = "Action Required - " & strComputerName & " Informatica Service is not running"
   '.CreateMHTMLBody "http://example.com"
   .TextBody = "Informatica Service is not running on " & strComputerName & "..."
   '.AddAttachment "C:\files\mybook.doc"
   .Send
End With
End If

< Message edited by edc -- 1/2/2007 7:51:41 AM >

(in reply to ebgreen)
 
 
Post #: 3
 
 RE: VB Script ERROR - 1/2/2007 9:54:14 AM   
  Cthulhu


Posts: 4
Score: 0
Joined: 11/27/2006
Status: offline
I could be wrong, as I'm new to VBS myself, but I think you need to use != as your 'not equal' operation instead of <>.

< Message edited by Cthulhu -- 1/2/2007 12:19:44 PM >

(in reply to edc)
 
 
Post #: 4
 
 RE: VB Script ERROR - 1/3/2007 12:23:20 AM   
  mbouchard


Posts: 1924
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
You can use <>


Which line is 7?  It appears to be the If Temp line.  If so, what happens when you add the msgbox, what is returned? 

_____________________________

Mike

For useful Scripting links see the Read Me First stickey!

Always remember Search is your friend.

(in reply to Cthulhu)
 
 
Post #: 5
 
 RE: VB Script ERROR - 1/3/2007 2:39:08 AM   
  edc

 

Posts: 12
Score: 0
Joined: 3/22/2005
From:
Status: offline
This is line 7:
if temp <> 2 then
 
I don't understand your question "what happens when you add the msgbox".  I have no experience with VB.

(in reply to mbouchard)
 
 
Post #: 6
 
 RE: VB Script ERROR - 1/3/2007 2:52:46 AM   
  mbouchard


Posts: 1924
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
in the code you have the msgbox commented out just above what appears to be line 7, what happens when that is added back?

_____________________________

Mike

For useful Scripting links see the Read Me First stickey!

Always remember Search is your friend.

(in reply to edc)
 
 
Post #: 7
 
 RE: VB Script ERROR - 1/3/2007 6:57:52 AM   
  edc

 

Posts: 12
Score: 0
Joined: 3/22/2005
From:
Status: offline
Thank you for your assistance - however, when I uncommented the msgbox (line 6) and run the script a little pop up window appears.  When I click "OK" then another window appears with the same error I originally had.

(in reply to mbouchard)
 
 
Post #: 8
 
 RE: VB Script ERROR - 1/3/2007 7:23:24 AM   
  mbouchard


Posts: 1924
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
What that tells me is that you are not getting a return from your net start command.  Try changing the stdout.ReadLine to ReadAll and see if anything is displayed with the msgbox.

_____________________________

Mike

For useful Scripting links see the Read Me First stickey!

Always remember Search is your friend.

(in reply to edc)
 
 
Post #: 9
 
 RE: VB Script ERROR - 1/4/2007 2:24:55 AM   
  edc

 

Posts: 12
Score: 0
Joined: 3/22/2005
From:
Status: offline
I tried your suggestion but still the same results.  This vb script runs fine on one of our servers but not this new server.

(in reply to mbouchard)
 
 
Post #: 10
 
 RE: VB Script ERROR - 1/4/2007 2:30:50 AM   
  ebgreen


Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
"This vb script runs fine on one of our servers but not this new server."

Then I would suspect that the problem is in the configuration of the server and not the script. There isn't a lot that we can do to troubleshoot your server configuration. Here are some ideas:

-Is Informatica installed on the server?
-Can you manually start the service?
-Can you run the net start command at a command line?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to edc)
 
 
Post #: 11
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VB Script ERROR Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts