code that will replace the number layout

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Magija
Posts: 21
Joined: 21 Aug 2021, 06:29

code that will replace the number layout

21 Oct 2021, 13:09

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.
User avatar
Smile_
Posts: 858
Joined: 03 May 2020, 00:51

Re: code that will replace the number layout

21 Oct 2021, 14:44

Code: Select all

Code := "00 00 0 000 000, 00000000000, 0 000 000, 0000000"
Msgbox % RegExReplace(Code, ",( +)?", "`n")
Magija
Posts: 21
Joined: 21 Aug 2021, 06:29

Re: code that will replace the number layout

22 Oct 2021, 08:42

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
User avatar
Smile_
Posts: 858
Joined: 03 May 2020, 00:51

Re: code that will replace the number layout

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
Magija
Posts: 21
Joined: 21 Aug 2021, 06:29

Re: code that will replace the number layout

22 Oct 2021, 11:47

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
User avatar
Smile_
Posts: 858
Joined: 03 May 2020, 00:51

Re: code that will replace the number layout

22 Oct 2021, 13:38

Isn't that what the last script meant to do?
You want to add text instead of replacing?
Magija
Posts: 21
Joined: 21 Aug 2021, 06:29

Re: code that will replace the number layout

22 Oct 2021, 13:49

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
User avatar
Masonjar13
Posts: 1555
Joined: 20 Jul 2014, 10:16
Location: Не Россия
Contact:

Re: code that will replace the number layout

22 Oct 2021, 14:17

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?
OS: Windows 10 Pro | Editor: Notepad++
My Personal Function Library | Old Build - New Build
RussF
Posts: 1261
Joined: 05 Aug 2021, 06:36

Re: code that will replace the number layout

22 Oct 2021, 14:48

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

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mcd, NullRefEx and 122 guests