StrokesPlus Forum
                       
StrokesPlus Forum
Home | Profile | Register | Active Topics
Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Lua Scripts
 General Action Scripts
 How to extract URL from hyperlink under cursor?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Alex22

Ukraine
19 Posts

Posted - 05/02/2016 :  11:22:46  Show Profile  Reply with Quote
I want to create an action for opening hyperlinks in alternative browser. I now how to send URL from clipboard to any browser, but I have no idea how to extract URL from clickable hyperlink.

Rob

USA
2573 Posts

Posted - 05/05/2016 :  01:15:47  Show Profile  Visit Rob's Homepage  Reply with Quote
That's going to be a bit tricky. Your best bet is going to be to perform the steps to right-click and select the copy link menu option, then get the url from the clipboard and run the alternate program. The steps to do this would vary by browser, but it is possible.

The starting basis of the script is detailed here http://www.strokesplus.com/forum/topic/449/new-tab-link-in-new-tab?SearchTerms=acconsumephysicalinput. But you'd also need to use acSendKeys to send the correct letter to select the desired menu option (e.g. Copy Link Location), then acGetClipboardText(), then acRunProgram to open the other browser, or a combination of code to see if the other browser is already running, etc.
Go to Top of Page

Alex22

Ukraine
19 Posts

Posted - 05/06/2016 :  04:50:55  Show Profile  Reply with Quote
This method is applicable for browser, mail client, instant messager, maybe some other application. But I looking for some trick to copy URL from application, where there are no corresponding menu for hyperlink (text/RTF editor, PIM, movie organizer). Is it impossible?

Edited by - Alex22 on 05/06/2016 04:52:45
Go to Top of Page

Rob

USA
2573 Posts

Posted - 05/07/2016 :  19:09:08  Show Profile  Visit Rob's Homepage  Reply with Quote
Are you able to highlight the text, then send CTRL+C [acSendKeys("^c")]? Once you have it copied, you can call acGetClipboardText() to get the URL then it's just a matter of running the appropriate program and pass in the URL.
Go to Top of Page

Alex22

Ukraine
19 Posts

Posted - 05/22/2016 :  11:36:04  Show Profile  Reply with Quote
Highlighting the text of link required accuracy, it's burdensome. And I realize the idea some time ago via AHK-skript (menu-on-selection) but look for something more convenient.

Go to Top of Page

Rob

USA
2573 Posts

Posted - 05/23/2016 :  10:18:48  Show Profile  Visit Rob's Homepage  Reply with Quote
Honestly, that's going to be rather difficult. Short of getting the text of the control (which is going to vary between applications), then parsing out the text to find if a URL is present (probably won't work at all if there is more than on, if you had an RTF text area)...I can't really think of a single, reliable method to accomplish that.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
StrokesPlus Forum © 2011-2018 Rob Yapchanyk Go To Top Of Page
Snitz Forums 2000