tharris Posted July 21, 2008 Share Posted July 21, 2008 Is there a way to see what is being run in compec? I am trying to write a script to add printers to the users machine and am getting an error but everything appears correct. I would like to make sure it is passing all the variables and attempting to run the correct command. CODE#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=..\My Pictures\Printer.ico #AutoIt3Wrapper_outfile=Add FXF Office Printer.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstants.au3> Dim $PrinterName = "" Dim $IPAddress = "" Dim $Model = "" Dim $PrinterDriver = "" Dim $IP = "" Dim $Name = "" Dim $PrintPortName = "" Dim $4250Driver = "\\slssupport.fxfeast.freight.fedex.com\Printers\HP Laserjet 4250-4350\hpc4x50c.inf" Dim $4350Driver = "\\slssupport.fxfeast.freight.fedex.com\drivers\Printers\HP Laserjet 4250-4350\hpc4x50c.inf" Dim $4345MFPDriver = "\\slssupport.fxfeast.freight.fedex.com\drivers\Printers\HP LaserJet 4345 MFP\hpc4345c.inf" Dim $P3005Driver = "\\slssupport.fxfeast.freight.fedex.com\drivers\Printers\HP LaserJet P3005\hpc300xc.inf" Dim $2420Driver = "\\slssupport.fxfeast.freight.fedex.com\drivers\Printers\HP LaserJet 2420\hpc24x0c.inf" Dim $1200Driver = "\\slssupport.fxfeast.freight.fedex.com\drivers\Printers\HP LaserJet 1200\hpbf312i.inf" Dim $1320Driver = "\\slssupport.fxfeast.freight.fedex.com\drivers\Printers\HP LaserJet 1320\hpc1320c.inf" Dim $3600Driver = "\\slssupport.fxfeast.freight.fedex.com\drivers\Printers\HP Color LaserJet 3600\hpc3600e.inf" Dim $4700Driver = "\\slssupport.fxfeast.freight.fedex.com\drivers\Printers\HP Color LaserJet 4700n\hplj4700.inf" Dim $LD135Driver = "\\slssupport.fxfeast.freight.fedex.com\drivers\Printers\Lanier LD135\OEMSETUP.INF" Dim $LD245Driver = "\\slssupport.fxfeast.freight.fedex.com\drivers\Printers\Lanier LD245\OEMSETUP.INF" Dim $LD325Driver = "\\slssupport.fxfeast.freight.fedex.com\drivers\Printers\Lanier LD325\OEMSETUP.INF" Dim $LD335Driver = "\\slssupport.fxfeast.freight.fedex.com\drivers\Printers\Lanier LD335\OEMSETUP.INF" Dim $LD335CDriver = "\\slssupport.fxfeast.freight.fedex.com\drivers\Printers\Lanier LD335C\OEMSETUP.INF" #Region ### START Koda GUI section ### Form=c:\software\kodaformdesign\forms\printer add.kxf $Form1_1 = GUICreate("Add Printer", 467, 447, 193, 125) $Label1 = GUICtrlCreateLabel("Office Printer", 88, 16, 278, 41) GUICtrlSetFont(-1, 24, 800, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("Fill in the name, IP, and select the model of the printer. Then choose add.", 16, 72, 428, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $PrinterName = GUICtrlCreateInput("PrinterName", 112, 152, 177, 21) $Label3 = GUICtrlCreateLabel("Printer Name", 144, 112, 126, 28) GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif") $Label4 = GUICtrlCreateLabel("IP Address", 152, 192, 105, 28) GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif") $IPAddress = GUICtrlCreateInput("IPAddress", 112, 232, 177, 21) $Label5 = GUICtrlCreateLabel("Printer Model", 136, 264, 129, 28) GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif") $Model = GUICtrlCreateCombo("Model", 112, 304, 185, 25) GUICtrlSetData(-1, "HP LaserJet 4250 PCL 6|HP LaserJet 4350 PCL 6|HP LaserJet 4345 MFP PCL 6|HP LaserJet P3005 PCL 6|HP LaserJet 2420 PCL 6|HP LaserJet 1200 Series PCL 5e|HP LaserJet 1320 PCL 6|HP Color LaserJet 3600|HP Color LaserJet 4700|LANIER LD135 PCL 6|Lanier LD245 PCL 6|LANIER MP 2510/LD325 PCL 6|LANIER MP 3500/LD335 PCL 6|Lanier LD335c PCL 6", "Model") $Add = GUICtrlCreateButton("Add", 120, 368, 177, 41, 0) GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFF0000) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE ExitLoop Case $nMsg = $Add ;; Read Values from GUI Switch GUICtrlRead($Model) Case "HP LaserJet 4250 PCL 6" $PrinterDriver = $4250Driver Case "HP LaserJet 4350 PCL6" $PrinterDriver = $4350Driver Case "HP LaserJet 4345 MFP PCL 6" $PrinterDriver = $4345MFPDriver Case "HP LaserJet P3005 PCL 6" $PrinterDriver = $P3005Driver Case "HP LaserJet 2420 PCL 6" $PrinterDriver = $2420Driver Case "HP LaserJet 1200 Series PCL 5e" $PrinterDriver = $1200Driver Case "HP LaserJet 1320 PCL 6" $PrinterDriver = $1320Driver Case "HP Color LaserJet 3600" $PrinterDriver = $3600Driver Case "HP Color LaserJet 4700" $PrinterDriver = $4700Driver Case "LANIER LD135 PCL 6" $PrinterDriver = $LD135Driver Case "Lanier LD245 PCL 6" $PrinterDriver = $LD245Driver Case "LANIER MP 2510/LD325 PCL 6" $PrinterDriver = $LD325Driver Case "LANIER MP 3500/LD335 PCL 6" $PrinterDriver = $LD335Driver Case "Lanier LD335c PCL 6" $PrinterDriver = $LD335CDriver EndSwitch $IP = GUICtrlRead($IPAddress) $Name = GUICtrlRead($PrinterName) $PrintPortName = "IP_" & $IP ;;Stop Print Spooler Service RunWait('cmd /c net stop "print spooler"') ;;Adding specified printer RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_" & $IP, "Protocol", "REG_DWORD", "00000001") RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_" & $IP, "Version", "REG_DWORD", "00000001") RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_" & $IP, "HostName", "REG_SZ", "") RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_" & $IP, "HWAddress", "REG_SZ", "") RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_" & $IP, "IPAddress", "REG_SZ", $IP) RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_" & $IP, "PortNumber", "REG_DWORD", "00009100") RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_" & $IP, "SNMP Community", "REG_SZ", "public") RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_" & $IP, "SNMP Enabled", "REG_DWORD", "00000001") RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_" & $IP, "SNMP Index", "REG_DWORD", "00000001") ;; Start the Print Spooler Service RunWait('cmd /c net start "print spooler"') ;; Install the printer RunWait(@ComSpec & ' /c rundll32 printui.dll,PrintUIEntry /if /b "' & $Name & '" /f "' & $PrinterDriver & '" /r "' & $PrintPortName & '" /m "' & $Model & '"', "",@SW_HIDE) MsgBox (48, "Printer Setup Complete", $Name & " " & " was successfully added to your machine") Exit EndSelect WEnd Link to comment Share on other sites More sharing options...
Developers Jos Posted July 21, 2008 Developers Share Posted July 21, 2008 You could replace the /C for a /K while debugging your script or capture all STDOUT and STDERR by specifying the proper parameters. See the helpfile for examples on how to do that. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
tharris Posted July 28, 2008 Author Share Posted July 28, 2008 I was able to resolve this by using the filewriteline command to dump the command + variables to a text file. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now