Luis Diaz
asked on
AutoHotkey: Move from last string to initial string of a clipboard
Hello experts,
I would like to automate the following daily process through AutoHotkey:
Every time when I made a copy paste with multiple lines like this:
line 1
line 2
line 3
line 4
line 5
line 6
line 7
line 8
line 9
I need to manually move up from line 9 to line 1 (initial line of the copy-paste).
The idea is to:
Perform the copy-paste:
Send keys to move up automatically to the first string of the clipboard pasted.
In my example I expect to move the cursor from 9, last string of the clipboard to the first string of the clipboard l of line 1.
Obviously the AutoHotkey should be able to move up no matter the number of lines involved by the copy-paste
I expect the AutoHotkey to work on Notepad++, Word, Outlook EE block description and Excel if possible (:-))
If you have questions, please contact me.
Thank you for your help.
I would like to automate the following daily process through AutoHotkey:
Every time when I made a copy paste with multiple lines like this:
line 1
line 2
line 3
line 4
line 5
line 6
line 7
line 8
line 9
I need to manually move up from line 9 to line 1 (initial line of the copy-paste).
The idea is to:
Perform the copy-paste:
Send keys to move up automatically to the first string of the clipboard pasted.
In my example I expect to move the cursor from 9, last string of the clipboard to the first string of the clipboard l of line 1.
Obviously the AutoHotkey should be able to move up no matter the number of lines involved by the copy-paste
I expect the AutoHotkey to work on Notepad++, Word, Outlook EE block description and Excel if possible (:-))
If you have questions, please contact me.
Thank you for your help.
ASKER
Thank you Joe,
I tested and I have a little issue on my word 2016.
When I have a blank paragraph above, the cursor goes to the blank paragraph instead of going to the first letter of the clipboard.
I attached the video in which I performed the test at word.
The current version works fine and the little issue can be manageable however if you have a feedback on this please let me know.
I tested and I have a little issue on my word 2016.
When I have a blank paragraph above, the cursor goes to the blank paragraph instead of going to the first letter of the clipboard.
I attached the video in which I performed the test at word.
The current version works fine and the little issue can be manageable however if you have a feedback on this please let me know.
Video missing.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Joe,
Sorry for the delay.
Please find attached the video.
I am going to test your proposal and keep you informed.
2019-09-13_00h31_59.zip
Sorry for the delay.
Please find attached the video.
I am going to test your proposal and keep you informed.
2019-09-13_00h31_59.zip
ASKER
Joe,
I tested last version however I don't get the expected result.
When I paste text with blank lines on Word, I am not able to move to initial string of the clipboard.
Please find attached the second video.
Thank you for your help.
Luis-second-video-move-to-initial-po.zip
I tested last version however I don't get the expected result.
When I paste text with blank lines on Word, I am not able to move to initial string of the clipboard.
Please find attached the second video.
Thank you for your help.
Luis-second-video-move-to-initial-po.zip
Luis,
I could not figure out from your video what's going on. I realize that you like the keyboard better than the mouse (so do I), but this one strikes me as not worth much in the automation realm. All you have to do is move the mouse to the beginning of the pasted code and left-click. If you really want to pursue this, experiment with the number of up arrows needed (NumLines in my AutoHotkey code) for various conditions/programs. Regards, Joe
I could not figure out from your video what's going on. I realize that you like the keyboard better than the mouse (so do I), but this one strikes me as not worth much in the automation realm. All you have to do is move the mouse to the beginning of the pasted code and left-click. If you really want to pursue this, experiment with the number of up arrows needed (NumLines in my AutoHotkey code) for various conditions/programs. Regards, Joe
ASKER
Joe,
You are totally right. I will take second proposal.
I re-tested second proposal with just a break line at word and it works!
I have already added to my AutoHotkey file like this:
Thank you for your help!
You are totally right. I will take second proposal.
I re-tested second proposal with just a break line at word and it works!
I have already added to my AutoHotkey file like this:
^#i::
If (WinActive("ahk_exe excel.exe"))
{
Send {Home}
Return
}
NumLines:=0
Loop,parse,Clipboard,`n,`r
{
NumLines:=NumLines+1
LastLine:=A_LoopField
}
If (LastLine="")
NumLines:=NumLines-1
If (WinActive("ahk_exe winword.exe"))
NumLines:=NumLines-1
If (NumLines>0)
Send {Up %NumLines%}{Home}
Return
Thank you for your help!
> I re-tested second proposal with just a break line at word and it works!
Glad to hear that, Luis, thanks for letting me know that it works. Regards, Joe
Glad to hear that, Luis, thanks for letting me know that it works. Regards, Joe
Put the code below after the Paste in your AutoHotkey script:
Open in new window
Tested in W7 with Notepad++, Word 365, Outlook 365 (Compose window), EE comment block (in Chrome and Firefox), and Excel 365. Regards, Joe