Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Firefox page source direct to clipboard


  • Please log in to reply
7 replies to this topic
col_mik
  • Members
  • 171 posts
  • Last active: Aug 29 2015 03:29 PM
  • Joined: 28 Jun 2015

Folks,

 

Note:  Read my update of Oct 15 (several posts below) before you spend time on this thread.

 

I have just made a discovery that you all probably made ages ago - but I searched the forum for Easy Copy and didn't find anything.

So - in case somebody didn't know, there is a plug-in for Firefox called Easy Copy.  Go to the plug-in manager and look for it.

Once it is installed, it can be configured to copy various information directly to the clipboard:

 

Title Link

URL

Title

Title link + Selection

BBCode (Forum) link

Wiki link

Page Source

 

That last one is the most useful for me!  The copy options can be turned on and off individually, and to activate the copy, right-click in the page and the menu that pops up includes Easy Copy.  You have to move the mouse to the right to select the option, but in the setup, you can also select "Show in Main Menu" for each item above.

 

There is another plug-in called Keyconfig that has pre-configured options for all the Easy Copy items, and just requires you to select a key combination for them.  For me, the only thing I'm interested in is the page source, so I have given it a key combination of Alt + "=", and now, when I press those keys, page source goes directly to the clipboard where I can parse it.  This solves a problem that I have had for some time.

URLDownloadToFile doesn't always get personal data that is posted to the screen by Java, and the scripts that have been written for URLDownloadToVar etc have not worked for me either because of permissions.  I solved the problem by using Firefox, going to the web page (using Run), sending a Ctrl+U (which displays the page source), then copying it to a file and parsing it there - but that involves displaying the page source on the screen - so this method will be much smoother

 

I haven't tried it yet, but I presume I will be able to send those keys from AHK then parse the clipboard for what I want.  I'll be playing with it tomorrow.  Right now, it's 01:45, and bed time.

 

Just thought you might be interested.



gregster
  • Members
  • 283 posts
  • Last active: Nov 09 2015 03:08 AM
  • Joined: 19 Mar 2009

If this works smoothly, it will be very helpful for me. I'll try later. Thanks a lot!



Rijul Ahuja
  • Members
  • 763 posts
  • Last active: Nov 25 2013 10:16 AM
  • Joined: 14 Mar 2012

Thanks!


Abandon the forum. The community has decided in a democratic vote to leave this website because of inactive and perverse administration.

Very few of the contributing members remain here.


col_mik
  • Members
  • 171 posts
  • Last active: Aug 29 2015 03:29 PM
  • Joined: 28 Jun 2015

I have incorporated this in several places in my script now, and I can confirm that it works perfectly.

 

The keys I set up to move page source to clipboard are Alt + "="

 

Send !=

Sleep 100

 

I find that  the sleep is necessary, but hanging around for 100ms is not critical to my application.



Forthac
  • Members
  • 2 posts
  • Last active: Oct 24 2013 10:00 PM
  • Joined: 23 Jun 2012

You can use this script to retrieve the URL of the current page from Firefox

http://www.autohotke...gh-dde-message/

 

And then this script can download the websource

http://www.autohotke...ldownloadtovar/



Ae2NY
  • Members
  • 1 posts
  • Last active: Sep 28 2013 02:43 AM
  • Joined: 28 Sep 2013

Colmik,

 

Thank you!

 

I created an account just to post this. I shouldn't have to learn DOM, then build a separate script just to pull a value from a webpage. I scoured this forum for a workable solution, and found tons of driftwood. (Not yet fully functional! June of '06) Downloading the source from a static page was useful in 1999.

 

Thank you for being agnostic and realizing that this might be one job best left to another tool.

 

In my instance, I'm scripting Cookie Clicker to find golden cookies. I just need to pull down the location in pixels.



col_mik
  • Members
  • 171 posts
  • Last active: Aug 29 2015 03:29 PM
  • Joined: 28 Jun 2015

For those interested in this thread, I (the originator) have just had to format my disk and re-build my system.  The new Firefox that I loaded is V24, and "Keyconfig" no longer works with it.  There is a new app with a similar title - "Key config" (note the space) but it doesn't interface with Easy Copy.

 

Previously, I had set keyconfig to that Alt-Equal would trigger Easy Copy to save the page source to the clipboard, so all my script needed to do was to send !=, then I could parse the clipboard - but that doesn't work any more.  Back to the drawing board!



col_mik
  • Members
  • 171 posts
  • Last active: Aug 29 2015 03:29 PM
  • Joined: 28 Jun 2015

Solved the problem in the above post.

 

When loading keyconfig, don't do it by using FireFox's Tools/Add-ons function - go to the source site  http://mozilla.doran...t/keyconfig.xpi  and get it there.

 

As the application add-on is available if you know where to look, but doesn't work with FF 24.0's add-on tool, my guess is that a link needs to be refreshed somewhere, so if you are reading this significantly later than the date of this post, you may find that it has been fixed.