Jump to content
Sign in to follow this  
KeeFy

IE focus issue.

Recommended Posts

KeeFy

I've been working on this personal project of mine and have come to a brick wall that i've been unable to find the answer for.

Essentially i'm able to click on the link

<a class="bookingsButton" href="javascript:checkAutomaticBook('/members/bookings/open/event.book.form.action.xsp',
1500039744,
1500039764,
4
)">Book&nbsp;<br />
    08:32 AM</a>
</div>

This is part of the code that i'm having problem with.

$sMyString = "08:32"

$oLinks = _IELinkGetCollection($oIE)
For $oLink in $oLinks
    $sLinkText = _IEPropertyGet($oLink, "innerText")
    If StringInStr($sLinkText, $sMyString) Then
        _IEAction($oLink, "click")
        WinActivate("Windows Internet Explorer")
        sleep(1000)
        Send("{ENTER}")
        ExitLoop
    EndIf
Next


MsgBox(0,"Finished","Finished",1)

After the _IEAction($oLink, "click") the program comes to a halt state. After the clicking of the link a dialog popup box appears.

The autoit Window Info summary shows the following code from the popup window.

>>>> Window <<<<
Title:  Windows Internet Explorer
Class:  #32770
Position:   2747, 476
Size:   272, 185
Style:  0x94C801C5
ExStyle:    0x00010101
Handle: 0x01270BD8

>>>> Control <<<<
Class:  Button
Instance:   1
ClassnameNN:    Button1
Name:   
Advanced (Class):   [CLASS:Button; INSTANCE:1]
ID: 1
Text:   OK
Position:   56, 119
Size:   75, 23
ControlClick Coords:    45, 11
Style:  0x50030000
ExStyle:    0x00000004
Handle: 0x010D0C34

>>>> Mouse <<<<
Position:   2851, 635
Cursor ID:  0
Color:  0xEFEFEF

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
OK
Cancel
Do you want to automatically book? 



>>>> Hidden Text <<<<

I'm trying to just click the OK button, but the program halts and the IE window minimises. It frezzes until i personally give focus to the window and click the OK button and it'll complete and show the msgbox that it has completed.

I've tried multiple ways but always end up getting a minimized window and frozen program after _IEAction($oLink, "click").

Any ideas?

Thanks in advance!

Keith

Share this post


Link to post
Share on other sites
KeeFy

Winlist then use that to use winactivate

It's not an elegant method but i've used a different script in a different file in order to gain focus and click it.

$Clicked = 0
While $Clicked = 0
    If WinExists("Windows Internet Explorer","Do you want to automatically book?") Then
        WinActivate("Windows Internet Explorer","Do you want to automatically book?")
        Send("{ENTER}")
        $Clicked = 1
        MsgBox(0,"Booked","Success!",2)
    EndIf
    sleep(500)
WEnd

Slotting in a fucntion after the "_IEAction($oLink, "click") " code doesn't work no matter what. It goes into a pause state and i would love to have everything in one script. :/

I've tried all the few other methods that i was trying to use to click the ok button and it works as a different script running in the background.

So essentially i guess my question is how do i get the main script to stop pausing @ _IEAction($oLink, "click") ??

Any insights would be nice! Thanks people!

Share this post


Link to post
Share on other sites
DaleHohm

Please see the second example for _IEAction in the helpfile.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites
KeeFy

Please see the second example for _IEAction in the helpfile.

Dale

Thank you! I can't believe i missed it when i was reading the example for _IEAction. DOH!

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.