Jump to content
Macro Express Forums

Kindle copy and paste


HeyJim

Recommended Posts

I don't even know where to start on this one as simple and basic as it is. Virtually nothing on Kindle here from a quick search.

 

When I copy text from a Kindle book and then paste it into a doc what I get is the content that I specifically copied plus info documenting the book and author that originated that text. The paste is only for me, not to be published, so copyright info is just intrusive and space wasting.

 

Any thoughts how to strip out this source info as it is copied or pasted?

 

Thanks.

Link to comment
Share on other sites

Some - preach Christ even of envy and strife -


Clarke, Adam. Commentary on the New Testament (Kindle Locations 43117-43118). Titus Books. Kindle Edition.



Just copied line 1 from Kindle and then line 2 is automatically added. It's not a straight Windows copy/paste in that when one highlights text then a separate window opens giving one the opportunity to copy that text. Somehow the Kindle programming does its own unique copying into Windows clipboard and adds that extra line.

Link to comment
Share on other sites

There appears to be is a carriage return (ASCII 13) at the end of the quote.

 

So what I would do is copy the clipboard to a text variable (T1); calculate the position of ASCII 13 in T1 (N1); copy from character 0 to character N1 in T1, and assign it to T2; and then copy T2 to the clipboard.

Variable Set to ASCII Char 13 to %T[99]% // This is the Ascii code for a carriage return

Variable Set String %T[1]% from the clipboard contents
 
Variable Set Integer %N[1]% to the position of "%T[99]%" in %T[1]%

Variable Modify String: Copy a substring in %T[1]%, starting at 0 and %N[1]% characters long to %T[2]%
 
Variable Modify String: Save %T[2]% to the clipboard

You will likely need to tweak the code slightly. I haven't thoroughly tested the code.

 

Also, I did this with Macro Express Pro, so the syntax will be a little different with Macro Express 3.

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

Hello didn't get u exactly, however if I have understood you correctly then let me try this!

As you are coping and pasting something let say One paragraph then along with that paragraph it also paste other information like Authors name publisher etc. If am correct then ...

Check whether in the end if it always paste the same sentence i.e. abt the authors etc if it's same...

 

Then depending upon the Macro express version just count the number of words it paste automatically and then in your macro at the time of pasting from clipboard Or T1 whatever subtract those words and gave the command to paste.

Link to comment
Share on other sites

Here's a variant on Alan's suggestion:

Put clipboard data into a text variable, locate the literal "Kindle Locations", delete from there to the end of the text, then delete backwards until you find -- something. I'm not sure what "something" will be -- possibly a carriage return, or carriage return/line feed sequence, like Alan suggested. The only potential advantage of my method over Alan's is, if there are multiple CRs or CR/LFs in the copied text then just finding the first one will end up losing some (or most) of the text. Again as Alan suggested you will use Variable Modify String to strip out the unwanted material.

 

Maybe when you paste an example into Notepad, you could save the Notepad file and attach it to a posting here. Then we could look at it with a hex editor to see what characters are reliably present for delimiting the unwanted material.

 

When you get it working, be sure to let us know how this comes out, because we're curious. :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...