I'm need for a digit in a name to be variable

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Deepmojoman
Posts: 11
Joined: 01 Nov 2022, 13:45

I'm need for a digit in a name to be variable

10 Apr 2023, 13:55

This is the code:

Code: Select all

v::
ControlClick, JUCE_BASE_VIEW, XX - Analog Lab V
return
The two uppercase Xs represent a number that counts up from 01, to 02, to 03 etc. AHK will only properly select this window (it's a plugin, inside Cubase) with the proper naming scheme, of course. It presently works with the Analog window I currently have in the Cubase project, as long as I write the code like this:

Code: Select all

v::
ControlClick, JUCE_BASE_VIEW, 04 - Analog Lab V
return
This is because this is the literal title of that plugin within the project. Cubase numbers whatever plugins you have open, starting with the first plugin as 01. Open up another (from any vendor) and it gets named 02, and so forth. So you can imagine, as soon as I open up another instance of Analog Lab V, it'll get name started with a completely different, and the code will not work.

So: is it possible to write a variance for just those two numbers, and have that variable acceptable in this line of code?

[Mod edit: Based on posted code, topic moved to AHK v1 help.]
wetware05
Posts: 750
Joined: 04 Dec 2020, 16:09

Re: I'm need for a digit in a name to be variable

10 Apr 2023, 14:24

Hi, Deepmojoman, I can think of this, but it's a rather clumsy procedure, since it involves pressing a number and perhaps interacting inside Cubase.

Code: Select all

v::
GetKeyState, state, 1
if (state = "D")
{
 Number:= "01"
}

GetKeyState, state, 2
if (state = "D")
{
 Number:= "02"
}

Name:= "JUCE_BASE_VIEW, " Number " - Analog Lab V"
 
MsgBox, % Name 

ControlClick, %Name%
;ControlClick, JUCE_BASE_VIEW, 04 - Analog Lab V

return
User avatar
Spawnova
Posts: 557
Joined: 08 Jul 2015, 00:12
Contact:

Re: I'm need for a digit in a name to be variable

10 Apr 2023, 14:25

You can use SetTitleMatchMode which allows for partial title matching, then you don't need to specify the number

Code: Select all

SetTitleMatchMode,2 ; partial matches allowed

v::
ControlClick, JUCE_BASE_VIEW, Analog Lab V
return
Deepmojoman
Posts: 11
Joined: 01 Nov 2022, 13:45

Re: I'm need for a digit in a name to be variable

10 Apr 2023, 14:57

Spawnova wrote:
10 Apr 2023, 14:25
You can use SetTitleMatchMode which allows for partial title matching, then you don't need to specify the number

Code: Select all

SetTitleMatchMode,2 ; partial matches allowed

v::
ControlClick, JUCE_BASE_VIEW, Analog Lab V
return
Thanks Spawn! That worked like a charm!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: macromint, peter_ahk, Spawnova and 262 guests