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,3,0,4
">
  <param name="GUID" value="{370000ED-D40C-43D4-B3D3-F2E7D2EFF47D}
">
  <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