How to trim extra space when selecting text?

Share your favorite FastKeys commands
User avatar
Tom
Posts: 318
Joined: Nov 24th, ’15, 23:39

Post by Tom » Jul 24th, ’19, 21:00

I'll try over the weekend. ;)
revavi
Posts: 8
Joined: Jul 17th, ’19, 15:28

Post by revavi » Jul 24th, ’19, 22:54

Tom wrote:
Jul 24th, ’19, 21:00
I'll try over the weekend. ;)
All right! I'll be waiting. Thank you! :D
User avatar
Tom
Posts: 318
Joined: Nov 24th, ’15, 23:39

Post by Tom » Jul 27th, ’19, 10:34

How about his? Notepad Format/WordWrap must be set to off.

Code: Select all

filename:="words.txt"
delimiter:=";"

Send, ^c
Sleep, 200
word=%clipboard%

FileRead, OUT, %filename%

found:=0
Loop, Parse, OUT, `n, `r
{
	if A_LoopField contains %word%%delimiter%
	{
        StringSplit, COL, A_LoopField, %delimiter%
        if not COL2
        {
            Run notepad %filename%
            WinWaitActive, ahk_class Notepad
            Send, ^g%A_Index%{Enter}^+{Right}           
        }
        else
            Msgbox, 64,, % COL1 "`n`n" COL2
        found:=1
        break
	}
}
if not found
{
	FileAppend, `n%word%%delimiter%, %filename%, UTF-8
	Run notepad %filename%
	WinWaitActive, ahk_class Notepad
	Send, ^{End}
}
return
revavi
Posts: 8
Joined: Jul 17th, ’19, 15:28

Post by revavi » Aug 4th, ’19, 07:43

Hi Tom,
I was on vacation. Thank you very much for the code. It works flawlessly!
Post Reply