Sign in to follow this  
Followers 0
Nahuel

Help clicking link

9 posts in this topic

#1 ·  Posted (edited)

I can't get this function to work. Example:

#include <IE.au3>
$oIE = _IECreate ("http://www.google.com")
_IELoadWait ($oIE)
Sleep(200)
Send("forums{enter}")
_IELoadWait ($oIE) 
$click=_IELinkClickByText($oIE,"index")
MsgBox(0,"",$click)

The messagebox always says "0", meaning it's not working. Why?

I have IE6 with Win98

Oh, and the example in the help file doesn't work either. I get an error saying that Autoit3a has performed an unallowed(?) action.

Edited by Nahuel

Share this post


Link to post
Share on other sites



Take a look at the examples for _IEFormSubmit -- they do what you are trying to accomplish I think. Please spend some time with the helpfile and the examples.

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

I can't get this function to work. Example:

#include <IE.au3>
$oIE = _IECreate ("http://www.google.com")
_IELoadWait ($oIE)
Sleep(200)
Send("forums{enter}")
_IELoadWait ($oIE) 
$click=_IELinkClickByText($oIE,"index")
MsgBox(0,"",$click)

The messagebox always says "0", meaning it's not working. Why?

I have IE6 with Win98

Oh, and the example in the help file doesn't work either. I get an error saying that Autoit3a has performed an unallowed(?) action.

dono about win98 on ie6

on xpsp2 ie7

#include <IE.au3>
$oIE = _IECreate ("http://www.google.com")
_IELoadWait ($oIE)
Sleep(200)
Send("forums{enter}")
_IELoadWait ($oIE) 
$click= _IELinkClickByText($oIE,"Gentoo Forums :: Index")
MsgBox(0,"",$click)

as far as i know with command _IELinkClickByText you need the whall name of link Gentoo Forums :: Index

or im maby wrong

your exsample isnt working on my machine, but with whall link name its ok


TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

Take a look at the examples for _IEFormSubmit -- they do what you are trying to accomplish I think. Please spend some time with the helpfile and the examples.

Dale

Thank you, I'll read the help. And no, I'm not trying to make a spambot :)

blog-Q, yes that works perfectly. Apparently, it needs to be the whole name. Is there a way for partial matches?

Share this post


Link to post
Share on other sites

Ah, I see what you wanted to do now. You were closer than I thought. Still, look at the examples for _IEFormSubmit for a better way. And bogQ is right, the link text must be an exact match. _IELinkGetCollection can help you with sub-string matches and other operations on links.

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

#6 ·  Posted (edited)

Thank you, I'll read the help. And no, I'm not trying to make a spambot :)

blog-Q, yes that works perfectly. Apparently, it needs to be the whole name. Is there a way for partial matches?

Only that you need to know what site and what data from what line you need and you can get the name/s

;google link name
#include <String.au3>
#include <array.au3>
#include <IE.au3>
#include <file.au3>
$oIE = _IECreate ("http://www.google.com")
_IELoadWait ($oIE)
Send("forums{enter}")
_IELoadWait ($oIE)
$oLinks = _IELinkGetCollection ($oIE)
;next create and export to file
_FileCreate("7.txt")
$sHTML = _IEBodyReadHTML ($oIE)
filewrite("7.txt",$sHTML)
Dim $search = "7.txt"
Dim $find = "wow";<== what you need to finde in name from shearch on google
;next finde in file line that have that name in it
Dim $aRecords
If Not _FileReadToArray($search,$aRecords) Then
EndIf
For $x = 1 to $aRecords[0]
If StringInStr($aRecords[$x], $find) Then
$linija = Number($x)
;next open file and take whall line
$file = FileOpen("7.txt", 0)
$line = FileReadLine($file, $linija)
If StringInStr($line, '<H2 class=r><A class=l onmousedown=') Then
    $text = StringReplace($line, "'", "")
    $text1 = StringReplace($text, ",", "")
    $text2 = StringReplace($text1, "<H2 class=r><A class=l onmousedown=", "")
    $text3 = StringReplace($text2, "href=", "")
    $text4 = StringReplace($text3, "return clk(this.hrefres1", "")
    $text5 = StringReplace($text4, "http://", "")
    $text6 = StringReplace($text5, "<B>", "")
    $text7 = StringReplace($text6, "</B>", "")
    $text8 = StringReplace($text7, "</A></H2>", "")
    $text9 = StringReplace($text8, "->", "")
    $file_d1 = StringSplit($text9, ">")
;next whall name of link you need from google riped from line $file_d1[2] of 7.txt file
    MsgBox(0, "Your next page is located on address", $file_d1[2]&" on the line "&$linija&" 7.txt file")
EndIf
EndIf
Next

but i rly hope that there is easyer way becose this whas confuzing 4 me xD

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I had something more like this in mind:

Select Link by Sub-string...

$sMyString = "wow"
$oLinks = _IELinkGetCollection($oIE)
For $oLink in $oLinks
    $sLinkText = _IEPropertyGet($oLink, "innerText")
    If StringInStr($sLinkText, $sMyString)) Then
        _IEAction($oLink, "click")
        ExitLoop
    EndIf
Next

Dale

Edit: typo in code

Edited by DaleHohm

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

I had something more like this in mind:

Select Link by Sub-string...

$sMyString = "wow"
$oLinks = _IELinkGetCollection($oIE)
For $oLink in $oLinks
    $sLinkText = _IEPropertyGet($oLink, "innerText")
    If StringInStr($sLinkText, $sMyString) Then
        _IEAction($oLink, "click")
        ExitLoop
    EndIf
Next

Dale

Edit: typo in code

ahh your right , this whas easyer way, i gues that i whas reading wrong (or not alot) topics on search 4 ie

ty Dale


TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

OOHH that might work! I mean... it will :)

Thank you both!

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