Jump to content

GUI for Local Printer Install


whitts
 Share

Recommended Posts

Hi i was wondering if anyone could either make or point me in the right direction...

Ive made a batch file that installs printers as local ports, the batch file creates a reg file which adds the ports then uses the print dll to install the printers (and a very simple yes VBS scripte to answer the unsigned driver warning box). At the moment it is long to add the printers to the batch file using notepad and want some kind of GUI which would simplifiy the process. I am useless at GUis and was wondering if someone could make a simple one, i was looking for something like this :-

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=C:\Users\Adam & Nath\Desktop\koda_1.7.0.1\Forms\Form1.kxf

$Form1 = GUICreate("Form1", 435, 150, 356, 124)

$IP = GUICtrlCreateInput("ScanStations IP", 8, 8, 233, 21)

$Name = GUICtrlCreateInput("Printer's Share Name", 8, 40, 233, 21)

$AddIt = GUICtrlCreateButton("Add Printer", 32, 72, 355, 25, 0)

$BatchIt = GUICtrlCreateButton("Create Batch File", 64, 112, 291, 25, 0)

$Old = GUICtrlCreateRadio("Brother 8500", 280, 8, 145, 17)

$New = GUICtrlCreateRadio("Brother 8220", 280, 32, 113, 17)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

The batch file i want to create depending on user input is : -

ECHO.^<package^>>"yes.wsf"

ECHO.>>"yes.wsf"

ECHO.^<job id="vbs"^>>>"yes.wsf"

ECHO.>>"yes.wsf"

ECHO. ^<script language="VBScript"^>>>"yes.wsf"

ECHO.set WshShell = WScript.CreateObject("WScript.Shell")>>"yes.wsf"

ECHO.WScript.Sleep 3000>>"yes.wsf"

ECHO.WshShell.SendKeys "Y">>"yes.wsf"

ECHO.^</script^>>>"yes.wsf"

ECHO.^</job^>>>"yes.wsf"

ECHO.^</package^>>>"yes.wsf"

ECHO.Windows Registry Editor Version 5.00>"printer.reg"

ECHO.>>"printer.reg"

ECHO.[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports]>>"printer.reg"

ECHO."\\\\192.168.136.88\\ICU"="">"printer.reg">>"printer.reg"

ECHO.[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports]>>"printer.reg"

ECHO."\\\\192.168.136.90\\ER"="">"printer.reg">>"printer.reg"

regedit /S printer.reg

net stop spooler

net start spooler

start wscript yes.wsf

rundll32 /s printui.dll, PrintUIEntry /if /q /b "ICU" /f "c:\8220\Adduni.inf" /r "\\192.168.136.88\ICU" /m "Brother MFC-8220" w

start wscript yes.wsf

rundll32 /s printui.dll, PrintUIEntry /if /q /b "ER" /f "c:\8220\Adduni.inf" /r "\\192.168.136.90\ER" /m "Brother MFC-8220" w

del yes.wsf

del printer.reg

I know there is a much simpler way to create the same effect using Autoit, but i have no other options but to use DOS commands.

Thanks (I am a complete nwb at Autot)

Link to comment
Share on other sites

Yeh thats right. I dont know where to start, do i get the software to write the printer details to memory and wait until all the printers have been added then write to the batch file or do i get the program to write to the batch file each time add printer is selected. Is there any sample code showing how to write from the gui buttons to a file?

Thanks

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