Page 1 of 3

Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 00:33
by djasi78
Hi
I am a medical student and I am working on research project and i need to copy , paste a lot of text from web , pdfs . :|

I want to automatically paste , selected text from anywhere [no mouse clicks / manual copying] (in web / pdfs ) , in microsoft word (or any software, you recommend) with a numerical list. :shock:

Or each selected text gets a new number and on a new line. :dance:

Although , i would prefer , if it could create a mind map in any software. :superhappy:

Thanks :bravo:

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 02:12
by Nwb
Quick sub-question: ~^ & c::, does that hotkey allow ctrl+c's native function or just ctrl's? (tilde and ampersand modifiers) Okay if it was not an explorer hotkey.

Probably what you can do is set ctrl c as a hotkey (wait I think you cannot do that because it's an explorer hotkey?) and then use clipboard and control send to paste that text in word. You can use a variable++ for the number and {enter} for a new line.

If you need help, I will try to help you write it. Just that I'm also very very bad with this so it will take me a small learning curve. :wtf:

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 02:20
by djasi78
Quick sub-question
No idea :o

I don't know , how to write a script :crazy:

Thanks for replying :bravo:

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 02:21
by Nwb
djasi78 wrote:
Quick sub-question
No idea :o

I don't know , how to write a script :crazy:

Thanks for replying :bravo:
Ok I'll try when I'm free. Because I'm not good with this myself either.. especially with controlclick. :crazy:
But it's fun trying.

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 02:23
by djasi78
Thanks :dance:

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 02:54
by Nwb
It was actually very simple! hehe.

Code: Select all

Number = 0

ctrl & b:: 
Number++
ControlSend, Edit1, {Enter} , Untitled - Notepad
ControlSend, Edit1, {Enter} , Untitled - Notepad
ControlSend, Edit1, %Number% , Untitled - Notepad
ControlSend, Edit1, {space} , Untitled - Notepad
ControlSend, Edit1, %clipboard% , Untitled - Notepad
return
esc:: ExitApp
How to use:
Copy this script into a .ahk script and then run the .ahk
1) Click esc when you want to exit/close the script
2) This script uses notepad let me know if you want a different application.
So open notepad and minimize. The script will work with the notepad in the background. Make sure only one notepad the notepad you are using, is open
3) Open browser, copy whatever you want to copy by selecting text and Holding Ctrl and clicking 'c' once just like you would to copy text normally.
Now after copying, Hold Ctrl and click 'b' once.

That should do what you asked for. Let me know if it does or doesn't work. Or if you want something else with it. :thumbup:

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 03:07
by djasi78
:o working pdf+web :shock:

I used ctrl + c instead of ctrl + v .

When using ctrl + v , it was pasting just the code in notepad.

Can copying OR pasting be automated ? So , that , i dont have to press ctrl + c / ctrl + b ?

I want to use Microsoft Word for saving. [

Code: Select all

edit
]

:dance: :dance: :bravo: :bravo:

Thanks :superhappy:

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 03:15
by Nwb
djasi78 wrote::o working pdf+web :shock:

I used ctrl + c instead of ctrl + v .

When using ctrl + v , it was pasting just the code in notepad.

Can copying OR pasting be automated ? So , that , i dont have to press ctrl + c / ctrl + b ?

I want to use Microsoft Word for saving. [

Code: Select all

edit
]

:dance: :dance: :bravo: :bravo:

Thanks :superhappy:
Oops I meant Ctrl c not ctrl v. :lol:
Okay so what you want is that pressing one key does both copying and pasting? It's possible.
Wait let me clarify. You have to click ctrl+c and ctrl+b in the browser itself you don't have to open notepad.

Okay if you want word can you do one thing for me?
Run that script, then search for it in your tray and right click it and click window spy. Now open word, and open window spy and click somewhere on word. Can you take a screenshot of what window spy says?

Here is the refined version:-

Code: Select all

Number = 0

p:: 
Send, ^v
Number++
ControlSend, Edit1, {Enter} , Untitled - Notepad
ControlSend, Edit1, {Enter} , Untitled - Notepad
ControlSend, Edit1, %Number% , Untitled - Notepad
ControlSend, Edit1, {space} , Untitled - Notepad
ControlSend, Edit1, %clipboard% , Untitled - Notepad
return
esc:: ExitApp
To use this, go to your browser and select the text you want to copy and paste, and click 'p'. That should do what you asked for let me know if it works.
Also let me know what you want to trigger the script with. Right now 'p' triggers the script.

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 03:19
by djasi78
ok , will do that , now.

You have to click ctrl+c and ctrl+b in the browser itself you don't have to open notepad.
:thumbup:

Thanks

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 03:34
by djasi78
Word in Window Mode

Code: Select all

https://imgur.com/a/lgbgy
Word in Maximize Mode

Code: Select all

https://imgur.com/a/xtmLv

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 03:43
by djasi78
The refined script is posting code only in notepad.

Instead of "p" , i think , "q" would be best.

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 03:58
by Nwb
Okay try this. Make sure wordpad is maximized.

Code: Select all

Number = 0

; select text and then click q 
q:: 
; change q to whatever character you want to trigger the script. You can also search for modifiers.
Send, ^v
; copies the selected text

Number++
; adds one to the variable 'Number' which is responsible for what number is typed out in your wordpad.

ControlSend, RICHEDIT50W1, {Enter} , Document - Wordpad
ControlSend, RICHEDIT50W1, {Enter} , Document - Wordpad
ControlSend, RICHEDIT50W1, %Number% , Document - Wordpad
ControlSend, RICHEDIT50W1, {space} , Document - Wordpad
ControlSend, RICHEDIT50W1, %clipboard% , Document - Wordpad
; pasting part

return

esc:: ExitApp
;exits/stops the script. Change esc to whatever you want to close the script.
Select text and click 'q' while on browser. And then check what happens to wordpad and let me know.
Esc to exit.

Changed hotkey from p to q
This list will be helpful for when you want to change it: https://autohotkey.com/docs/KeyList.htm

Additional things I can add is to make sure wordpad is maximized, if not, maximize then minimize, to check what the value of number is and hotkeys, to increase and decrease values of the number let me know what you want to add to the script if anything.

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 04:11
by djasi78
Yes , the wordpad is maximized.

But , nothing is pasted in wordpad.
to check what the value or number is and hotkeys to increase and decrease values of the number
I did not get this line .

Thanks :thumbup:

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 04:14
by Nwb
djasi78 wrote:Yes , the wordpad is maximized.

But , nothing is pasted in wordpad.
to check what the value or number is and hotkeys to increase and decrease values of the number
I did not get this line .

Thanks :thumbup:
nevermind that. Give me a second.

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 04:20
by djasi78
I used the refined script but still nothing is pasted in wordpad , but , if i press "q" on wordpad , it pastes the last selected text.

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 04:27
by Nwb
djasi78 wrote:I used the refined script but still nothing is pasted in wordpad , but , if i press "q" on wordpad , it pastes the last selected text.
Yea Yea I always have a problem with controlsend. I don't know why it's not working.

To others: Why isn't controlsend working? Do I need to use controlfocus or something?

Anyways I need to go offline for a bit I hope somebody else can help you with this. Until then I guess you can use the notepad script. Because I have no clue why controlsend is
not working on wordpad.

Good luck. ;)

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 04:33
by djasi78
Thank a lot . I really appreciate your support. :thumbup:

:bravo:

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 05:00
by djasi78
I will settle with the notepad. Its ok.

Code: Select all

Can i use some other key to create something like this

1
2
3
  3.1
  3.2
4
5
  5.1
  5.2

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 05:22
by Guest
Why notepad? You can write directly to a file using FileAppend (which you can open in Notepad).

Code: Select all

FileAppend, %clipboard%, MyNotes.txt

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 06:28
by djasi78
Like this ?

Code: Select all

Number = 0

p:: 
Send, ^v
Number++
FileAppend, %clipboard%, MyNotes.txt
return
esc:: ExitApp
But , it does not put the selected text on new line and does not number the text.

Thanks