Sign in to follow this  
Followers 0
EmptySpace

(Solved)Need help for link click

3 posts in this topic

#1 ·  Posted (edited)

I cant figure out how to make correctly

for example in window is 5links

#include <IE.au3>
Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$oIE = _IECreate("http://link.url/")
While 1
_IELinkClickByText($oIE, "text 1") if not found then do
_IELinkClickByText($oIE, "text 2") if not found then
;And so on. Itried to use If then but it just wont work, also tried if @error then......
Wend
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Func TogglePause()
$Paused = Not $Paused
While $Paused
  Sleep(100)
  ToolTip('Sutabdytas', 0, 0)
WEnd
ToolTip("")
EndFunc   ;==>TogglePause
Func Terminate()
Exit 0
EndFunc   ;==>Terminate

If @error then... it works fine with one but I want to make it many if link not found then click other if that other not found then click other and so on...

Edited by Edgaras

Share this post


Link to post
Share on other sites



There may be a better approach to your overall problem but at the thought of just attempting a click on a series of links and carrying on only when the link is 'not found' (@ERROR = 7) you can put in a simple function '_IELinkClickByText($oIE, $s)' then 'Return @ERROR = 7' but with so many other things that could go wrong and cause the click to fail it might be helpful to just test for click success or not of _IELinkClickByText with its return of -1 on click success like:

While 1
    If _IELinkClickByText($oIE, "text 1") = -1 Then
        ;If this one succeeded then this will skip the rest in the sequence
    ElseIf _IELinkClickByText($oIE, "text 2") = -1 Then
        ;If this one succeeded then this will skip the rest in the sequence
    ElseIf _IELinkClickByText($oIE, "text 3") = -1 Then
        ;If this one succeeded then this will skip the rest in the sequence
    ElseIf _IELinkClickByText($oIE, "text 4") = -1 Then
        ;If this one succeeded then this will skip the rest in the sequence
    Else
        ;What to do if no clicks succeed
    EndIf
    ;And so on....
Wend

Share this post


Link to post
Share on other sites

This is what I needed. Thanks!

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