EnumPrinters

Description

Enumerates locally-available printers.

Syntax

printerName = printing.EnumPrinters(index)

Parameter Description
index (Number) Zero-based index of the printer. Increment this value for each new EnumPrinters call

Return Value

Returns the string name of the next printer. An empty value means that enumeration is over.

Example

<!-- MeadCo Security Manager - using evaluation license -->
<object viewastext style="display:none"
classid="clsid:5445be81-b796-11d2-b931-002018654e2e"
codebase="smsx.cab#Version=8,0,0,56
">
  <param name="GUID" value="{C4DB5D29-BE52-46B9-9DDF-46A167170F81}
">
  <param name="Path" value="sxlic.mlf">
  <param name="Revision" value="0">
</object>

<!-- MeadCo ScriptX -->
<object id="factory" viewastext style="display:none"
classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814">
</object>

<p><small id=idOutput></small>

<script defer>
function OutputHtml(html) {
  idOutput.insertAdjacentHTML("BeforeEnd", html)
  idOutput.scrollIntoView(false)
}

function EnumAll() {
  OutputHtml("Default printer: <b>" + factory.printing.DefaultPrinter() + "</b><br>")
  for ( i = 0; name = factory.printing.EnumPrinters(i); i++ ) {
    OutputHtml("Printer: <b>" + name + "</b><br>Job count: " + factory.printing.GetJobsCount(name) + "<br>")
    var jobName = {}
    for ( j = 0; status = factory.printing.EnumJobs(name, j, jobName); j++ )
      OutputHtml("Job: <b>" + jobName[0]+"</b>Status: " + new Number(status).toString(16) + "<br>")
  }
}

function window.onload() {
  EnumAll()
}
</script>

Applies To

printing

See Also

printer

DefaultPrinter, EnumJobs, EnumPrinters, GetJobsCount, PrintPrintSetup