Hello, I have a simple question. Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Magas1234
Posts: 6
Joined: 05 Jul 2022, 14:23

Hello, I have a simple question.

Post by Magas1234 » 05 Jul 2022, 14:29

How to combine them both into one so that both work?Because right now working only one, because I doing combine mistake.
1. code

Code: Select all

Call2 := RegExReplace(Call, "\s" "")
RegExMatch(call2, "(.*)Radio](.*):", name)
2. code

Code: Select all

Call5 := RegExReplace(Call, "-" "")
RegExMatch(call2, "(.*)Radio](.*):", name)
Last edited by Magas1234 on 06 Jul 2022, 06:50, edited 1 time in total.

User avatar
mikeyww
Posts: 26599
Joined: 09 Sep 2014, 18:38

Re: Hello, I have a simple question.

Post by mikeyww » 05 Jul 2022, 14:48

Instead of using name in both functions, you could use a different output variable name.

Magas1234
Posts: 6
Joined: 05 Jul 2022, 14:23

Re: Hello, I have a simple question.

Post by Magas1234 » 05 Jul 2022, 15:52

mikeyww wrote:
05 Jul 2022, 14:48
Instead of using name in both functions, you could use a different output variable name.
maybe there is another way, because this one is not suitable for me.

User avatar
mikeyww
Posts: 26599
Joined: 09 Sep 2014, 18:38

Re: Hello, I have a simple question.

Post by mikeyww » 05 Jul 2022, 16:08

What goal are you trying to achieve? What is your example? What does "combine" mean for you, in terms of what the script should do?

Magas1234
Posts: 6
Joined: 05 Jul 2022, 14:23

Re: Hello, I have a simple question.

Post by Magas1234 » 05 Jul 2022, 16:16

mikeyww wrote:
05 Jul 2022, 16:08
What goal are you trying to achieve? What is your example? What does "combine" mean for you, in terms of what the script should do?
my script has to delete " " and "-" and replace i "" without a space, and it's always a coincidence which will be " " or "-", so I need them both to work.

User avatar
mikeyww
Posts: 26599
Joined: 09 Sep 2014, 18:38

Re: Hello, I have a simple question.

Post by mikeyww » 05 Jul 2022, 16:22

What is your example of input & output strings?

What does replace i "" without a space mean? Can you explain?

Magas1234
Posts: 6
Joined: 05 Jul 2022, 14:23

Re: Hello, I have a simple question.

Post by Magas1234 » 06 Jul 2022, 04:35

mikeyww wrote:
05 Jul 2022, 16:22
What is your example of input & output strings?

What does replace i "" without a space mean? Can you explain?
it means that for me from such a text.
H e l l o
Or
H-e-l-l-o
reads as such:
Hello

User avatar
mikeyww
Posts: 26599
Joined: 09 Sep 2014, 18:38

Re: Hello, I have a simple question.

Post by mikeyww » 06 Jul 2022, 06:13

Code: Select all

For each, str in ["H e l l o", "Hello", "H-e-l-l-o"]
 MsgBox,, Result, % "Input:    " str "`n`nOutput: " internalTrim(str)

internalTrim(str) {
 ; Return RegExReplace(str, "[ -]")
 ; Return RegExReplace(str, "\W")
 Return StrReplace(StrReplace(str, " ", ""), "-", "")
}

Magas1234
Posts: 6
Joined: 05 Jul 2022, 14:23

Re: Hello, I have a simple question.  Topic is solved

Post by Magas1234 » 06 Jul 2022, 06:51

mikeyww wrote:
06 Jul 2022, 06:13

Code: Select all

For each, str in ["H e l l o", "Hello", "H-e-l-l-o"]
 MsgBox,, Result, % "Input:    " str "`n`nOutput: " internalTrim(str)

internalTrim(str) {
 ; Return RegExReplace(str, "[ -]")
 ; Return RegExReplace(str, "\W")
 Return StrReplace(StrReplace(str, " ", ""), "-", "")
}
Thanks for help, I fixed that problem.

Post Reply

Return to “Ask for Help (v1)”