Clipboard with content filter - Autohotkey

1

Do you have any idea how to automate the following situation?

I'm using Autohotkey for this.

I'll tell you the situation and then I'll tell you the hypotheses I considered (part of them only, since I could not finish it)

1 - I give ctrl + c in a multi-line content, I'll call them 1,2,3,4,5 and 6 to make logic easier.

I just want to copy line 2, 3, 4 and 5 but also with content selection on the lines, ie do not copy entire line 2, just the numbers (delete the texts). The same goes for other lines, but with another type of filter.

2 - The script then sends the clipboard only the desired content of line 2, 3, 4 and 5 and then inserts into the output file only the desired content of line 2 with other standard text. The same goes for the other lines.

Example: Line 2 has "XYZ123". The script copies "123" only and sends the output file "ABC123". The same goes for other lines.

3 - The script after copying all lines, inserts a new line 7 of my choice that will exist only in the output file.

4 - The script then waits for the next CTRL + C to repeat the process with the next CTRL + C.

PS: Lines are not always in the same order. For example, the content of line 2 is sometimes in line 3. However, there is always a keyword in each line that can be used to filter your content.

The next step would be to automatically ctrl + c in the content, but I will first address this impasse.

Hypotheses that I considered:

1 - To separate each row and paste always in the same order, you would use variables to assume the value of the row already with the deleted unwanted content.

2 - If you can not automate the order of the lines, it is okay to use hotkeys to decide which line or which system message to ask me and act on the response.

clipboard =  ; Começa o script com o clipboard vazio

ClipWait  ; Espera encher o clipboard
FileAppend, %clipboard%'r'n, C:\Users\caio_\Desktop\Teste de programação\Saída.txt ; Joga pro arquivo de saída
MsgBox Control-C copied the following contents to the clipboard:'n'n%clipboard% ; Aparece uma confirmação do que foi copiado (vou tirar quando estiver tudo funcionando)

Reload ; Pra reabrir o script
Sleep 1000 ; 
MsgBox, 4,, The script could not be reloaded. Would you like to open it for editing?
IfMsgBox, Yes, Edit
return

Edit to better explain the doubt: the problem is that I could not find a way to filter the contents of the clipboard so I could not integrate other commands to work out my idea. The goal is to find a way to filter content, which I really could not find. By doing this, I can figure out how to work the rest. I have described the situation in any case if someone gives a good idea how to play this to an output file in the best way.

    
asked by anonymous 22.01.2018 / 03:38

0 answers