| |
IsamuDyson
Posts: 2
Score: 0
Joined: 5/17/2002
From: Canada
Status: offline
|
Hi everyone, This is my first post here. I am a student using w3runner and vb, and currently stumble into some problems. I wonder if any one can help me out. I am currently testing a web page. It resembles something like a University registrar office where u have to put in your username and password to login. Then u can chose to look at what course you took, tution fee etc... I am writing a set of code testint it. The test codes logons and click on the options on the site. It reads in a text file of the inputs such as the usernames. passwords, year, etc... I am currently using Regexp's pattern to determine the pattern of the line. In the codes are hard set some of the information and but it in an array. Then the program detects if there is a config.txt file. If there is read it and use pattern to extract the information. The problem is it is not working hahahahaha... It goes thorugh it and nothing happens... I tried to trace what happens after the pattern is applied but there is nothing showing. I posted a sample of the text file on the bottom. When there is the regexp stuff in the codes it only reads up to the first line where the pattern needs to be applied. I put an arrow on the line were it reads up to at the bottom. But if I delete all the regexp it reads the whole file. Here is the code. I know is pretty long but I am really stuck. I hope so of the pro out there can help me out. Here are teh codes: ' override by the Config.txt file if it exists If FS.FileExists( fname ) Then ' Open the Config text file for reading Set F = FS.OpenTextFile( fname, 1, False ) W3Runner.TRACE "Config reads the Config.txt file" ' Read until to the end of file Do While F.AtEndOfStream <> True Dim aline, pos ' Read a line and remove the '#' character and the rest aline = F.ReadLine pos = Instr( aline, "#" ) If pos > 0 Then aline = Left( aline, pos - 1 ) End If aline = Trim( aline ) ' If that line is not empty, then split the line into key and value If Len( aline ) > 0 Then Dim temp, key_, value Dim oRe, oMatch, oMatches Set oRe = New RegExp oRe.Pattern = "(\w+)\s*(.*)" Set oMatches = oRe.Execute( aline ) Set oMatch = oMatches(0) W3Runner.TRACE "Match: " + oMatch key_ = oMatch.SubMatches(0) W3Runner.TRACE "Key: " + key_ value = oMatch.SubMatches(1) W3Runner.TRACE "Value: " + value ' setValue the key and value pair into the Key Array objKArr.setValue key_, value End If Loop F.Close End If and here is a sample fo how my config.txt looks: # Overriding the default values of the variables # Comments are denoted by # # One variable declaration per line # Syntax: # Variables are case sensitive # Example: URL_ROOT http://localhost:8080/ URL_ROOT http://aaaaaaaaaaaa ; <- reads up to here and stops ISY 1985 HOME_URL http://aaaaaaaaaaaa/aaa/aaaaa.jsp PORTAL_URL http://aaaaaaaaaaaa/csi USERNAME 1111111 PASSWORD 1111111 thx for your attention. Herbert
|
|