Sign in to follow this  
Followers 0
gcue

creating an array?

3 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

perfect!!

thanks mate.

Share this post


Link to post
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
Sign in to follow this  
Followers 0