Jump to content
Sign in to follow this  
Guest Mike99

Printing

Recommended Posts

Guest Mike99

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

Share this post


Link to post
Share on other sites

CTRL+P ? :lmao:

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.

Share this post


Link to post
Share on other sites

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.

:lmao:

Share this post


Link to post
Share on other sites

Excellent post MHz :lmao:

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 o:)


"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.

Share this post


Link to post
Share on other sites
Guest Mike99

Excellent post MHz :lmao:

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 o:)

<{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 up

send ("{ENTER}") ;Hopefully this will print out the page in most (if not all?) cases.

Let me know if you think this will work..

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...