Jump to content

creating an array?


gcue
 Share

Recommended Posts

i am trying to list printers that are installed locally and not manage via network queues

how can i get this into an arraydisplay type of display?

#include <"array.au3">

For $i = 1 To 20
    $var = RegEnumKey("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\windows nt\currentversion\print\printers", $i)
    If @error <> 0 Then ExitLoop

    $printer_name = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\windows nt\currentversion\print\printers\" & $var, "Name")
    $printer_port = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\windows nt\currentversion\print\printers\" & $var, "Port")

    If Not StringInStr($printer_port, "ipp://") Then
        MsgBox(0, "", $printer_name)
    EndIf
Next
Edited by gcue
Link to comment
Share on other sites

i am trying to list printers that are installed locally and not manage via network queues

how can i get this into an arraydisplay type of display?

#include <"array.au3">

For $i = 1 To 20
    $var = RegEnumKey("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\windows nt\currentversion\print\printers", $i)
    If @error <> 0 Then ExitLoop

    $printer_name = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\windows nt\currentversion\print\printers\" & $var, "Name")
    $printer_port = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\windows nt\currentversion\print\printers\" & $var, "Port")

    If Not StringInStr($printer_port, "ipp://") Then
        MsgBox(0, "", $printer_name)
    EndIf
Next
With _ArrayAdd(), like so:
#include <Array.au3>

Global $avKeys[1] = [0]
Global $i = 1

While 1
    $var = RegEnumKey("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\windows nt\currentversion\print\printers", $i)
    If @error <> 0 Then ExitLoop
    $printer_name = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\windows nt\currentversion\print\printers\" & $var, "Name")
    $printer_port = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\windows nt\currentversion\print\printers\" & $var, "Port")
    If Not StringInStr($printer_port, "ipp://") Then _ArrayAdd($avKeys, $printer_name)
    $i += 1
WEnd
$avKeys[0] = UBound($avKeys) - 1

_ArrayDisplay($avKeys, "$avKeys")

:P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...