Sign in to follow this  
Followers 0

GUI for Local Printer Install

3 posts in this topic

Posted

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)

Share this post


Link to post
Share on other sites



Posted

What is it you want exactly? You seem to have a made a good start on you're code for the GUI, is the problem now making the actual batch file using AutoIt?

If so try looking at these functions in the helpfile:

FileWriteLine

FileCreate

Share this post


Link to post
Share on other sites

Posted

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

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

  • Recently Browsing   0 members

    No registered users viewing this page.