Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within HTML Pages with CSS and JavaScript
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Tim Cooke
Campbell Ritchie
paul wheaton
Ron McLeod
Devaka Cooray
Sheriffs:
Jeanne Boyarsky
Liutauras Vilda
Paul Clapham
Saloon Keepers:
Tim Holloway
Carey Brown
Piet Souris
Bartenders:
Forum:
HTML Pages with CSS and JavaScript
Trying to set Default Printer
Steve Dyke
Ranch Hand
Posts: 2278
2
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I am getting an error 'object ERROR' on the SetDefaultPrinter line of code.
function initialize(){ var printerArray = ""; try{ var wshshell=new ActiveXObject("wscript.shell"); username = wshshell.ExpandEnvironmentStrings("%username%"); userTemp = wshshell.ExpandEnvironmentStrings("%TEMP%"); var wshshell2=new ActiveXObject("wscript.network"); var Printers = wshshell2.EnumPrinterConnections(); var cn = wshshell2.ComputerName; alert(Printers.length); for(i = 0;i<Printers.length;i++){ printerArray = printerArray + Printers.Item(i) + "," + Printers.Item(i + 1) + ";"; i++; } var ps = "\\\\" + cn + "\\" + Printers.Item(13); alert(ps); wshshell2.SetDefaultPrinter(ps); } catch(err){ alert(err); } }
Eric Pascarello
author
Posts: 15385
6
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Is the active-x settings security at correct levels?
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Label Printing Chalenge
Progress Bar and AJAX Call
Problem while accessing USERPROFILE folder through JavaScript
Getting IE to Allow ActiveX
Getting Around Special IE Settings
More...