Page 2 of 3

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 06:34
by BoBo

Code: Select all

No := 0

p::
   Send, ^c
   No++
   FileAppend, % No . " - " . ClipBoard . "`n", MyNotes.txt
   Return

Esc:: ExitApp

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 06:44
by Nwb
BoBo wrote:

Code: Select all

No := 0

p::
   Send, ^c
   No++
   FileAppend, % No . " - " . ClipBoard . "`n", MyNotes.txt
   Return

Esc:: ExitApp
Nice didn't know about fileappend. Btw do you know why controlsend did not work? Didn't work for me either what am I missing?

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 06:52
by djasi78
Thank you @BoBo

Can this be used to create something like this ?

1
2
3
3.1
3.2
4
4.1
4.2

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 07:07
by guest2

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 07:21
by Nwb
djasi78 wrote:Thank you @BoBo

Can this be used to create something like this ?

1
2
3
3.1
3.2
4
4.1
4.2
Lemme try.

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 07:22
by Guest
Because you don't use number it doesn't write it :-)

Code: Select all

Number = 0
line:="`n`n-------`n`n" ; new line (2x) ------ new line (2x) - adjust to your preference "`n`n" will be empty line between notes

p:: 
Send, ^v
Number++
FileAppend, %number%. %clipboard% %line%, MyNotes.txt ; also inserts . after number
return
esc:: ExitApp

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 08:03
by Nwb
djasi78 wrote:Thank you @BoBo

Can this be used to create something like this ?

1
2
3
3.1
3.2
4
4.1
4.2
Was tricky but here's what I came up with! Would love to see if there was a better method to do this. :)

Code: Select all

No := 0
Reset := 0

p::
   No := No - Reset
   Reset := 0

   Send, ^c
   No++
   d:= floor(No)
   FileAppend, % d . " - " . ClipBoard . "`n", MyNotes.txt
   Return

^p::
SetFormat, Float, 0.1
   Reset += 0.1
   No += 0.1 
      FileAppend, % No . " - " . ClipBoard . "`n", MyNotes.txt
   Return


Esc:: ExitApp
Click 'p' to make a new numbered line (example: 1,2,3)
Click 'Ctrl+p' to make a sub-numbered line (example: 1.1,1.2,1.3)

Just remember that you cannot have more than nine sub-numbered lines in this script and you should be fine. ;)

Let me know if there was any complications!

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 09:14
by djasi78
For 1.1 , 2.1 , .... It only shows prompt that 1.1/2.1 .. is created but it does not paste it in txt file.

Overall functionality is perfect.

Thank you.

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 10:01
by djasi78

Working !! :bravo:

But it does not number the new text :crazy:

Thank you.

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 10:44
by Nwb
djasi78 wrote:For 1.1 , 2.1 , .... It only shows prompt that 1.1/2.1 .. is created but it does not paste it in txt file.

Overall functionality is perfect.

Thank you.
Oh oops! I left it at msgbox haha my bad try now.

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 10:53
by djasi78
Awesome , almost perfect.

All i need is to create , more than 10 sub headings . Anyway to do it ?

Thank you.

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 11:49
by Nwb
djasi78 wrote:Awesome , almost perfect.

All i need is to create , more than 10 sub headings . Anyway to do it ?

Thank you.
Sure but it will be 1.01, 1.02, 1.03... 1.10,1.11.. etc. will that be alright? I know it's possible to change 01 to 1 but I'm not sure about that.

Anyways here is script for as mentioned:

Code: Select all

No := 0
Reset := 0

p::
   No := No - Reset
   Reset := 0

   Send, ^c
   No++
   d:= floor(No)
   FileAppend, % d . " - " . ClipBoard . "`n", MyNotes.txt
   Return

^p::
SetFormat, Float, 0.2
   Reset += 0.01
   No += 0.01 
      FileAppend, % No . " - " . ClipBoard . "`n", MyNotes.txt
   Return


Esc:: ExitApp

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 12:05
by djasi78
It shows like this

1
2
3
4
5
5.0
5.0
5.0
5.0

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 12:20
by Nwb
djasi78 wrote:It shows like this

1
2
3
4
5
5.0
5.0
5.0
5.0
Oops sorry I keep forgetting minute details haha. Should work now. Just as you wanted to this ti,e. :P

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 12:29
by djasi78
:clap: :clap: :clap: :shock: :shock: :clap: :clap: :clap:

Finally :dance: :dance:

Any possibility of using this , to use Microsoft Word ?

Code: Select all

https://github.com/ahkon/MS-Office-COM-Basics/blob/master/Examples/Word/Document_collect_clipboard_data.ahk

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 14:49
by FanaticGuru
djasi78 wrote:I want to use Microsoft Word for saving.
Here is an example using Microsoft Word.

Code: Select all

F12::
	if (Toggle = "")
	{
		wdApp := ComObjActive("Word.Application")
		wdApp.Selection.Range.ListFormat.ApplyOutlineNumberDefault
		Toggle := 0
	}
	Toggle := !Toggle
	MsgBox % Toggle ? "Clip to Word: ON" : "Clip to Word: OFF"
return

#if Toggle
/::
	Send ^c
	ClipWait, 1
	wdApp.Selection.TypeText(Clipboard "`n")
return

.::
	Send ^c
	ClipWait, 1
	wdApp.Selection.Paragraphs(1).Range.ListFormat.ListIndent
	wdApp.Selection.TypeText(Clipboard "`n")
return

,::
	Send ^c
	ClipWait, 1
	wdApp.Selection.Paragraphs(1).Range.ListFormat.ListOutdent
	wdApp.Selection.TypeText(Clipboard "`n")
return
#If
You have to start the script and MS Word has to be open.

Then you hit F12 to toggle the script ON.

Then you highlight something and hit / to copy something to Word at the current indent level.
. to copy increasing the indent (this is the ">" key without shift)
, to copy decreasing the indent (this is the "<" key without shift)

Tested hardly any, but seems to work.

FG

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 15:04
by djasi78
@FanaticGuru :o :o :o :o

Thanks a lot .

@nwb also thanks a lot.

working , exactly like i wished :dance:

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

Re: Autocopy selected text and auto paste in word

Posted: 23 Feb 2018, 16:05
by FanaticGuru
After furture thought, not that it really matters but, the arrow keys are probably a better choice.

You can change the:
/::
.::
,::

to

Down::
Right::
Left::


Or whatever keys you like.

FG

Re: Autocopy selected text and auto paste in word

Posted: 24 Feb 2018, 06:04
by djasi78
I just came across that this script does not paste text from pdf

Thank you

Edit :

working just needed to use another PDF viewer

But i have another problem

If i copy

Code: Select all

The pharmacodynamics of cocaine involve the complex relationships of neurotransmitters (inhibiting monoamine uptake in rats with ratios of about: serotonin:dopamine = 2:3, serotonin:norepinephrine = 2:5).[59][10] The most extensively studied effect of cocaine on the central nervous system is the blockade of the dopamine transporter protein.
it will be pasted in word like this

a ) The pharmacodynamics of cocaine involve the complex relationships of neurotransmitters (inhibiting monoamine uptake in rats with ratios of about: serotonin:dopamine = 2:3,
b) serotonin:norepinephrine = 2:5).[59][10] The most extensively studied effect of cocaine on the central nervous system is the blockade of the dopamine transporter protein.

Re: Autocopy selected text and auto paste in word

Posted: 24 Feb 2018, 06:16
by Nwb
djasi78 wrote:I just came across that this script does not paste text from pdf

Thank you
Yes because ctrl+c does not copy from pdfs.