Jump to content

No pop-ups - Dale give me a hand here Bro. :)


Recommended Posts

#Region Variaveis Globais e Constantes
#include <IE.au3>
Global $oIE

;Configuração de URLs
Global Const $urlVoteCP = 'http://mysite/'

;Configuração do nome da imagem de voto
Global Const $voteLink1 = '1.jpg' 
Global Const $voteLink2 = '2.jpg' 
Global Const $voteLink3 = '3.jpg' 
Global Const $voteLink4 = '4.jpg' 
Global Const $voteLink5 = '5.gif'     
Global Const $voteLink6 = '6.jpg'       
#EndRegion Variaveis Globais e Constantes

$oIE = _IECreate()
$hWND = _IEPropertyGet($oIE, "hwnd")
WinSetState($hWND, "", @SW_MAXIMIZE)

_vote()

Func _vote()

    _IENavigate($oIE, $urlVoteCP, 1)
    _IEFormImageClick ($oIE, $voteLink1, 'src')
    _IEFormImageClick ($oIE, $voteLink2, 'src')
    _IEFormImageClick ($oIE, $voteLink3, 'src')
    _IEFormImageClick ($oIE, $voteLink4, 'src')
    _IEFormImageClick ($oIE, $voteLink5, 'src')
    _IEFormImageClick ($oIE, $voteLink6, 'src')
    _IENavigate($oIE, $urlVoteCP, 1)

EndFunc

There is the code, it clicks on the proper images, but the problem is, its opening as a pop-up and that is not what i want.

What i want is:

1. click on the proper images - ok

2. open the related pages as tabs without focus or hidden, and if possible using a known object, so i could overwrite them saving RAM, because that Func will be in a loop.

That is pretty much it, i just do not want a zillion pop-ups as i loop that Func.

Link to comment
Share on other sites

Hm Grunty I tried messing up with Tab configuration but no good.

Since you dropped that reply I realized that I have not been as specific as i should.

Said that, let`s see if I can correct myself this time.

When I send the command to click the image with _IEFormImageClick, it creates a new window of IE, I am guessing that its not considered a pop-up, but a new IE instance.

With that in mind I am still in need of what I posted starting this topic. Which is...

There is the code, it clicks on the proper images, but the problem is, its opening as a pop-up and that is not what i want.

What i want is:

1. click on the proper images - ok

2. open the related pages as tabs without focus or hidden, and if possible using a known object, so i could overwrite them saving RAM, because that Func will be in a loop.

That is pretty much it, i just do not want a zillion pop-ups as i loop that Func.

Edited by nitrometano
Link to comment
Share on other sites

Try to set the security to lowest possible , i slightly remember it was something like that.Of course it is not good to have it like that.

I do not see where doing this will help in anything, the pages I click using IEFormImageClick, opens normally, the only problem is that they open as a IE new window, and if i loop that Func N times, I will have (6 * N + 1) pages, that's nothing pretty to see.

Anyways lets put it the simplest it can get.

How can I perform an IEFormImageClick, and send that clicked image to open itself in an IE instance of my choice?

[[]]

Diogo

Link to comment
Share on other sites

Try this.

#Region Global Constants
#include <IE.au3>
Global $oIE

;Config/URL's
Global Const $urlVoteCP = 'http://mysite/'

;Config names of images
Global Const $voteLink1 = '1.jpg'
Global Const $voteLink2 = '2.jpg'
Global Const $voteLink3 = '3.jpg'
Global Const $voteLink4 = '4.jpg'
Global Const $voteLink5 = '5.gif'
Global Const $voteLink6 = '6.jpg'
#EndRegion Global Constants

_vote()

Func _vote()
    $oIE = _IECreate($urlVoteCP)
        WinSetState($oIE,'',@SW_MAXIMIZE)
            Sleep(100)
    _IEFormImageClick($oIE, $voteLink1, 'src')
        _IENavigate ($oIE,$urlVoteCP,1);Waits
    _IEFormImageClick($oIE, $voteLink2, 'src')
        _IENavigate ($oIE,$urlVoteCP,1)
    _IEFormImageClick($oIE, $voteLink3, 'src')
        _IENavigate ($oIE,$urlVoteCP,1)
    _IEFormImageClick($oIE, $voteLink4, 'src')
        _IENavigate ($oIE,$urlVoteCP,1)
    _IEFormImageClick($oIE, $voteLink5, 'src')
        _IENavigate ($oIE,$urlVoteCP,1)
    _IEFormImageClick($oIE, $voteLink6, 'src')
        _IENavigate ($oIE,$urlVoteCP,1)
EndFunc   ;==>_vote
[Cheeky]Comment[/Cheeky]
Link to comment
Share on other sites

And why dont you get the address the image points to and use IENavigate to open it in whatever IE window you want?

This is the technique I would recommend as well. You can modify the html so that it does what you want when you click it, of you can simply figure out what it is doing and do it your self. _IEPropertyGet($oImg, "outerhtml") my give you what you need.

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

Try this.

#Region Global Constants
#include <IE.au3>
Global $oIE

;Config/URL's
Global Const $urlVoteCP = 'http://mysite/'

;Config names of images
Global Const $voteLink1 = '1.jpg'
Global Const $voteLink2 = '2.jpg'
Global Const $voteLink3 = '3.jpg'
Global Const $voteLink4 = '4.jpg'
Global Const $voteLink5 = '5.gif'
Global Const $voteLink6 = '6.jpg'
#EndRegion Global Constants

_vote()

Func _vote()
    $oIE = _IECreate($urlVoteCP)
        WinSetState($oIE,'',@SW_MAXIMIZE)
            Sleep(100)
    _IEFormImageClick($oIE, $voteLink1, 'src')
        _IENavigate ($oIE,$urlVoteCP,1);Waits
    _IEFormImageClick($oIE, $voteLink2, 'src')
        _IENavigate ($oIE,$urlVoteCP,1)
    _IEFormImageClick($oIE, $voteLink3, 'src')
        _IENavigate ($oIE,$urlVoteCP,1)
    _IEFormImageClick($oIE, $voteLink4, 'src')
        _IENavigate ($oIE,$urlVoteCP,1)
    _IEFormImageClick($oIE, $voteLink5, 'src')
        _IENavigate ($oIE,$urlVoteCP,1)
    _IEFormImageClick($oIE, $voteLink6, 'src')
        _IENavigate ($oIE,$urlVoteCP,1)
EndFunc   ;==>_vote

Lord it works but I have made some mod on your code if you do not mind.. Here it is:

#Region Global Constants
#include <IE.au3>
Global $oIE

;Config/URL's
Global Const $urlVoteCP = 'http://mysite/'

;Config names of images
Global Const $voteLink1 = '1.jpg'
Global Const $voteLink2 = '2.jpg'
Global Const $voteLink3 = '3.jpg'
Global Const $voteLink4 = '4.jpg'
Global Const $voteLink5 = '5.gif'
Global Const $voteLink6 = '6.jpg'
#EndRegion Global Constants


While 1

$oIE = _IECreate()
$hWND = _IEPropertyGet($oIE, "hwnd")
WinSetState($hWND, "", @SW_MAXIMIZE)

_vote()

_IEQuit ($oIE)

WEnd


Func _vote()

    ;Vai à página de voto e clica nas imagens usando 'src' / Go to voting webpage and clicks the images using 'src' (default)
    _IENavigate ($oIE,$urlVoteCP,1)
    _IEFormImageClick ($oIE, $voteLink1)
    _IEFormImageClick ($oIE, $voteLink2)
    _IEFormImageClick ($oIE, $voteLink3)
    _IEFormImageClick ($oIE, $voteLink4)
    _IEFormImageClick ($oIE, $voteLink5)
    _IEFormImageClick ($oIE, $voteLink6)
    Sleep (2000)
        _IENavigate ($oIE,$urlVoteCP,1)

EndFunc

I removed some lines and the parameter 'SRC', no need for that, it is default anyways. It is opening the image clicks as new tabs which is great, but now I am trying to understand, each tab is a new Object? or it is the same ($oIE) object?

I say that because, when i get to that _IEQuit ($oIE) it closes only the main tab, the other tabs created by clicking the images do not close.

So I wonder,

How can i get the '2nd run' to open attached to the other tabs opened before upon clicking. Or

How can i manage to kill the tabs opened with the _IEFormImageClick, retaining the main one?

And why dont you get the address the image points to and use IENavigate to open it in whatever IE window you want?

This is the technique I would recommend as well. You can modify the html so that it does what you want when you click it, of you can simply figure out what it is doing and do it your self. _IEPropertyGet($oImg, "outerhtml") my give you what you need.

Dale

Juvigy, Dale,

Dale first off, man what a nice UDF, I have to say thank you and congratulate you on this fine job, keep up bro.

So, I tried to navigate directly to the other website, which would be the simplest, yet effective, but seems that the page itself has a script to identify if you simply click on the image or go to the address directly, and it only count voting if it detects that you clicked the image. Anyways that is what I could think of.

I will attach the website source, so you guys can see better, Hope I do not get in trouble for this >_<

Regards to all,

You guys rock!

Diogo Fernandes.

Edited by nitrometano
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...