Jump to content

IE Functions


Recommended Posts

Hello :P

I got a problem and I am unable to provide source code considering it deals with private sensitive information. My script opens Internet Explorer hidden using the _IECreate() function and then it uses the following other functions.

_IENavigate()
_IEImgClick()
_IEBodyReadHTML()
__StringBetween()
_IEGetObjByName()
_IEFormElementSetValue()
_IEAction()
_IEQuit()

It's function works perfectly and it also auto-updates the GUI but the problem is that my mouse and keyboard should be "Free" and they are up until a certain part in the script and then it seems to take over.

For example I opened up paint and start drawing and it release my mouse and I hear a clicking noise each time so I think it has something to do with _IENavigate() but how would that be effecting me :x

Link to comment
Share on other sites

Thats odd, I made a script today using most of those functions, and had no problems with it running in the background. But then again I wasnt drawing.

I'll test my script while using paint now.

EDIT:

That didnt take long.

My script checks through about 50 pages gathering a bit of data, I let it run through about 20 of them while drawing a constant line without any effect on the mouse.

Furthermore I hear no clicks during IENavigate, so it could be to do with the clicking sound, although its unlikely.

Win 7 32 bit

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

You'll probably need to create a reproducer with simple, generic code.

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

Link to comment
Share on other sites

Thats odd, I made a script today using most of those functions, and had no problems with it running in the background. But then again I wasnt drawing.

I'll test my script while using paint now.

EDIT:

That didnt take long.

My script checks through about 50 pages gathering a bit of data, I let it run through about 20 of them while drawing a constant line without any effect on the mouse.

Furthermore I hear no clicks during IENavigate, so it could be to do with the clicking sound, although its unlikely.

Win 7 32 bit

Win7 32 bit here too...I am pretty sure that it has to do with the IENavigate more then anything else. The IENavigate is in a Do...Until loop and is constantly being called to update data for different stuff. I can't think of what would be causing this problem though.

I am going to try and debug it and provide some code maybe if I can.

Edited by SkellySoul
Link to comment
Share on other sites

#include <IE.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Link = "Link_1.com"
$Do_Action_1 = "Link_2.com"
$Do_Action_2 = "Link_3.com"

;GUI START
$Find = 0
;/GUI END

$oIE = _IECreate($Link , Default , 1)

Do
    If _IEImgClick($oIE , "icon_action.gif") Then
        _IENavigate($oIE , $Do_Action_1)
        _IENavigate($oIE , $Do_Action_2)
    Else
    $Click = Random(1 , 8 , 1)
    If $Click = 1 Then
        _IEImgClick($oIE , "1_on.gif")
    ElseIf $Click = 2 Then
        _IEImgClick($oIE , "2_on.gif")
    ElseIf $Click = 3 Then
        _IEImgClick($oIE , "3_on.gif")
    ElseIf $Click = 4 Then
        _IEImgClick($oIE , "4_on.gif")
    ElseIf $Click = 5 Then
        _IEImgClick($oIE , "5_on.gif")
    ElseIf $Click = 6 Then
        _IEImgClick($oIE , "6_on.gif")
    ElseIf $Click = 7 Then
        _IEImgClick($oIE , "7_on.gif")
    ElseIf $Click = 8 Then
        _IEImgClick($oIE , "8_on.gif")
    Else
        Exit
    EndIf
EndIf
Until $Find < 100 ;Find uses GuiCtrlRead to Find the Value...but not in this demo

yep found the problem but no idea how or why it's causing the problem...This example has been stripped a lot but causes same problem.

Link to comment
Share on other sites

So its actually more likely to be _IEImgClick() if anything in IE.

Sorry, what was the problem?

I think your right about that...the problem is if I keep drawing a line in paint and not let go it will make the line I drew disappear and if I go to open a folder and drag the folder it will move my folder in another direction.

How is that possible :x

Link to comment
Share on other sites

I just tried this simple code, except still had no problem.

#include <IE.au3>
HotKeySet("{ESC}", "_Exit")

$oIE = _IECreate("http://www.google.co.uk/images?hl=en&source=imghp&biw=1024&bih=573&q=sloth&gbv=2&aq=f&aqi=g10&aql=&oq=&gs_rfai=", Default, 1)
$i = 0
Do
    _IEImgClick($oIE, "nav_logo27.png")
    _IELoadWait($oIE)
    _IENavigate($oIE, "http://www.google.co.uk/images?hl=en&source=imghp&biw=1024&bih=573&q=sloth&gbv=2&aq=f&aqi=g10&aql=&oq=&gs_rfai=")
    $i += 1
Until $i = 100

Func _Exit()
    Exit
EndFunc   ;==>_Exit

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

I just tried this simple code, except still had no problem.

#include <IE.au3>
HotKeySet("{ESC}", "_Exit")

$oIE = _IECreate("http://www.google.co.uk/images?hl=en&source=imghp&biw=1024&bih=573&q=sloth&gbv=2&aq=f&aqi=g10&aql=&oq=&gs_rfai=", Default, 1)
$i = 0
Do
    _IEImgClick($oIE, "nav_logo27.png")
    _IELoadWait($oIE)
    _IENavigate($oIE, "http://www.google.co.uk/images?hl=en&source=imghp&biw=1024&bih=573&q=sloth&gbv=2&aq=f&aqi=g10&aql=&oq=&gs_rfai=")
    $i += 1
Until $i = 100

Func _Exit()
    Exit
EndFunc   ;==>_Exit

I ran your's and it worked perfect...I don't get whats in mine causing the problems though it's as if IE is taking focus :P

[Edited]

This also works perfectly but for some reason makes a *Clicking* noise. The focus problem though isn't seen here it is however the way I got it in my orignal example :nuke:

#include <IE.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Link = "http://www.google.co.uk/images?hl=en&source=imghp&biw=1024&bih=573&q=sloth&gbv=2&aq=f&aqi=g10&aql=&oq=&gs_rfai="
;GUI START
$Find = 0
;/GUI END

$oIE = _IECreate($Link , Default , 1)

Do
    $Move = Random(1 , 8 , 1)
    _IENavigate($oIE , $Link)
    If $Move = 1 Then
        _IEImgClick($oIE , "nav_logo27.png")
    ElseIf $Move = 2 Then
        _IEImgClick($oIE , "nav_logo27.png")
    ElseIf $Move = 3 Then
        _IEImgClick($oIE , "nav_logo27.png")
    ElseIf $Move = 4 Then
        _IEImgClick($oIE , "nav_logo27.png")
    ElseIf $Move = 5 Then
        _IEImgClick($oIE , "nav_logo27.png")
    ElseIf $Move = 6 Then
        _IEImgClick($oIE , "nav_logo27.png")
    ElseIf $Move = 7 Then
        _IEImgClick($oIE , "nav_logo27.png")
    ElseIf $Move = 8 Then
        _IEImgClick($oIE , "nav_logo27.png")
    Else
        Exit
    EndIf
Until $Find < -100 ;100

[Re-Edit]

hmm could the Focus problem be if the Image I want to click doesn't exist :x

[Final Edit]

Still haven't figured it out but I did solve the sound problem I went to control panel and went under explorer and disabled "Start Navigation"... :shifty:

Edited by SkellySoul
Link to comment
Share on other sites

Its a little difficult because you have no given a working reproducer, the first script you posted simply has nowhere to go.

So the chances of anyone finding a problem are slim.

Your best bet is to find some website where you can do something similar to your real code, and try to reproduce your issue, so that others can try it.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Its a little difficult because you have no given a working reproducer, the first script you posted simply has nowhere to go.

So the chances of anyone finding a problem are slim.

Your best bet is to find some website where you can do something similar to your real code, and try to reproduce your issue, so that others can try it.

I haven't give a exact reproducer but the one I have that works perfectly the only thing different is the images being clicked, now the thing is sometimes certain images are disabled so if it gets picked and it's invalid would that throw the focus off. The only conclusion I can think of is to add error checking for the ImageClick but I didn't think it was necessary is it :x

I test it when I get the chance to and then update this post any further help is appreciated :P

Link to comment
Share on other sites

Well I cant get anywhere past this

#include <IE.au3>

$oIE = _IECreate("Link_1.com")

on account of there being no such website, so i certainly cannot reproduce your problem.

Sorry , I meant this code works perfectly...what is the difference between them.

#include <IE.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Link = "http://www.google.co.uk/images?hl=en&source=imghp&biw=1024&bih=573&q=sloth&gbv=2&aq=f&aqi=g10&aql=&oq=&gs_rfai="
;GUI START
$Find = 0
;/GUI END

$oIE = _IECreate($Link , Default , 1)

Do
    $Move = Random(1 , 8 , 1)
    _IENavigate($oIE , $Link)
    If $Move = 1 Then
        _IEImgClick($oIE , "nav_logo27.png")
    ElseIf $Move = 2 Then
        _IEImgClick($oIE , "nav_logo27.png")
    ElseIf $Move = 3 Then
        _IEImgClick($oIE , "nav_logo27.png")
    ElseIf $Move = 4 Then
        _IEImgClick($oIE , "nav_logo27.png")
    ElseIf $Move = 5 Then
        _IEImgClick($oIE , "nav_logo27.png")
    ElseIf $Move = 6 Then
        _IEImgClick($oIE , "nav_logo27.png")
    ElseIf $Move = 7 Then
        _IEImgClick($oIE , "nav_logo27.png")
    ElseIf $Move = 8 Then
        _IEImgClick($oIE , "nav_logo27.png")
    Else
        Exit
    EndIf
Until $Find < -100 ;100

I really do appreciate your help, I don't know of any website setup up like this one and it is a locked private site.

Edited by SkellySoul
Link to comment
Share on other sites

Oh I see, but like I say, unless you can create some code that reproduces your problem And that others can try, you're flogging a dead horse pal.

It could be something to do with the wesite you are using, it could be something in the rest of your code even.

So unless someone sees this thread who has had this and knows a solution....

I wish I could help you further, and I will if you can come up with a reproducer.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

There is nothing inherent in IE.au3 or IE in general that will result in the stealing focus as you describe. Based on another communication, I will point you to Javascript executed as a result of clicking the images/activating the links. Since this is for automating a game, I really have no desire to spend my time digging into this.

Good luck and you'll need to do this on your own. Game automation is a topic not entertained in this forum.

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

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