Jump to content

CTRL + T Not working in the script


mjoshi
 Share

Recommended Posts

Hi This is a small program which I have created :

#include <IE.au3>
$oIE = _IECreate ("www.autoitscript.com")
Sleep(8000)
Send ("{CTRLDOWN}")
Sleep(1000)
Send("t")
Send("{CTRLUP}")
_IECreate ("www.google.com")

But instead of opening up google in the same IE in different tab, the script is opening separate IE.

My requirement is to open up sites in same IE in different tabs, instead of multiple IE, as managing different IE becomes messy.

Link to comment
Share on other sites

Try to use _IEAttach()

Thanks, yes It worked!!! :)

But I am not sure whether I am using _IEAttach function correctly. I tried reading AutoIt help also, but couldn't figure out a way of using it.

So my code looks like this(which is working for now)

#include <IE.au3>
$oIE = _IECreate ("www.autoitscript.com")
Sleep(5000)
;Send("^{TAB}")
Send ("{CTRLDOWN}")
Sleep(1000)
Send("t")
Send("{CTRLUP}")
_IEAttach ("")
Send("www.gmail.com")
Send("{ENTER}")

Now I have two questions:

1) Can I pass the value of URL(www.gmail.com in this case) from the _IEAttach function only?

2) When I made this script like this:

#include <IE.au3>
$oIE = _IECreate ("www.autoitscript.com")
Sleep(5000)
;Send("^{TAB}")
Send ("{CTRLDOWN}")
Sleep(1000)
Send("t")
Send("{CTRLUP}")
_IEAttach ("")
Send("www.gmail.com")
Send("{ENTER}")
Sleep(3000)
Local $oUser, $oPass, $oSubmit, $oInput
If WinExists("Gmail: Email from Google") Then
  WinSetState("Gmail: Email from Google", "", @SW_MAXIMIZE)
  ;get the htm source
  Local $oInputs = _IETagNameGetCollection($oIE, "input")
  ;loop through elements and get the names of the text fields for user and pass
  For $oInput In $oInputs
   If $oInput.type = "text" And $oInput.name = "Email" Then $oInput.value = "xxxxxxxxxxxxx"
   
   If $oInput.type = "password" And $oInput.name = "Passwd" Then $oInput.value = "xxxxxxxxxxxx"
    Sleep(1200)
   If $oInput.type = "checkbox" And $oInput.name = "PersistentCookie" Then Send("{SPACE}")
     Sleep(1200)
   
   If $oInput.type = "submit" And $oInput.name = "signIn" Then _IEAction($oInput, "click")
   
   Next
  EndIf
  Send("{ENTER}")

It was not working, the reason could be because of the line in the code :

Local $oInputs = _IETagNameGetCollection($oIE, "input")

Because the above line I guess, will pick the data from the first tab of IE, i.e. www.autoscript.com and not from www.gmail.com

Can anyone suggest a solution?

Thanks.

Link to comment
Share on other sites

Ctrl+T can be optimized this way (not tested)

#include <IE.au3>
$oIE = _IECreate ("www.autoitscript.com")
Send("^t")
$oIE = _IEAttach ("")
_IENavigate($oIE, "www.gmail.com")

Thanks! But still it is not working :) It is not opening gmail.com in the tabbed window.
Link to comment
Share on other sites

#include <IE.au3>
$oIE = _IECreate ("www.autoitscript.com")
Send("^t")
Sleep(5000) ; elaborate with this value
$oIE = _IEAttach ("")
_IENavigate($oIE, "www.gmail.com")

I literally copied the above code and tried to run the script, but it didn't succeed :)

Are we missing something? I mean there has to be a way in AutoIt by which we can open multiple tabs in IE and do some processing in each tab!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...