Jump to content

Printer Network


Recommended Posts

Hello to all

I would created a script to add port tcp / ip in the register and then install the imp

in my script I have a popup that asks what you want imp

When I select the imp from the imp has chosen

it informs the IP address.

Here is my script because I block

Bonjour a tous

je voudrais cree un script pour ajoute des port tcp/ip dans le registre et par la suite installer l'imp

dans mon script j'ai un popup qui demande quel imp on veut

quand je selectionne l'imp par rapport a l'imp choisi

il renseigne l'adresse ip.

voici mon script car je bloque

#include <GUIConstantsEx.au3>

#Region ### START Koda GUI section ###
$Form1 = GUICreate("Menu", 250, 250, -1, -1)
$Imp = GUICtrlCreateCombo("", 30, 75, -1, -1)
GUICtrlSetData(-1, "$P0000001|$P0000002", "P0000001")
$OK = GUICtrlCreateButton("OK", 65, 110, 129, 113, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

$P0000001 = "7.24.120.5"
$P0000002 = "7.24.120.6"


While 1
    $Msg = GUIGetMsg()
    Select
        Case $Msg = $GUI_EVENT_CLOSE
            ExitLoop

        Case $Msg = $OK

            ;; Stop the Print Spooler service
            RunWait('cmd /c net stop "print spooler"')

            ;; Right the Registry Values for the IP port
            RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\" & GUICtrlRead($Imp), "Protocol", "REG_DWORD", "00000001")
            RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\" & GUICtrlRead($Imp), "Version", "REG_DWORD", "00000001")
            RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\" & GUICtrlRead($Imp), "HostName", "REG_SZ", GUICtrlRead($Imp))
            RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\" & GUICtrlRead($Imp), "HWAddress", "REG_SZ", "")
            RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\" & GUICtrlRead($Imp), "IPAddress", "REG_SZ", "")
            RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\" & GUICtrlRead($Imp), "PortMonMibPortIndex", "REG_DWORD", "00000001")
            RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\" & GUICtrlRead($Imp), "PortNumber", "REG_DWORD", "00009100")
            RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\" & GUICtrlRead($Imp), "SNMP Community", "REG_SZ", "public")
            RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\" & GUICtrlRead($Imp), "SNMP Enabled", "REG_DWORD", "00000001")
            RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\" & GUICtrlRead($Imp), "SNMP Index", "REG_DWORD", "00000001")

            ;; Start the Print Spooler Service
            RunWait('cmd /c net start "print spooler"')
            RunWait('cmd /c net stop "print spooler"')
            RunWait('cmd /c net start "print spooler"')

            ;; Install the printer
            ;RunWait(@ComSpec & ' /c rundll32 printui.dll,PrintUIEntry /if /b "Test Printer" /f c:\disk1\oemsetup.inf /r "IP_& GUICtrlRead($Imp)" /m "Ricoh Test" /Z')

            ;; Reset to Regular user
            ;RunAsSet()
            Exit


    EndSelect

WEnd

Tks

Edited by africanism
Link to comment
Share on other sites

I'm not sure what you are asking

#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

Link to comment
Share on other sites

thank you for your response

in my list if I chose P0000001 I want it to inform myself in the registry key address 7.24.120.5

if I chose P0000002 I want it to be 7.24.120.6

Bonjour

Quand je selectionne dans la liste l'imprimante et que je clic sur ok

je veux qui me renseigne la bonne adresse ip dans les cle de registre

Edited by africanism
Link to comment
Share on other sites

first, change

GUICtrlSetData(-1, "$P0000001|$P0000002", "P0000001")

to

GUICtrlSetData($Imp, "$P0000001|$P0000002", "P0000001")

then after:

Case $Msg = $OK

you need to add

$Imp2=GUICtrlRead($Imp)

then change

RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\" & GUICtrlRead($Imp), "HostName", "REG_SZ", GUICtrlRead($Imp))

to

RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\" & $Imp2, "HostName", "REG_SZ", $Imp2)

and all the other HKEY rewrites

and that should work

Edited by kaotkbliss

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

right, ok

GUICtrlSetData($Imp, "$P0000001|$P0000002", "P0000001")

needs to be

GUICtrlSetData($Imp, $P0000001&"|"&$P0000002, $P0000001)

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

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...