Page 1 of 1

code that will replace the number layout

Posted: 21 Oct 2021, 13:09
by Magija
Hello members of the autohotkey community, I want to create code to help me work.
I want to create a code that will replace the number layout.

for example, the code is as follows (Codes are random at all times):

00 00 0 000 000, 00000000000, 0 000 000, 0000000

i want this code changed to:

00 00 0 000 000
00000000000
0 000 000
0000000

And a system that can see and read this code will change.

Re: code that will replace the number layout

Posted: 21 Oct 2021, 14:44
by Smile_

Code: Select all

Code := "00 00 0 000 000, 00000000000, 0 000 000, 0000000"
Msgbox % RegExReplace(Code, ",( +)?", "`n")

Re: code that will replace the number layout

Posted: 22 Oct 2021, 08:42
by Magija
Smile_ wrote:
21 Oct 2021, 14:44

Code: Select all

Code := "00 00 0 000 000, 00000000000, 0 000 000, 0000000"
Msgbox % RegExReplace(Code, ",( +)?", "`n")

I want to make my random code "00 00 0 000 000, 00000000000, 0 000 000, 0000000" read on notpad and automatically converted to normal number layout.



I write to notepad the code "00 00 0 000 000, 00000000000, 0 000 000, 0000000" I click "Numpad2" and my script automatically writes the following code:

00 00 0 000 000
00000000000
0 000 000
0000000

I want the neat code to be on the notepad as well and I can copy it

Re: code that will replace the number layout

Posted: 22 Oct 2021, 11:32
by Smile_
Make a selection first.

Code: Select all

Numpad2::
If WinActive("ahk_exe notepad.exe") {
	Clipboard := ""
	SendInput, ^c
	ClipWait, 1
	If (!Clipboard)
		MsgBox, 64,, % "There is nothing to do in here!"
	SendInput, % "{Raw}" RegExReplace(Clipboard, ",( +)?", "`n")
}
Return

Esc::ExitApp

Re: code that will replace the number layout

Posted: 22 Oct 2021, 11:47
by Magija
Smile_ wrote:
22 Oct 2021, 11:32
Make a selection first.

Code: Select all

Numpad2::
If WinActive("ahk_exe notepad.exe") {
	Clipboard := ""
	SendInput, ^c
	ClipWait, 1
	If (!Clipboard)
		MsgBox, 64,, % "There is nothing to do in here!"
	SendInput, % "{Raw}" RegExReplace(Clipboard, ",( +)?", "`n")
}
Return

Esc::ExitApp

is it possible to make it work like this?

Image

Re: code that will replace the number layout

Posted: 22 Oct 2021, 13:38
by Smile_
Isn't that what the last script meant to do?
You want to add text instead of replacing?

Re: code that will replace the number layout

Posted: 22 Oct 2021, 13:49
by Magija
Smile_ wrote:
22 Oct 2021, 13:38
Isn't that what the last script meant to do?
You want to add text instead of replacing?
in my opinion, the script you write does not perform such a function

Re: code that will replace the number layout

Posted: 22 Oct 2021, 14:17
by Masonjar13
Magija wrote:
22 Oct 2021, 13:49
in my opinion, the script you write does not perform such a function
Correct and incorrect are not opinions. Their script does work as you asked. What is it that you have an issue with?

Re: code that will replace the number layout

Posted: 22 Oct 2021, 14:48
by RussF
Try this:

Code: Select all

Numpad2::
If WinActive("ahk_exe notepad.exe") {
	Clipboard := ""
	SendInput, ^a
	SendInput, ^c
	ClipWait, 1
	If (!Clipboard)
		MsgBox, 64,, % "There is nothing to do in here!"
	SendInput, {Esc}{End}{Enter 2}
	SendInput, % "{Raw}" RegExReplace(Clipboard, ",( +)?", "`n")
}
Return

F1::ExitApp
Russ