Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Evaluate an expression in VBScript

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Evaluate an expression in VBScript
  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 >>
 Evaluate an expression in VBScript - 6/26/2008 9:59:19 PM   
  viettreo

 

Posts: 2
Score: 0
Joined: 6/26/2008
Status: offline
Resource.vbs
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option explicit
Public REPORT_FILE,REPORT_SHEET
Public APP_URL,ADMIN_NAME,ADMIN_PASSWORD
Public iWebSync

iWebSync = 360000
REPORT_FILE = "D:\Automation\TestSuite\TestSuite.xls"
REPORT_SHEET = "eLearningSmoke"
APP_URL = "http://vn-wit-autotest:7001/wfo"
ADMIN_NAME = "thaithao"
ADMIN_PASSWORD = "pumpkin1"
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Driver.vbs
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
strFilePath = "Resource.vbs"

LoadTestData strFilePath


Public Sub LoadTestData(strFilePath)
   Dim fso, myFile, strTemp
   Set fso = CreateObject("Scripting.FileSystemObject")
   If Not fso.FileExists(strFilePath) Then
       Exit Sub
   End If
   Set myFile = fso.OpenTextFile(strFilePath, 1)
   Do While Not myFile.AtEndOfStream
       strTemp = myFile.ReadLine
       Execute strTemp
   Loop
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

From Drvier.vbs, I'd like to get value of the variables I declare in Resource.vbs. Is there any way to do this please. I have tried this but it seems that Execute command does not work. Thanks for any recommendation.
 
 
Post #: 1
 
 RE: Evaluate an expression in VBScript - 6/26/2008 11:36:50 PM  1 votes
  ehvbs

 

Posts: 2201
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi viettreo,

use ExecuteGlobal instead of (simple) Execute, because the later 'includes'
Resource.vbs in the current context, i.e. the Sub LoadTestData.

Good luck!

ehvbs

(in reply to viettreo)
 
 
Post #: 2
 
 RE: Evaluate an expression in VBScript - 6/28/2008 3:13:23 AM   
  viettreo

 

Posts: 2
Score: 0
Joined: 6/26/2008
Status: offline
Thank you very much! It works now.

(in reply to ehvbs)
 
 
Post #: 3
 
 
 
  

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 >> Evaluate an expression in VBScript 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