Reply to topic  [ 3 posts ] 
How to open a link with a macro? 
Author Message

Joined: 2012-12-19 05:02:52
Posts: 226
Is it possible to search for a word or string in a link and then, once found, open the link with a macro, i.e. without having to click on it with the mouse?


2016-03-22 06:23:39
Profile
User avatar

Joined: 2007-02-07 00:58:12
Posts: 876
Location: Japan
The basic approach will be something like this:
Code:
$term = 'Link'
$doc = Document.active
$found = $doc.text.find $term
if $found
   $link = $doc.text.linkAtIndex $found.location
   $link.activate $doc
else
   prompt 'Sorry. No links with term "' & $term & '" found'
end

Note however that Find will only search the display text for the term, not the link itself. If you wanted to search for words in the links, you'd probably have to write something more complicated.

_________________
philip


2016-03-22 18:29:48
Profile

Joined: 2012-12-19 05:02:52
Posts: 226
This is fine. Thank you, Philip.


2016-03-23 04:05:09
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software