Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Javascrpit to VBscript: can vbscript read data

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Javascrpit to VBscript: can vbscript read data
  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 >>
 Javascrpit to VBscript: can vbscript read data - 1/28/2004 11:02:59 AM   
  mikenowo

 

Posts: 4
Score: 0
Joined: 1/28/2004
From: Canada
Status: offline
I have written a number of javascript functions (embedded in html) that allow me to sort columns of data on a web page. Problem is I'd like it to be able to read a text file (delimited) on the server which javascript cannot do. SO, I've had to embed my data into an array WITHIN the html/javascript code itself. Is there any way that VBscript would be able to read a simple delimited text file if it existed in the same directory on the server? If so, any examples of such code?

If VBscript could/can read the data, I'd like to re-write my html column sort in vbscript from javascript as well... any suggestions as to a good VBscript syntax/example site would be great.

Thx,



l8r,
m.
 
 
Post #: 1
 
 Re: Javascrpit to VBscript: can vbscript read data - 1/28/2004 6:31:07 PM   
  alpha

 

Posts: 3
Score: 0
Joined: 1/28/2004
From:
Status: offline
Here is my code


Set fso = CreateObject("Scripting.FileSystemObject")
dim f, fz, i
Set f = fso.GetFile(AppPath & "\config.txt")
if err.number <> 0 then
readconfig = Err.Number
exit function
end if
Set fz = f.OpenAsTextStream(ForReading)
Redim Preserve orders(0)
Do While fz.AtEndOfStream <> True
orders(Ubound(orders)) = fz.Readline
ReDim Preserve orders(Ubound(orders)+1)
Loop
fz.close

(in reply to mikenowo)
 
 
Post #: 2
 
 Re: Javascrpit to VBscript: can vbscript read data - 1/28/2004 9:00:33 PM   
  mikenowo

 

Posts: 4
Score: 0
Joined: 1/28/2004
From: Canada
Status: offline
Hmmm.. that looks exactly the same as regular VB... how do you encapsulate it into html?

With javascript it's simply:



--

Is VBscript just?:






l8r,
m.

(in reply to mikenowo)
 
 
Post #: 3
 
 Re: Javascrpit to VBscript: can vbscript read data - 1/28/2004 11:45:32 PM   
  alpha

 

Posts: 3
Score: 0
Joined: 1/28/2004
From:
Status: offline
I never encapsulated it in html. I'm using VB script to
administrate. Sorry.

alpha

(in reply to mikenowo)
 
 
Post #: 4
 
 Re: Javascrpit to VBscript: can vbscript read data - 1/29/2004 4:18:04 AM   
  mikenowo

 

Posts: 4
Score: 0
Joined: 1/28/2004
From: Canada
Status: offline
Ok, thx for the info.

l8r,
m.

(in reply to mikenowo)
 
 
Post #: 5
 
 Re: Javascrpit to VBscript: can vbscript read data - 1/29/2004 7:11:50 AM   
  mikenowo

 

Posts: 4
Score: 0
Joined: 1/28/2004
From: Canada
Status: offline
heh.. I just noticed that my previous post doesn't even display the code because it thought it was real code (because of the '<' and '>' tags).. sigh. Can't post any html here as a result.

In any event, I tried your code but get an error on this line:

Set fz = f.OpenAsTextStream(ForReading)

The error is:

"Invalid procedure call or argument"

Any idea why I may be getting this?

Thx,


l8r,
m.

(in reply to mikenowo)
 
 
Post #: 6
 
 Re: Javascrpit to VBscript: can vbscript read data - 5/26/2005 1:36:05 PM   
  TNO


Posts: 1402
Score: 16
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
Have you tried using the TDC (Tabular Data Control) obect? Or perhaps ADO?

TDC:
msdn.microsoft.com/workshop/database/tdc/overview.asp

ADO:
http://www.w3schools.com/ado/default.asp

(in reply to mikenowo)
 
 
Post #: 7
 
 Re: Javascrpit to VBscript: can vbscript read data - 5/26/2005 8:58:26 PM   
  Zifter


Posts: 318
Score: 0
Joined: 1/5/2005
From: Belgium
Status: offline
quote:
Originally posted by mikenowo

heh.. I just noticed that my previous post doesn't even display the code because it thought it was real code (because of the '<' and '>' tags).. sigh. Can't post any html here as a result.
You can. Just put you code between the forum code tags [ code] [/ code]
(Remove the space before the word "code")

(in reply to mikenowo)
 
 
Post #: 8
 
 Re: Javascrpit to VBscript: can vbscript read data - 5/28/2005 2:16:39 AM   
  lanreogunkola

 

Posts: 4
Score: 0
Joined: 5/21/2005
From: Nigeria
Status: offline
I have not tested the above and would not know if it has any errors. but to embed it in an html page.

It should look like this on the code page:

<script language=vbscript>

function readtxtdelimited()
Set fso = CreateObject("Scripting.FileSystemObject")
dim f, fz, i
Set f = fso.GetFile(AppPath & "\config.txt")
if err.number <> 0 then
readconfig = Err.Number
exit function
end if
Set fz = f.OpenAsTextStream(ForReading)
Redim Preserve orders(0)
Do While fz.AtEndOfStream <> True
orders(Ubound(orders)) = fz.Readline
ReDim Preserve orders(Ubound(orders)+1)
Loop
fz.close
end function
</script>

(in reply to mikenowo)
 
 
Post #: 9
 
 Re: Javascrpit to VBscript: can vbscript read data - 5/31/2005 9:29:25 AM   
  rockocubs

 

Posts: 65
Score: 0
Joined: 4/8/2005
From:
Status: offline
<script type="text/vbscript">

Sub OpenVis(strLocation)
Set objViso = CreateObject("Visio.Application")
objViso.Visible = 0
End Sub
</script>
Goes between the heading Tags.

In the Body
<td>
<form>
<input type="button" onClick="openViso('K:\Status report\JavaPrograms\hi.txt')" value="BLD Template">
</form>
</td>

(in reply to mikenowo)
 
 
Post #: 10
 
 Re: Javascrpit to VBscript: can vbscript read data - 5/31/2005 12:16:28 PM   
  beaker

 

Posts: 78
Score: 0
Joined: 1/27/2005
From: USA
Status: offline
Following up on TNO's post to the TDC, here is another link you can try:
http://www.mindspring.com/~redrocker1/hta_tuto/tdc_tuto.htm

(in reply to mikenowo)
 
 
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 >> Javascrpit to VBscript: can vbscript read data 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