Jump to content

Help with Link Click


Recommended Posts

Anyone? i need to know how to open the $oLink in another tab.. thanks

Please wait at least 24 hours before you bump a thread.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Try this, which is adapted from code found elsewhere on the forum:

Const $navOpenInNewTab = 0x0800
Const $navOpenInBackgroundTab = 0x1000

Local $oLinks = _IELinkGetCollection($oIE)
For $oLink In $oLinks
$href = $oLink.href

If StringInStr($href, "example1") Then
$oIE.navigate ( $href, $navOpenInNewTab )
EndIf
Next
Link to comment
Share on other sites

Try this, which is adapted from code found elsewhere on the forum:

Const $navOpenInNewTab = 0x0800
Const $navOpenInBackgroundTab = 0x1000

Local $oLinks = _IELinkGetCollection($oIE)
For $oLink In $oLinks
$href = $oLink.href

If StringInStr($href, "example1") Then
$oIE.navigate ( $href, $navOpenInNewTab )
EndIf
Next

Thanks man, it actually works.. the problem is its when it opens the links then it keep opening links that are on the other tabs.. and that is like an endless loop.. and i want to open links from the first page only.. thanks man hope u understand me!
Link to comment
Share on other sites

doubt it...you must have a ton of links matching:

use this to validate...if the coutner output is greater than the ubound, post back

ConsoleWrite("total links = " & $oLinks.length & @CRLF)
$iCounter = 1
For $oLink In $oLinks
 $href = $oLink.href
 If StringInStr($href, "example1") Then
  ConsoleWrite($iCounter & @CRLF)
  $oIE.navigate ( $href, $navOpenInNewTab )
 EndIf
 $iCounter +=1
Next
Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

doubt it...you must have a ton of links matching:

use this to validate...if the coutner output is greater than the ubound, post back

ConsoleWrite("total links = " & $oLinks.length & @CRLF)
$iCounter = 1
For $oLink In $oLinks
$href = $oLink.href
If StringInStr($href, "example1") Then
ConsoleWrite($iCounter & @CRLF)
$oIE.navigate ( $href, $navOpenInNewTab )
EndIf
$iCounter +=1
Next

Thanks for the reply, but i end up with this error:

Variable used without being declared.:
ConsoleWrite("total links = " & $oLinks.length & @CRLF)
ConsoleWrite("total links = " & ^ ERROR

Again thanks for the support.

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