Hi all,
I have just started using AHK and have little or no idea about scripts. What I am trying to do is apparently simple:
I copy and paste lots of text from websites and programs and would like to have the same way of selecting text as in MS Word (selecting one or more words without positioning the cursor at the beginning or end of a word). Besides, two added functions.
1) Automatic copy of the word/words once selected.
2) Pasting the text by just middle clicking the mouse on the desired position.
Please can you help me with this? It would be much appreciated!
Selecting, copying, and pasting text conveniently
-
- Posts: 27
- Joined: 08 Aug 2018, 07:27
Re: Selecting, copying, and pasting text conveniently
For copying selected word you can use this script.
For pasting text this
For pasting text this
Code: Select all
~MButton::
click
send ^v
return
Re: Selecting, copying, and pasting text conveniently
Thank you. The paste function works as expected but not the first one.
What I would like is to select text like in MS Word, i.e. placing the cursor in any part of the word and dragging selects the whole word, if you continue dragging the next whole word is selected, and so on.
Is there any way to do this?
What I would like is to select text like in MS Word, i.e. placing the cursor in any part of the word and dragging selects the whole word, if you continue dragging the next whole word is selected, and so on.
Is there any way to do this?
-
- Posts: 440
- Joined: 28 Apr 2018, 21:59
Re: Selecting, copying, and pasting text conveniently
Code: Select all
~LButton::
Click, down
while GetKeyState("LButton")
{
}
send ^c
return
~MButton::
click
send ^v
return
Re: Selecting, copying, and pasting text conveniently
Amzaing MannyKSoSo, it works!
Yeah, sometimes it feels weird, but overall it´s very good. I can suspend the function pressing letf control.
I´ll see if it can be improved somehow.
Thanks a lot!
Yeah, sometimes it feels weird, but overall it´s very good. I can suspend the function pressing letf control.
I´ll see if it can be improved somehow.
Thanks a lot!
-
- Posts: 440
- Joined: 28 Apr 2018, 21:59
Re: Selecting, copying, and pasting text conveniently
If you want a bit more refined version then here it is
This waits 200 milliseconds and if you are still holding down the button it will work like word otherwise its just a normal click.
Code: Select all
~LButton::
Sleep 200
If GetKeyState("LButton", "P")
{
Click, Down
While GetKeyState("LButton") {
}
send ^c
Return
}
Else
Return
Re: Selecting, copying, and pasting text conveniently
Hi,
The last script works OK with word like mode but "normal" mode behaves weirdly.
The last script works OK with word like mode but "normal" mode behaves weirdly.
Re: Selecting, copying, and pasting text conveniently
Actually, it is a good approach to have the option to activate Word like mode. Any idea how to make it work correctly?
-
- Posts: 440
- Joined: 28 Apr 2018, 21:59
Re: Selecting, copying, and pasting text conveniently
I think the best bet is using a hotkey for Pause here https://autohotkey.com/docs/commands/Pause.htm
Set it above the ~LButton:: and it "should" pause the script from that action. The reason why the last script behaves a little weird is because you have to hold down the button for at least 200 ms before its registered as a word select. You can adjust the sleep to your liking but 200 is about as long as it should be. You also don't want the script to be too short of a time either otherwise it will just take all clicks as the word click.
Suspend is also another option if Pause does not work https://autohotkey.com/docs/commands/Suspend.htm
Set it above the ~LButton:: and it "should" pause the script from that action. The reason why the last script behaves a little weird is because you have to hold down the button for at least 200 ms before its registered as a word select. You can adjust the sleep to your liking but 200 is about as long as it should be. You also don't want the script to be too short of a time either otherwise it will just take all clicks as the word click.
Suspend is also another option if Pause does not work https://autohotkey.com/docs/commands/Suspend.htm
Re: Selecting, copying, and pasting text conveniently
I prefer not to use key combinations as it makes the process slower. I have added the paste function to your second script. There are some flaws but I think I can live with them 
If you come up with a better idea without hotkeys, please let me know.
Thanks for your help!

If you come up with a better idea without hotkeys, please let me know.
Thanks for your help!