Sign in to follow this  
Followers 0
Steev

Print all tabs in IE ?

3 posts in this topic

Hi. I asked in other IE forums about printing all tabs. Someone suggested using AutoIT to do it. While this tool looks great to me, and I hope to use it someday, I need to print from all tabs now and I was wondering if anyone could really hold my hand on how I can do it please? Thanks

Share this post


Link to post
Share on other sites



Here's something that I came up with that might point you in the right direction. On the second to last line, there's something I don't know how to fix. It's the part with the question marks. Perhaps someone smarter than me can help out.

#include <ie.au3>
$input = InputBox("Question", "How many tabs are open in Internet Explorer?")
WinActivate("[Class:IEFrame]", "")
sleep(500)

$i = 1
Do
send("{CTRLDOWN}") ; In IE, you use CTRL + the tab number to switch between tabs. This will start at tab #1 and go to the amount the user entered
send($i)
send("{CTRLUP}")
$i = $i + 1
_IEAction(?????, "printdefault") ; OK, the question marks represent part of the code that I don't understand.
Until $i = $input + 1

#include <ByteMe.au3>

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

try like this:

#include <IE.au3>

Dim $i = 1      ;Index starts with 1 using the _IEAttach function

While 1
    $oIE = _IEAttach("", "Instance", $i)
    If @error Then ExitLoop                     ;If there's an error (can't get window) then exit the loop
    _IEAction($oIE, "printdefault")         ;Print
    $i += 1                                                 ;Increment index by 1
WEnd

The IE functions use the title of the IE window, the address of the page, or other things (check the function _IEAttach() in the help file), to create a reference to the IE object ($oIE). I believe with tabs, each tab is treated as a different "window" each with its own title, address, etc... You say you want to print ALL windows so the above uses an index, starting with 1, to reference each IE instance and print each page. If you want to print based on the windows address or title, you'd need to adjust the _IEAttach function accordingly.

Edited by MrMitchell

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