| | |
windows script host - help me pls
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
I have a challenge. I want to print some text based data on the client client side based on some input. I am to associate the client printer as a dos device ie LPT2 using window script host technologies but cannot just make it work. What am I doing wrong? Pls help! below is the example of what I want to do. If this can work I can implement for required scenarios.
<script language="VBScript">
sub doInitialise()
dim objPrinter, objFS, objWSHNet
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objWSHNet = CreateObject("WScript.Network")
// ' Connect to Network Printer from Windows Script Host
objWSHNet.AddPrinterConnection "LPT2", "\\TESTBENCH\TicketPr"
// ' Open Print device as a file using the File System Object
Set objPrinter = objFS.CreateTextFile("LPT2:", True)
// ' Send text to print device using the File System Object
// '
objPrinter.Write("This is a test print to the ticket printer.")
objWSHNet.RemovePrinterConnection "LPT2:"
set objWSHNet = nothing
end sub
Do you really think VB script in a browser is going to be allowed unrestricted access to the FileSystemObject? Or any kind of file/network interface access for that matter.
That might work as a desktop VBScript application; but I'm sure even I.E would notice you're trying to do something potentially dangerous if you put that on a webpage.
I know you're just trying to print and it seems quite harmless, but if IE allowed you, as a web developer, to have access to a user's filesystem or the windows script host, it wouldn't be able to reliably stop you doing what you pleased with either of them. Because of that, you'll likely find that attempting to access either of them on any level is made illegal.
That might work as a desktop VBScript application; but I'm sure even I.E would notice you're trying to do something potentially dangerous if you put that on a webpage.
I know you're just trying to print and it seems quite harmless, but if IE allowed you, as a web developer, to have access to a user's filesystem or the windows script host, it wouldn't be able to reliably stop you doing what you pleased with either of them. Because of that, you'll likely find that attempting to access either of them on any level is made illegal.
Plato forgot the nullahedron..
Y'know you are right! I was looking at a sample code in a particular tutoial and was not looking close enough. I tired those same codes as a server side script and it responded without errors. Though the response is not yet want I want but at least I have some light. I am still working on it and I am sure it would be solved. thanks. Do yuou know of any web site I can have a complete tutorial on windows script host? Thanks
•
•
•
•
Do you really think VB script in a browser is going to be allowed unrestricted access to the FileSystemObject? Or any kind of file/network interface access for that matter.
That might work as a desktop VBScript application; but I'm sure even I.E would notice you're trying to do something potentially dangerous if you put that on a webpage.
I know you're just trying to print and it seems quite harmless, but if IE allowed you, as a web developer, to have access to a user's filesystem or the windows script host, it wouldn't be able to reliably stop you doing what you pleased with either of them. Because of that, you'll likely find that attempting to access either of them on any level is made illegal.
![]() |
Similar Threads
- Windows script host and filesystemobject - pls help (ASP.NET)
- Browser popup windows (Viruses, Spyware and other Nasties)
- Script error when booting up home xp (Windows NT / 2000 / XP)
- Problems with Windows Script Encoder & #include directive (ASP)
Other Threads in the HTML and CSS Forum
- Previous Thread: Eliminating visible table borders?
- Next Thread: Best way to check a condition?
| Thread Tools | Search this Thread |
appointments asp background backgroundcolor beta browser bug calendar cart cgi code codeinjection corporateidentity css design development displayimageinsteadofflash dreamweaver emailmarketing epilepsy explorer firefox flash form format google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization perl pnginie6 positioning problem scroll seo shopping studio swf swf. textcolor timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7 xml xsl






