OZONE Asylum
Forums
DHTML/Javascript
Reading special characters with FileSystemObject
This page's ID:
27909
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
[b]Poi:[/b] Sorry for being so sloppy with the terms, but I think they too refer to it as JavaScript sometimes... Thanks to a comment to the blog entry liorean posted, I discovered there are more than one way of reading files. (I subscribe to the feed, but somehow missed that entry, and I didn't see it when searching...) After applying google-fu to this info and reading about its uses, I simply fired up an ADODB Stream to get what I want! (I've always found the msdn library to be a good reference, but only when you already know where things in it are located.) Here's what I do: [code] var str = new ActiveXObject("ADODB.Stream"); // Won't work if run from a browser because of a vulnerability fix (throws an "..can't create object" error), but I don't care since it won't be running in a browser... str.Type = 2; //adTypeText str.Open(); str.loadFromFile(".....uTorrent\\resume.dat"); str.Charset="ASCII" var txt=str.readText(); str.close(); str = null; txt=txt.substring(2); // Remove the two first Byte Order Mark characters. alert(txt) // Had me fooled at first because the text was too long to fit in an alert. But txt.length assured me I had the whole file. [/code] I think this code snippet might become very useful in future script too. Too bad there isn't a non-MS-standard for file access out there :( /TwoD
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »