Guest Mike99 Posted February 24, 2005 Share Posted February 24, 2005 I'd like to know how I can print a webpage that I currently have open in my browser. Any easy way to do this? Thanks Link to comment Share on other sites More sharing options...
Insolence Posted February 24, 2005 Share Posted February 24, 2005 CTRL+P ? AutoIT should be able to automate printing easily, and it's much simpler then making a UDF(user defined function) for printing. Why don'tcha try that and give us the results. "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
MHz Posted February 24, 2005 Share Posted February 24, 2005 Welcome, Try this sample code on an IE window. Opt("WinTitleMatchMode", 2) WinActivate('Internet Explorer') Send('^p') WinTitleMatchMode, will allow for any substring, which you may need for a browser? The Send function works on active windows. So WinActivate will help to activate. Link to comment Share on other sites More sharing options...
Insolence Posted February 24, 2005 Share Posted February 24, 2005 Excellent post MHz You also might want to wait for the Internet Explorer window to open: ;tell AutoIT to look inside window titles (sub strings) instead of just the beginning Opt("WinTitleMatchMode", 2) ;Maximize the window WinActivate('Internet Explorer') ;wait 1 second for window to open Sleep(1000) ;Send ctrl + p Send('^p') From there you'll have to manipulate the print dialog, if you need any more help feel free to ask "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
Guest Mike99 Posted March 3, 2005 Share Posted March 3, 2005 Excellent post MHz You also might want to wait for the Internet Explorer window to open:;tell AutoIT to look inside window titles (sub strings) instead of just the beginning Opt("WinTitleMatchMode", 2) ;Maximize the window WinActivate('Internet Explorer') ;wait 1 second for window to open Sleep(1000) ;Send ctrl + p Send('^p')From there you'll have to manipulate the print dialog, if you need any more help feel free to ask <{POST_SNAPBACK}>Thanks for the help. The only issue here is that this test may be run on many machines, each with a different printer. I don't want to use a different script for each machine.Will most of them print if I just send an {ENTER} (or a couple {ENTER})after the send("^p")? i.e.send ("^p")sleep(4000) ;wait a few seconds for the print dialog box to come upsend ("{ENTER}") ;Hopefully this will print out the page in most (if not all?) cases.Let me know if you think this will work..Thanks 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