swin4ort Posted June 22, 2007 Posted June 22, 2007 I want to use AutoIt to automate the process where a user runs: - control panel - printers - right clicks on a specific printer - Set as Default Printer
DW1 Posted June 22, 2007 Posted June 22, 2007 hope this gets you started Run( "control.exe printers" ) AutoIt3 Online Help
PsaltyDS Posted June 22, 2007 Posted June 22, 2007 I want to use AutoIt to automate the process where a user runs:- control panel- printers- right clicks on a specific printer- Set as Default PrinterAlthough it looks harder, it is actually easier to use COM objects to do that. Here is a Microsoft answer in VBScript, which is easy to translate to AutoIt. Your task is a really simple example, and so a good one to learn this on.Take a shot at it and post you code (working or not) and you'll get plenty of help making it work. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Valuater Posted June 22, 2007 Posted June 22, 2007 another approach.. or two RunWait(@SystemDir & '\RunDLL32.EXE printui.dll,PrintUIEntry /HÛ ][ÝÖÔ[Ü^H[YWI][ÝÉÌÎNÊoÝ÷ Úâ*.æ¥,Ûh²0¡÷ÚºÚ"µÍØ[ ][ÝÜ[ZK ][ÝË ][ÝÛÛI][ÝË ][ÝÔ[RQ[UÉ][òÂò¢gV÷C¶væBgV÷C²ÂÂò¢gV÷C·G"gV÷C²ÂÂò¢gV÷C·w7GÅÕ½Ðì°Ìäì½ä½¸ÅÕ½ÐìÌäìµÀìÀÌØíÍAÉ¥¹ÑÉ9µµÀìÌäìÅÕ½Ðìù;, _ "int", @SW_SHOWNORMAL) Stolen from great people... 8)
PsaltyDS Posted June 22, 2007 Posted June 22, 2007 another approach.. or two8)Give 'em a scipt and they print for a day...Teach 'em to script and they code for life! Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Valuater Posted June 22, 2007 Posted June 22, 2007 Give 'em a scipt and they print for a day...Teach 'em to script and they code for life! ... as i see you write more code here lately than anyone else... 8)
PsaltyDS Posted June 22, 2007 Posted June 22, 2007 ... as i see you write more code here lately than anyone else... 8)But I'm trying to kick the habit, and here you are just being an ENABLER!I'm reporting you to my AA* accountability partner**! *AutoIt Anonymous **SmOke_N Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
swin4ort Posted June 22, 2007 Author Posted June 22, 2007 Both solutions are a lot shorter and more elegant than the 50 lines I came up with using Danwilli's suggested starting point. However, for both I get: Operation could not be completed. Either the printer name was typed incorrectly, or the specified printer has lost its connection to the server. For more information, click Help. I carefully cut and pasted the printer name; so I don't think that is the problem. I can still set and unset the printer using windows. any ideas?
PsaltyDS Posted June 22, 2007 Posted June 22, 2007 Both solutions are a lot shorter and more elegant than the 50 lines I came up with using Danwilli's suggested starting point. However, for both I get:Operation could not be completed. Either the printer name was typed incorrectly, or the specified printer has lost its connection to the server. For more information, click Help.I carefully cut and pasted the printer name; so I don't think that is the problem.I can still set and unset the printer using windows.any ideas?Weeellll... let's see some code, man! Don't know how to help till we see what you tried. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
swin4ort Posted June 22, 2007 Author Posted June 22, 2007 Weeellll... let's see some code, man! Don't know how to help till we see what you tried.
swin4ort Posted June 22, 2007 Author Posted June 22, 2007 Weeellll... let's see some code, man! Don't know how to help till we see what you tried. RunWait(@SystemDir & '\RunDLL32.EXE printui.dll,PrintUIEntry /y /n "E225310nD"');also ....$sPrinterName = "E225310nD"DllCall("printui.dll", "none", "PrintUIEntryW", _ "hwnd", 0, _ "ptr", 0, _ "wstr", '/y /n "' & $sPrinterName & '"', _ "int", @SW_SHOWNORMAL)
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