firefox copy/paste question

Index » 喫茶店 (Koohii Lounge)

  • 1
 
Reply #1 - 2010 April 04, 3:21 pm
nest0r Member
Registered: 2007-10-19 Posts: 5236 Website

So let's say there is a series of web pages or other text you can view in Firefox. Each of these has a different text. But these sections of text are formatted similarly, that is to say, they each begin with the same phrase and end with the same phrase. I say 'phrase', not 'html code'. If I wanted to copy the text in these sections (as it's presented in Firefox), the only way I know to do this is manually, i.e. open each page and manually copy/paste. Is there a way to, say, open them all in multiple tabs, and tell Firefox to copy all the text between the identical beginning/end phrases?

I mean a plugin, I suppose. I'm not sure a clipboard utility would be able to ignore the html code, but if it can, then that too.

Last edited by nest0r (2010 April 04, 3:23 pm)

Asriel Member
From: 東京 Registered: 2008-02-26 Posts: 1343

There is (was?) a program I had a while ago, where you would tell it to perform certain "routines," and I'm pretty sure that you could do this.
You hit "record," and it would remember everything you did, and then you could just run the script, and it would do it. You could set more commands in the code (which, IIRC, were specific to the program), so I can't imagine it would be too hard to make it do something like:

while (Firefox's window has open tabs) {
    find("Identical Beginning Phrase")
    copy(text until "Identical Ending Phrase")
    close(current tab)
}

Keep in mind, that is NOT anything near to the code you will probably be using. Just an example of what I think you'd be able to use.

Give me a few minutes, and I'll see if I can find the program again.

Reply #3 - 2010 April 05, 1:26 am
Asriel Member
From: 東京 Registered: 2008-02-26 Posts: 1343

Pretty easy to find actually,
http://www.autoitscript.com/autoit3/index.shtml

But then again, I just searched for "windows macro scripter" and there were tons of results, so have at it. If this is will do the trick.

Advertising (register and sign in to hide this)
JapanesePod101 Sponsor
 
Reply #4 - 2010 April 05, 1:46 am
nest0r Member
Registered: 2007-10-19 Posts: 5236 Website

Your example script looks great! Too bad the actual stuff is too complex for my wee n00b brain.

Reply #5 - 2010 April 05, 2:26 am
Asriel Member
From: 東京 Registered: 2008-02-26 Posts: 1343

Unfortunately, I'm on a Mac, and have long since gotten rid of my virtual machine with Windows installed on it..

I'm pretty sure it could do what you want, because what I was using it for before was copying text that appeared in programs into notepad, and then refreshing Firefox every time the notepad file, so I could follow along, using Rikaichan as I needed.

I'll look into it and see if I can help you from the mac-side of things, anyway...

balloonguy Member
Registered: 2007-05-06 Posts: 54

It would probably be simpler to just make an extension.

Asriel Member
From: 東京 Registered: 2008-02-26 Posts: 1343

yeah, i don't doubt that at all

I just don't know how to sad

Sebastian Member
Registered: 2008-09-09 Posts: 583

I think that your best option for now is an autocopy extension + a clipboard manager.

Reply #9 - 2010 April 07, 6:57 pm
balloonguy Member
Registered: 2007-05-06 Posts: 54

Here's something that works. Right click on a page and click copier. It will prompt for a start word and end word and will apply this regex to all the tabs:
     /\bstring1\b([\s\S]*?)\bstring2\b/
and put the results on the clipboard separated by a newline.

Reply #10 - 2010 April 07, 7:31 pm
nest0r Member
Registered: 2007-10-19 Posts: 5236 Website

balloonguy wrote:

Here's something that works. Right click on a page and click copier. It will prompt for a start word and end word and will apply this regex to all the tabs:
     /\bstring1\b([\s\S]*?)\bstring2\b/
and put the results on the clipboard separated by a newline.

Awesome! I'm having a problem though, I think the clipboard doesn't have enough memory? I'm hoping it will still work with a replacement clipboard extender thingy?

As it stands, I tried copying a batch of text and pasting it but nothing happened, even though it worked for a smaller amount. I looked at the default Win clipboard and it said not enough memory or somesuch.

Woohoo! Works now. No idea why though. Hmm, it happened after I cleared my Firefox cache on an instinct...

Thanks guy, you are the... Guy.

Edit: Ohhhh, it's case sensitive?

Edit 2: Yes, this is extremely useful. In fact, I think it might be even more useful beyond my original goals that I haven't thought of yet.

Last edited by nest0r (2010 April 07, 9:53 pm)

Reply #11 - 2010 April 08, 9:27 am
balloonguy Member
Registered: 2007-05-06 Posts: 54

Yeah, it's just applying a regular expression. Not sure about the cache problems.

Reply #12 - 2010 April 08, 11:47 am
nest0r Member
Registered: 2007-10-19 Posts: 5236 Website

Ah, the cache thing was just me making a spurious correlation! ;p

So far, swaths of text from 50 tabs at a time has been no problem. Between that and this SendTo trick for Firefox that allows me to open multiple local .html files at a time...

Last edited by nest0r (2010 April 08, 11:48 am)

Reply #13 - 2010 April 08, 9:22 pm
nest0r Member
Registered: 2007-10-19 Posts: 5236 Website

By the way, know how to get this to work for the View Source stuff? I have a plugin that lets me view source/view source selection in tabs, but the copier thingy gets befuddled by newlines or something.

If it takes more than 5 seconds to think of a solution, don't worry about it, it's not a big deal, just a random thought that popped into my head and I couldn't resist commenting about.

Last edited by nest0r (2010 April 08, 9:23 pm)

  • 1