Welcome Guest.   Make a donation to an author on the site October 24, 2014, 09:47:18 PM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
View the new Member Awards and Badges page.
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1] 2 Next   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: DONE: Copy selection on webpage as text with text hyperlink URL's and ASCIIart  (Read 10464 times)
Nater
Participant
*
Posts: 13


View Profile Give some DonationCredits to this forum member
« on: March 23, 2011, 04:28:50 PM »

Often I like to copy text from a webpage into a text editor.  When I copy hyperlinked text in a browser, I loose the URL when copying to text, and must go back and manually copy the link, then place it next to my text in my text editor. 

I would like a utility that will do this for me automatically when I copy and paste from a web browser to a text editor. 

As I was thinking about requesting this, a secondary thought came to me, which is silly but I suppose it could be entertaining, would be to additionally convert the images contained in the selection of text on the web page to ASCII art text when pasting to the text editor.  The ASCII art dimensions should not be too large as to overwhelm the text in the editor, and the ASCII art images should be placed in the text relative to where the images were positioned on the web page.  The ASCII art should be an optional feature.

 
Logged
rjbull
Charter Member
***
Posts: 2,778

View Profile Give some DonationCredits to this forum member
« Reply #1 on: March 24, 2011, 04:12:25 PM »

If you use Firefox, some of the addons can meet your first requirement.
Logged
Nater
Participant
*
Posts: 13


View Profile Give some DonationCredits to this forum member
« Reply #2 on: March 24, 2011, 05:49:35 PM »

If you use Firefox, some of the addons can meet your first requirement.

I do use Firefox.  I tried the addon MultiLinks and looked at several others.  I couldn't get MultiLinks to do what I wanted, and based on the other addon descriptions, they couldn't copy an entire block of text (hyperlinked or not) and grab the text of the non-hyperlinked text along with the titles of hyperlinks with the associated link all in one command.  Which Firefox addon(s) where you thinking of?
Logged
hornet
Charter Member
***
Posts: 19


View Profile Give some DonationCredits to this forum member
« Reply #3 on: March 25, 2011, 05:34:40 PM »

Have you looked at Surfulator?
Logged
cyberdiva
Supporting Member
**
Posts: 908


see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #4 on: March 25, 2011, 08:21:13 PM »

I couldn't get MultiLinks to do what I wanted, and based on the other addon descriptions, they couldn't copy an entire block of text (hyperlinked or not) and grab the text of the non-hyperlinked text along with the titles of hyperlinks with the associated link all in one command.
Surfulater can "copy an entire block of text (hyperlinked or not) and grab the text of the non-hyperlinked text along with the titles of hyperlinks with the associated link all in one command."  But Surfulater is not a text editor.  I'm not sure why you want to copy all this to a text editor.  If there's no compelling reason to use a text editor, then I would enthusiastically second hornet's recommendation that you take a look at Surfulater.  It works very well with Firefox.
« Last Edit: March 25, 2011, 08:22:50 PM by cyberdiva » Logged
Nater
Participant
*
Posts: 13


View Profile Give some DonationCredits to this forum member
« Reply #5 on: March 26, 2011, 09:27:41 AM »

Have you looked at Surfulator?

I appreciate your suggestion.  Looking at Surfulator will be about all I will be able to do since it costs $79.  It may be an awesome piece of software, but $79?  

I guess my idea was worth far more than I had anticipated.  If I were a developer, I'd be all over this.  Develop a better alternative to Surfulator and sell it for $59!    
Logged
cmpm
Charter Member
***
Posts: 2,025

View Profile Give some DonationCredits to this forum member
« Reply #6 on: March 26, 2011, 11:25:02 AM »

See if CoLT will work for you.

https://addons.mozilla.or...en-US/firefox/addon/colt/
Logged
Nater
Participant
*
Posts: 13


View Profile Give some DonationCredits to this forum member
« Reply #7 on: March 26, 2011, 11:30:07 PM »


CoLT is close, but it only works on actual links, not mixed content.  I would like to select a block of text on a webpage that is mostly non-links, with a few links.  Like I said earlier, I can do this manually by copying and pasting selections, then going back and harvesting the URL's and inserting them into text.  Maybe nobody else uses text editors for research or note taking, but I like the simplicity of text files. 

Thanks for the suggestion.
Logged
skwire
Global Moderator
*****
Posts: 4,116



Another Coding Snack request? Om nom nom...

see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #8 on: March 27, 2011, 12:16:47 AM »

What do you use as your default browser (and version)?
Logged

Nater
Participant
*
Posts: 13


View Profile Give some DonationCredits to this forum member
« Reply #9 on: March 27, 2011, 12:47:47 AM »

What do you use as your default browser (and version)?
Right now I'm typing on Google Chrome, but my default browser is Firefox, and I just upgraded to 4.0 today, but can go back to 3.6.x if needed if there is a particular add-on I want/need that hasn't made it to 4.0 yet. 
Logged
skwire
Global Moderator
*****
Posts: 4,116



Another Coding Snack request? Om nom nom...

see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #10 on: March 27, 2011, 01:42:33 AM »

Are you familiar with AutoHotkey?  If so, here's a way to do it with AutoHotkey that seems to work pretty well.  It uses F2 as a hotkey which will only be active if a Firefox or Chrome window is active.  You can change the hotkey to whatever you like.  Also, you may have to play around with the sleep values a bit if it doesn't work right for you immediately.

Formatted for Autohotkey with the GeSHI Syntax Highlighter [copy or print]
  1. ; Allow partial titlebar text matches.
  2.  
  3. ; Create a window title group to match on for our hotkey.
  4. GroupAdd, myBrowsers, Mozilla Firefox
  5. GroupAdd, myBrowsers, Google Chrome
  6.  
  7.  
  8. #IfWinActive, ahk_group myBrowsers
  9. {
  10.    F2::
  11.    {
  12.        ; Copy user selection to a variable.
  13.        SendInput, ^c
  14.        myText := Clipboard
  15.        Sleep, 100
  16.  
  17.        ; Switch to address bar in browser and copy URL to another variable.
  18.        SendInput, ^l
  19.        Sleep, 100
  20.        SendInput, ^c
  21.        Sleep, 100
  22.        myURL := Clipboard
  23.        Sleep, 100
  24.  
  25.        ; Format data bits.    
  26.        myData := myURL . "`r`n`r`n" . myText
  27.        Sleep, 100
  28.  
  29.        ; Put formatted data back onto clipboard.
  30.        Clipboard := myData
  31.    }
  32.    Return
  33. }

Logged

Ath
Supporting Member
**
Posts: 2,234



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #11 on: March 27, 2011, 05:08:33 AM »

I had to add another Sleep between the ^c and Clipboard get:
[copy or print]
       ; Copy user selection to a variable.
       SendInput, ^c
       Sleep, 100
       myText := Clipboard
Or it would get the previous content of the clipboard, instead of the selected text in the browser, just like you already have for copying the url, but now it's working just fine thumbs up

Might be caused by my rather snappy PC (i7-860, W7 x64, 8 GB), but the extra 100 msec confidence doesn't hurt anything smiley
Logged

skwire
Global Moderator
*****
Posts: 4,116



Another Coding Snack request? Om nom nom...

see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #12 on: March 27, 2011, 08:37:23 AM »

I had to add another Sleep between the ^c and Clipboard get:

Yep, and that's exactly why I mentioned it.  The clipboard is a fickle beast and working with it can be a right pain in the arse.  I'm glad you got it working.   cheesy
Logged

cranioscopical
Friend of the Site
Supporting Member
**
Posts: 4,182



see users location on a map View Profile Read user's biography. Give some DonationCredits to this forum member
« Reply #13 on: March 27, 2011, 01:10:52 PM »


The clipboard is a fickle beast and working with it can be a right pain in the arse.


We're very glad that you got to the bottom of this one.

(a few DC credits coming to you and the site)
Logged

Chris
Nater
Participant
*
Posts: 13


View Profile Give some DonationCredits to this forum member
« Reply #14 on: March 27, 2011, 05:04:12 PM »

Are you familiar with AutoHotkey?  If so, here's a way to do it with AutoHotkey that seems to work pretty well.  It uses F2 as a hotkey which will only be active if a Firefox or Chrome window is active.  You can change the hotkey to whatever you like.  Also, you may have to play around with the sleep values a bit if it doesn't work right for you immediately.

I have heard of AutoHotkey, but have never used it.  This may take me a little time to figure out how to use.  I first went to the website and wasn't sure which version to download, so I started with the first one, AutoHotkey_L.  I ran the install, and started it, but I obviously need to read more of the documentation on how to load up your script since there is no command prompt or GUI to interact with.  I am guessing it has already loaded a default script and I interact with it through hotkeys?  After I figure out how to use this program and your script, I will be able to try it.

Thank you for the script, and encouraging me to use AutoHotkey.  

Hopefully I will get it working soon.
« Last Edit: March 27, 2011, 05:06:58 PM by Nater » Logged
skwire
Global Moderator
*****
Posts: 4,116



Another Coding Snack request? Om nom nom...

see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #15 on: March 27, 2011, 05:14:02 PM »

My snippet should work with any flavour of AHK.  All you should need to do is copy out the snippet to a <something>.ahk file, edit the hotkey if you want, save and run then run the .AHK file.
Logged

Nater
Participant
*
Posts: 13


View Profile Give some DonationCredits to this forum member
« Reply #16 on: March 27, 2011, 11:38:32 PM »

OK, I think I got the AHK script to work.  Thank you for your help.  But I don't think it is doing what I want it to. 

I guess I should have actually read your script before I ran it.  But at least I have now used AHK for the first time and know how it works.

Your script copies the text, and the URL of the page that the text came from.  This is nice, but not what I was trying to describe.   

Let me use the 5 last lines of http://www.autohotkey.com/download/ as an example.

When I copy and paste them into a text editor from the browser, I am expecting something like this:

Installer for AutoHotkey_L (http://www.autohotkey.net.../AutoHotkey_L_Install.exe): During installation it allows you to choose Unicode or ANSI, and 64-bit or 32-bit. It has many new features.

Installer for AutoHotkey Basic (http://www.autohotkey.com...oad/AutoHotkeyInstall.exe) (1.95 MB): This is the original AutoHotkey, suitable for those who don't need Unicode, objects/arrays, and other new features. If you prefer not to run the installer, download this zip file instead.

SmartGUI Creator 4.0 (http://www.autohotkey.com/download/smartgui.zip) (273 KB): A visual layout tool that automatically generates GUI scripts. For Windows 9x, get this version instead.

SciTE4AutoHotkey (http://www.autohotkey.net...s/SciTE4AutoHotkey_3/web/): A free editor for AutoHotkey scripts that offers syntax highlighting, AutoComplete, IntelliSense, code folding, and other features.

Other Downloads (http://www.autohotkey.com...wnload/OtherDownloads.htm): Contains AutoHotkey.dll (http://www.autohotkey.net/~tinku99/ahkdll), AutoCorrect (http://www.autohotkey.com...otstrings.htm#AutoCorrect), source code, miscellaneous utilities, and other versions of AutoHotkey.
skwire - How did you insert that cool scrolling text box on the forum?  I tried to figure out how to do that, and just used a table to set my example apart. 
Logged
skwire
Global Moderator
*****
Posts: 4,116



Another Coding Snack request? Om nom nom...

see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #17 on: March 28, 2011, 02:13:49 AM »

When I copy and paste them into a text editor from the browser, I am expecting something like this:
[SNIP]

Ah, you want the text with all the markup and links and such, eh?  If so, you will probably need to spring for Surfulator or maybe you could get by with the Scrapbook extension.

skwire - How did you insert that cool scrolling text box on the forum?  I tried to figure out how to do that, and just used a table to set my example apart. 

I used the AHK code highlighter.  It's available from the Code Highlighting drop-down list when writing a post/reply.
Logged

Nater
Participant
*
Posts: 13


View Profile Give some DonationCredits to this forum member
« Reply #18 on: March 28, 2011, 09:31:54 AM »

Quote
Ah, you want the text with all the markup and links and such, eh?  If so, you will probably need to spring for Surfulator or maybe you could get by with the Scrapbook extension.

Thanks for your suggestions.

Scrapbook looks good, but the end result is still html from what I can see, and I really want to get it down to the text level.

I just found html2text which has output which I like.  Now if I can figure out how to automate capturing a snippet of HTML residing on the clipboard, processing it thru html2text, then copying it to the clipboard so that I can paste it into a text editor, I think I'd have a solution I can live with.

Can AHK do this?
Logged
Renegade
Charter Member
***
Posts: 11,639



Tell me something you don't know...

see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #19 on: March 28, 2011, 10:04:00 AM »

I had to add another Sleep between the ^c and Clipboard get:

Yep, and that's exactly why I mentioned it.  The clipboard is a fickle beast and working with it can be a right pain in the arse.  I'm glad you got it working.   cheesy

In MS Excel if you repeatedly press CTRL + C it will tell you that another application has the clipboard and deny access with a warning. It just can't keep up with itself. Related odd fact.
Logged

Slow Down Music - Where I commit thought crimes...

Freedom is the right to be wrong, not the right to do wrong. - John Diefenbaker
rjbull
Charter Member
***
Posts: 2,778

View Profile Give some DonationCredits to this forum member
« Reply #20 on: March 28, 2011, 03:53:48 PM »

Which Firefox addon(s) where you thinking of?

I've re-read your OP and checked my extensions.  I regret to report that I don't have a solution as specified.  Apologies.

I should have known better, too.  I spent enough time doing more or less what you wanted, with the same problem about adding URLs.  Sigh.

I've sometimes used a Firefox extension that copies HTML as HTML into the Notetab editor, and using Notetab's built-in feature to strip HTML but retain URLs, though still have to add the URL of the page itself as a separate operation. 

html2text: you might also like Nir Sofer's freeware HTMLAsText, which can also be run from the command line if required.
Logged
rjbull
Charter Member
***
Posts: 2,778

View Profile Give some DonationCredits to this forum member
« Reply #21 on: March 28, 2011, 03:58:24 PM »

if I can figure out how to automate capturing a snippet of HTML residing on the clipboard, processing it thru html2text, then copying it to the clipboard so that I can paste it into a text editor

You might try a DC favourite, mouser's clipboard enhancer Clipboard Help+Spell, which allows you to define external tools to be applied to clips.
Logged
4wd
Supporting Member
**
Posts: 3,354



see users location on a map View Profile Read user's biography. Give some DonationCredits to this forum member
« Reply #22 on: March 28, 2011, 05:34:12 PM »

This sounds like an idea that might benefit more from using a GreaseMonkey userscript, ie. change the actual web page so that it looks the way you want to paste it before you copy it.
Logged

I do not need to control my anger ... people just need to stop pissing me off!
Nater
Participant
*
Posts: 13


View Profile Give some DonationCredits to this forum member
« Reply #23 on: March 28, 2011, 11:29:47 PM »

Quote
I've sometimes used a Firefox extension that copies HTML as HTML into the Notetab editor, and using Notetab's built-in feature to strip HTML but retain URLs, though still have to add the URL of the page itself as a separate operation.

I have thought of doing this but would really like a more simple solution.  I do like Notetab, but don't have a license for the pro version, and feel limited by the non-unlimited undo of notetab light.  I like Notepad++ and Editor2.  I'm sure there are many notepad replacements and other programs that have HTML stripping functions where I could do as you described, this may be my only option if I can't get something else to work. 

Quote
html2text: you might also like Nir Sofer's freeware HTMLAsText, which can also be run from the command line if required.

I did notice this program in my searching.  It appears the HTML must be saved as a file before this can be used.  Again, a good program, but I would really like to do this a with basic copy and paste action or something similar.  Perhaps I could write a script that would temporarily save the HTML snippet as a file, process it with HTMLAsText, then copy the converted text ready to be pasted?  I don't know if I can do this with your other suggestion, Clipboard Help+Spell.   I'll have to look into it.  From the surface it doesn't look like it can easily be done.
Logged
Nater
Participant
*
Posts: 13


View Profile Give some DonationCredits to this forum member
« Reply #24 on: March 28, 2011, 11:34:33 PM »

This sounds like an idea that might benefit more from using a GreaseMonkey userscript, ie. change the actual web page so that it looks the way you want to paste it before you copy it.

I like this idea.  I've never wrote a GreaseMonkey userscript.  I think this is the closest way to my solution.  Now I just need to come up with the script.  I like the way the ASCIINATOR processes webpages into text with links.  I wonder if I could convert Aaron Swartz's Python to a GreaseMonkey userscript?
« Last Edit: March 28, 2011, 11:43:08 PM by Nater » Logged
Pages: [1] 2 Next   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.078s | Server load: 0.2 ]