Jump to content

Recommended Posts

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
Posted

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

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
×
×
  • Create New...