Sign in to follow this  
Followers 0
Aqeel

Autoit Script to install Local Printer

4 posts in this topic

Hi

Need help for converting this working VBS script to Autoit

VBS SCript to Install Local Printer(lpt1)

Set WshShell = Wscript.CreateObject("Wscript.Shell")

WshShell.Run "Regsvr32 /s z:\zenapps\printer\Prnadmin.dll",1,TRUE

dim oPrinter

set oMaster = createObject("PrintMaster.PrintMaster.1")

set oPrinter = CreateObject("Printer.Printer.1")

oPrinter.PrinterName = "HP LaserJet 5000 Series PCL" ' name of the printer as it appears in the Printers folder

oPrinter.DriverName = "HP LaserJet 5000 Series PCL6" ' name that is referenced in ntprint.inf

oPrinter.PortName = "lpt1:" ' Specify a port name. Can also point to LPT or COM port.

oMaster.PrinterAdd oPrinter

If Err <> 0 then

msgbox "There was an error creating the printer."

End if

Thanks ,Aqeel

Share this post


Link to post
Share on other sites



There may be a 1-line run call you can make if you use rundll and printui.dll,PrintUIEntry ... search the web for those terms...

Lar.

Can u post that line if u have one....

Share this post


Link to post
Share on other sites

This was the first result of a google search for "PrintUIEntry".

http://www.robvanderwoude.com/2kprintcontrol.html

It is all right there. Look at that, try it in the Run window. If it works, use the Run() function in autoit. If you need help after trying that, let us know.


"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

Thanks Lar and Candie for the help. Just for your info i have used the following way to get working

RunWait(@SystemDir & "\RUNDLL32 PRINTUI.DLL,PrintUIEntry /if /b " & '"HP LaserJet 5000 Series PCL6"' & " /f " & @WindowsDir & "\inf\ntprint.inf /r " & '"lpt1:"' & " /m " & '"HP LaserJet 5000 Series PCL6"' )

Aqeel

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