[SOLVED] winget, myList, list Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
geotabs
Posts: 15
Joined: 14 May 2018, 14:20

[SOLVED] winget, myList, list

16 May 2018, 12:00

I am trying to get a script that would wimaximize a list of Stock Tickers on multiple windows that I trade and here is the code I am using but doesn't load them

Code: Select all

#7::
KeyWait p
   SetTitleMatchMode, 2
winget, myList, list, FAS, FAZ, GUSH, DRIP, LABD, LABU, UWT, DWT, SPXL, SPXU, SOXL, SOXS, TECL, TECS, JNUG, JDST, NUGT, DUST, VXX, UVXY, SVXY, TZA, TNA, DRN, DRV, YINN, YANG, SQQQ, TQQQ
Loop, %myList%
{ 
	WinActivate, % "ahk_id" myList%a_index%
	ControlSend, _WwG1, p, % "ahk_id" myList%a_index%
}
return
It could have any 5 of the symbols at one time and then change between them so I just put them all in there!
Where did I go wrong?

Thanks
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: winget, myList, list

16 May 2018, 15:56

Try

Code: Select all

#7::

KeyWait p
SetTitleMatchMode, 2

WinList := [ "FAS", "FAZ", "GUSH", "DRIP", "LABD", "LABU", "UWT", "DWT", "SPXL", "SPXU", "SOXL", "SOXS", "TECL", "TECS", "JNUG", "JDST", "NUGT", "DUST", "VXX", "UVXY", "SVXY", "TZA", "TNA", "DRN", "DRV", "YINN", "YANG", "SQQQ", "TQQQ" ]

For Each, WinTitle in WinList
{
	WinGet, WinID, ID, % WinTitle
	WinMaximize, % "ahk_id " WinID
}

Return
geotabs
Posts: 15
Joined: 14 May 2018, 14:20

Re: winget, myList, list

17 May 2018, 08:57

TLM wrote:Try

Code: Select all

#7::

KeyWait p
SetTitleMatchMode, 2

WinList := [ "FAS", "FAZ", "GUSH", "DRIP", "LABD", "LABU", "UWT", "DWT", "SPXL", "SPXU", "SOXL", "SOXS", "TECL", "TECS", "JNUG", "JDST", "NUGT", "DUST", "VXX", "UVXY", "SVXY", "TZA", "TNA", "DRN", "DRV", "YINN", "YANG", "SQQQ", "TQQQ" ]

For Each, WinTitle in WinList
{
	WinGet, WinID, ID, % WinTitle
	WinMaximize, % "ahk_id " WinID
}

Return
Thanks for the help TLM but this doesn't work!

What I have is multiple windows of the same symbol with different times like 3 Min, 15 Min 60 Min but the symbol is constant, this is the script that I am using now but if I change the minutes on 1 and then forget to change it back I have to then manually change for script to work again so would be nice to have a script that just uses the symbol!

Code: Select all

#1::
IfWinExist DBX (1 Min)  
      WinActivate
IfWinExist DBX (3 Min)  
      WinActivate
IfWinExist DBX (10 Min)  
      WinActivate
IfWinExist DBX (15 Min)  
      WinActivate
IfWinExist DBX (30 Min)  
      WinActivate
IfWinExist DBX (60 Min)  
      WinActivate 
IfWinExist VXX (1 Min)  
      WinActivate
IfWinExist VXX (3 Min)  
      WinActivate
IfWinExist VXX (10 Min)  
      WinActivate
IfWinExist VXX (15 Min)  
      WinActivate
IfWinExist VXX (30 Min)  
      WinActivate
IfWinExist VXX (60 Min)  
      WinActivate 
IfWinExist UVXY (1 Min)  
      WinActivate
IfWinExist UVXY (3 Min)  
      WinActivate
IfWinExist UVXY (10 Min)  
      WinActivate
IfWinExist UVXY (15 Min)  
      WinActivate
IfWinExist UVXY (30 Min)  
      WinActivate
IfWinExist UVXY (60 Min)  
      WinActivate
IfWinExist SVXY (1 Min)  
      WinActivate
IfWinExist SVXY (3 Min)  
      WinActivate 
IfWinExist SVXY (10 Min)  
      WinActivate
IfWinExist SVXY (15 Min)  
      WinActivate
IfWinExist SVXY (30 Min)  
      WinActivate
IfWinExist SVXY (60 Min)  
      WinActivate 
IfWinExist DUST (1 Min)  
      WinActivate
IfWinExist DUST (3 Min)  
      WinActivate
IfWinExist DUST (10 Min)  
      WinActivate
IfWinExist DUST (15 Min)  
      WinActivate
IfWinExist DUST (30 Min)  
      WinActivate
IfWinExist DUST (60 Min)  
      WinActivate 
IfWinExist NUGT (1 Min)  
      WinActivate
IfWinExist NUGT (3 Min)  
      WinActivate
IfWinExist NUGT (10 Min)  
      WinActivate
IfWinExist NUGT (15 Min)  
      WinActivate
IfWinExist NUGT (30 Min)  
      WinActivate
IfWinExist NUGT (60 Min)  
      WinActivate 
IfWinExist FAZ (1 Min)  
      WinActivate
IfWinExist FAZ (3 Min)  
      WinActivate
IfWinExist FAZ (10 Min)  
      WinActivate
IfWinExist FAZ (15 Min)  
      WinActivate
IfWinExist FAZ (30 Min)  
      WinActivate
IfWinExist FAZ (60 Min)  
      WinActivate
IfWinExist FAS (1 Min)  
      WinActivate
IfWinExist FAS (3 Min)  
      WinActivate
IfWinExist FAS (10 Min)  
      WinActivate
IfWinExist FAS (15 Min)  
      WinActivate
IfWinExist FAS (30 Min)  
      WinActivate
IfWinExist FAS (60 Min)  
      WinActivate
IfWinExist LABU (1 Min)  
      WinActivate
IfWinExist LABU (3 Min)  
      WinActivate
IfWinExist LABU (10 Min)  
      WinActivate
IfWinExist LABU (15 Min)  
      WinActivate
IfWinExist LABU (30 Min)  
      WinActivate
IfWinExist LABU (60 Min)  
      WinActivate
IfWinExist LABD (1 Min)  
      WinActivate
IfWinExist LABD (3 Min)  
      WinActivate
IfWinExist LABD (10 Min)  
      WinActivate
IfWinExist LABD (15 Min)  
      WinActivate
IfWinExist LABD (30 Min)  
      WinActivate
IfWinExist LABD (60 Min)  
      WinActivate
IfWinExist HLF (10 Min)  
      WinActivate
IfWinExist HLF (15 Min)  
      WinActivate
IfWinExist HLF (30 Min)  
      WinActivate
IfWinExist HLF (60 Min)  
      WinActivate
IfWinExist USO (10 Min)  
      WinActivate
IfWinExist USO (15 Min)  
      WinActivate
IfWinExist USO (30 Min)  
      WinActivate
IfWinExist USO (60 Min)  
      WinActivate
IfWinExist SCO (10 Min)  
      WinActivate
IfWinExist SCO (15 Min)  
      WinActivate
IfWinExist SCO (30 Min)  
      WinActivate
IfWinExist SCO (60 Min)  
      WinActivate
IfWinExist DGAZ (1 Min)  
      WinActivate
IfWinExist DGAZ (3 Min)  
      WinActivate
IfWinExist DGAZ (10 Min)  
      WinActivate
IfWinExist DGAZ (15 Min)  
      WinActivate
IfWinExist DGAZ (30 Min)  
      WinActivate
IfWinExist DGAZ (60 Min)  
      WinActivate
IfWinExist UGAZ (1 Min)  
      WinActivate
IfWinExist UGAZ (3 Min)  
      WinActivate
IfWinExist UGAZ (10 Min)  
      WinActivate
IfWinExist UGAZ (15 Min)  
      WinActivate
IfWinExist UGAZ (30 Min)  
      WinActivate
IfWinExist UGAZ (60 Min)  
      WinActivate
IfWinExist DRIP (1 Min)  
      WinActivate
IfWinExist DRIP (3 Min)  
      WinActivate
IfWinExist DRIP (15 Min)  
      WinActivate
IfWinExist DRIP (60 Min)  
      WinActivate
IfWinExist GUSH (1 Min)  
      WinActivate
IfWinExist GUSH (3 Min)  
      WinActivate
IfWinExist GUSH (15 Min)  
      WinActivate
IfWinExist GUSH (60 Min)  
      WinActivate
IfWinExist JNUG (1 Min)  
      WinActivate
IfWinExist JNUG (3 Min)  
      WinActivate
IfWinExist JNUG (15 Min)  
      WinActivate
IfWinExist JNUG (60 Min)  
      WinActivate
IfWinExist JDST (1 Min)  
      WinActivate
IfWinExist JDST (3 Min)  
      WinActivate
IfWinExist JDST (15 Min)  
      WinActivate
IfWinExist JDST (60 Min)  
      WinActivate
IfWinExist UWT (1 Min)  
      WinActivate
IfWinExist UWT (3 Min)  
      WinActivate
IfWinExist UWT (15 Min)  
      WinActivate
IfWinExist UWT (60 Min)  
      WinActivate
IfWinExist DWT (1 Min)  
      WinActivate
IfWinExist DWT (3 Min)  
      WinActivate
IfWinExist DWT (15 Min)  
      WinActivate
IfWinExist DWT (60 Min)  
      WinActivate
IfWinExist SPXL (1 Min)  
      WinActivate
IfWinExist SPXL (3 Min)  
      WinActivate
IfWinExist SPXL (15 Min)  
      WinActivate
IfWinExist SPXL (60 Min)  
      WinActivate
IfWinExist SPXU (1 Min)  
      WinActivate
IfWinExist SPXU (3 Min)  
      WinActivate
IfWinExist SPXU (15 Min)  
      WinActivate
IfWinExist SPXU (60 Min)  
      WinActivate
IfWinExist TQQQ (1 Min)  
      WinActivate
IfWinExist TQQQ (3 Min)  
      WinActivate
IfWinExist TQQQ (15 Min)  
      WinActivate
IfWinExist TQQQ (60 Min)  
      WinActivate
IfWinExist SQQQ (1 Min)  
      WinActivate
IfWinExist SQQQ (3 Min)  
      WinActivate
IfWinExist SQQQ (15 Min)  
      WinActivate
IfWinExist SQQQ (60 Min)  
      WinActivate
IfWinExist SOXL (3 Min)  
      WinActivate
IfWinExist SOXL (15 Min)  
      WinActivate
IfWinExist SOXL (60 Min)  
      WinActivate
IfWinExist SOXS (1 Min)  
      WinActivate
IfWinExist SOXS (3 Min)  
      WinActivate
IfWinExist SOXS (15 Min)  
      WinActivate
IfWinExist SOXS (60 Min)  
      WinActivate
return
As you can see it's quite lengthy and I would have to add a whole lot of (Min) so if I do change then it would be OK but would like to simplify this if I can!

Thanks
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: winget, myList, list

17 May 2018, 10:04

I see.. Well as long as the window title contains a similarly repeating patterns, SetTitleMatchMode should be all you need.
For instance in the case of a window with DBX in it..

Code: Select all

SetTitleMatchMode, 2
#1::
IfWinExist DBX (
	WinActivate
;.......................
..should be enough to activate all windows beginning with the title DBX (

Give this a try and let me know if you still have issues.
geotabs
Posts: 15
Joined: 14 May 2018, 14:20

Re: winget, myList, list

17 May 2018, 10:28

TLM wrote:I see.. Well as long as the window title contains a similarly repeating patterns, SetTitleMatchMode should be all you need.
For instance in the case of a window with DBX in it..

Code: Select all

SetTitleMatchMode, 2
#1::
IfWinExist DBX (
	WinActivate
;.......................
..should be enough to activate all windows beginning with the title DBX (

Give this a try and let me know if you still have issues.
Thanks Ill give it a try and let you know!

Do you think it's possible to have a list script with all the symbols?

Thanks
geotabs
Posts: 15
Joined: 14 May 2018, 14:20

Re: winget, myList, list

17 May 2018, 10:43

TLM wrote:I see.. Well as long as the window title contains a similarly repeating patterns, SetTitleMatchMode should be all you need.
For instance in the case of a window with DBX in it..

Code: Select all

SetTitleMatchMode, 2
#1::
IfWinExist DBX (
	WinActivate
;.......................
..should be enough to activate all windows beginning with the title DBX (

Give this a try and let me know if you still have issues.
So this on only brings up the (3 MIN) 1 and the 15 MIN and 60 MIN don't come up
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: winget, myList, list  Topic is solved

17 May 2018, 11:19

The fact that SetTitleMatchMode works is a good sign.
Now you should be able to activate multiple windows from arrays containing the symbols and time intervals rather than having to manually enter them.
Something like this ( NOTE: the message box is only there to show you the given window title, it should be removed ):

Code: Select all

IntervalArray 	:= [ 3, 10, 30, 60 ]
SymbolArray 	:= [ "DB", "DBX", "VX", "VXX", "UVX", "UVXY", "SVX", "SVXY", "DUS", "DUST", "NUG", "NUGT", "FA", "FAZ", "FAS", "LAB", "LABU", "LABD", "HLF", "USO", "SCO", "DGA", "DGAZ", "UGA", "UGAZ", "DRI", "DRIP", "GUS", "GUSH", "JNU", "JNUG", "JDS", "JDST", "UW", "UWT", "DW", "DWT", "SPX", "SPXL", "SPXU", "TQQ", "TQQQ", "SQQ", "SQQQ", "SOX", "SOXL", "SOXS" ]

#1::
SetTitleMatchMode 2
For Each, Symbol in SymbolArray
{
	For Each, Interval in IntervalArray
	{
		WinTitle := Symbol " (" Interval " Min)"

		Msgbox % WinTitle ; For display purposes only. Remove this line!

		if WinExist( WinTitle )
		{
			WinActivate % WinTitle
		}
	} 
}

Return
The benefit of this approach is you can easily update/add to the symbols and or time intervals :)
geotabs
Posts: 15
Joined: 14 May 2018, 14:20

Re: winget, myList, list

17 May 2018, 11:54

TLM wrote:The fact that SetTitleMatchMode works is a good sign.
Now you should be able to activate multiple windows from arrays containing the symbols and time intervals rather than having to manually enter them.
Something like this ( NOTE: the message box is only there to show you the given window title, it should be removed ):

Code: Select all

IntervalArray 	:= [ 3, 10, 30, 60 ]
SymbolArray 	:= [ "DB", "DBX", "VX", "VXX", "UVX", "UVXY", "SVX", "SVXY", "DUS", "DUST", "NUG", "NUGT", "FA", "FAZ", "FAS", "LAB", "LABU", "LABD", "HLF", "USO", "SCO", "DGA", "DGAZ", "UGA", "UGAZ", "DRI", "DRIP", "GUS", "GUSH", "JNU", "JNUG", "JDS", "JDST", "UW", "UWT", "DW", "DWT", "SPX", "SPXL", "SPXU", "TQQ", "TQQQ", "SQQ", "SQQQ", "SOX", "SOXL", "SOXS" ]

#1::
SetTitleMatchMode 2
For Each, Symbol in SymbolArray
{
	For Each, Interval in IntervalArray
	{
		WinTitle := Symbol " (" Interval " Min)"

		Msgbox % WinTitle ; For display purposes only. Remove this line!

		if WinExist( WinTitle )
		{
			WinActivate % WinTitle
		}
	} 
}

Return
The benefit of this approach is you can easily update/add to the symbols and or time intervals :)
Thank you very much this one worked but this is how I got it to work!

Code: Select all

#1::
IntervalArray 	:= [ 1, 2, 3, 5, 10, 15, 30, 60 ]
SymbolArray 	:= [  "DBX",  "VXX",  "UVXY",  "SVXY",  "DUST",  "NUGT",  "FAZ", "FAS",  "LABU", "LABD", "HLF", "USO", "SCO",  "DGAZ",  "UGAZ",  "DRIP",  "GUSH",  "JNUG",  "JDST",  "UWT",  "DWT",  "SPXL", "SPXU",  "TQQQ",  "SQQQ",  "SOXL", "SOXS" ]
SetTitleMatchMode 2
For Each, Symbol in SymbolArray
{
	For Each, Interval in IntervalArray
	{
		WinTitle := Symbol " (" Interval " Min)"

		
		if WinExist( WinTitle )
		{
			WinActivate % WinTitle
		}
	} 
}

Return
I wonder if we used SymbolArray in the first try if that would have worked without the IntervalArray?
Thanks for the help TML
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: winget, myList, list

17 May 2018, 12:43

geotabs wrote:I wonder if we used SymbolArray in the first try if that would have worked without the IntervalArray?
Not without SetTitleMatchMode ;)
Glad everything is working for you. Feel free to ask if you have any further questions.
DRocks
Posts: 565
Joined: 08 May 2018, 10:20

Re: [SOLVED] winget, myList, list

17 May 2018, 23:11

Hey TLM,

I've tried this example for myself and adapted it to try creating a manual selected Window Manager and I am there now:
Do you think I'm using Arrays correctly? Or is it noob coded? I understand myself with repetitive lines on the iniwrite but is it good and efficient to go that way according to the pros?

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

;https://autohotkey.com/boards/viewtopic.php?f=5&t=49087

SetTitleMatchMode, RegEx
WinTitlesArray 	:= [  "AutoHotkey.Help",  "AHK.Studio",  "ahk_class Chrome_WidgetWin_1",  "WinSpy",  "ahk_class CabinetWClass"  ]
;KeyArray 	:= [ x, y, w, h ]


!#1:: ;Write to .ini
WinClose, WinTitleStats.ini
For Each, WinTitle in WinTitlesArray
{
	This_WinTitle := WinTitle
	IniDelete, WinTitleStats.ini, %This_WinTitle%
	if WinExist(This_WinTitle)
	{
		WinGetClass, ahk_class
		IniWrite, %ahk_class%, WinTitleStats.ini, %This_WinTitle%, ahk_class
		WinGetPos,x,y,w,h, %This_WinTitle%
		IniWrite, %x%, WinTitleStats.ini, %This_WinTitle%, x			
		IniWrite, %y%, WinTitleStats.ini, %This_WinTitle%, y
		IniWrite, %w%, WinTitleStats.ini, %This_WinTitle%, w
		IniWrite, %h%, WinTitleStats.ini, %This_WinTitle%, h
		WinGet, MinMax, MinMax
		IniWrite, %MinMax%, WinTitleStats.ini, %This_WinTitle%, MinMax
	}
}
WinActivate, Script Models ahk_class CabinetWClass
Run, WinTitleStats.ini,,max
Return





#1::
WinClose, WinTitleStats.ini
For Each, WinTitle in WinTitlesArray
{
	This_WinTitle := WinTitle
	if WinExist(This_WinTitle)
	{
		IniRead, Ini_MinMax, WinTitleStats.ini, %This_WinTitle%, MinMax
		if (Ini_MinMax = 1)
		{
			MsgBox, %This_WinTitle% %Ini_MinMax%
			WinMaximize, %This_WinTitle%
		}
		else if (Ini_MinMax = -1)
		{
			MsgBox, %This_WinTitle% %Ini_MinMax%
			WinMinimize, %This_WinTitle%
		}
		else if (Ini_MinMax = 0)
		{
			MsgBox, %This_WinTitle% %Ini_MinMax%
			IniRead, Ini_x, WinTitleStats.ini, %This_WinTitle%, x
			IniRead, Ini_y, WinTitleStats.ini, %This_WinTitle%, y
			IniRead, Ini_w, WinTitleStats.ini, %This_WinTitle%, w
			IniRead, Ini_h, WinTitleStats.ini, %This_WinTitle%, h
			WinGetPos,x,y,w,h, %This_WinTitle%
			WinGet, MinMaxBeforeScript, MinMax
			if (MinMaxBeforeScript != 0)
				WinRestore, %This_WinTitle%
			;WinActivate %This_WinTitle%
			if (x != Ini_x)
			{
				MsgBox, %This_WinTitle% x%x% Ini_x%Ini_x%
				WinMove,%This_WinTitle%,,%Ini_x%
			}
			if (y != Ini_y)
			{	
				MsgBox, %This_WinTitle% y%y% Ini_y%Ini_y%
				WinMove,%This_WinTitle%,,,%Ini_y%
			}
			if (w != Ini_w)
			{	
				MsgBox, %This_WinTitle% w%w% Ini_w%Ini_w%
				WinMove,%This_WinTitle%,,,,%Ini_w%
			}
			if (h != Ini_h)
			{
				MsgBox, %This_WinTitle% h%h% Ini_h%Ini_h%
				WinMove,%This_WinTitle%,,,,,%Ini_h%
			}
		}
	}
}
WinActivate, Script Models ahk_class CabinetWClass
Run, WinTitleStats.ini,,max
Return
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: [SOLVED] winget, myList, list

18 May 2018, 10:35

If you are parsing the array and the script is working that's good enough imo.
geotabs
Posts: 15
Joined: 14 May 2018, 14:20

Re: winget, myList, list

18 May 2018, 12:16

TLM wrote:
geotabs wrote:I wonder if we used SymbolArray in the first try if that would have worked without the IntervalArray?
Not without SetTitleMatchMode ;)
Glad everything is working for you. Feel free to ask if you have any further questions.
Hi TLM I have everything set up not but ran into a small problem that I can't figure out, when I run this script

Code: Select all

#2::
IntervalArray 	:= [ 1, 2, 3, 5, 10, 15, 30, 60 ]
SymbolArray 	:= [  "WEED",  "ABX.TO",  "TECK.B",  "DOL.TO",  "HMMJ",  "APH.TO",  "ACB",  "VET.TO",  "PPL",  "KEY.TO",  "DRG.TO",  "AFN",  "BEI.UN",  "EIF",   "CGX",  "SRU.UN",  "CIX",  "FN",  "ENF",  "SJR.UN",  "REI.UN",  "ALA",  "IPL",  "HR.UN",  "AD",  "ECI",  "CHE.UN",  "MTL",  "PZA",  "CUF.UN",  "BK.TO",  "AX.UN",  "BNE",  "PEY",  "RNW.UN",  "NWH.UN",  "CPG",  "HOT.UN",  "BDT",  "CBL",  "CJR.B"  ]
SetTitleMatchMode 2
For Each, Symbol in SymbolArray
{
	For Each, Interval in IntervalArray
	{
		WinTitle := Symbol " (" Interval " Min)"

		
		if WinExist( WinTitle )
		{
			WinActivate % WinTitle
		}
	} 
}

Return
It also activates this one

Code: Select all

#5::
IntervalArray 	:= [ 1, 2, 3, 5, 10, 15, 30, 60 ]
SymbolArray 	:= [  "$EURCAD",  "$GBPCAD",  "$USDCAD",  "$EURGBP"  ]
SetTitleMatchMode 2
For Each, Symbol in SymbolArray
{
	For Each, Interval in IntervalArray
	{
		WinTitle := Symbol " (" Interval " Min)"

		
		if WinExist( WinTitle )
		{
			WinActivate % WinTitle
		}
	} 
}

Return
Any Ideas why??

Thanks
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: [SOLVED] winget, myList, list

18 May 2018, 12:34

When the title match mode is set to 2, it will find any window containing the string.
So for instance both of these windows will be considered a match: some window title or 12345some window title890

If the symbol & the intervals are exactly the same as the window titles from start to end, switching to SetTitleMatchMode, 1 or 3 should fix this issue.
If not, you can use SetTitleMatchMode, RegEx with a needle pattern that resembles the window title.

For now, give 1 or 3 a try and let me know what happens :)
geotabs
Posts: 15
Joined: 14 May 2018, 14:20

Re: [SOLVED] winget, myList, list

18 May 2018, 12:59

TLM wrote:When the title match mode is set to 2, it will find any window containing the string.
So for instance both of these windows will be considered a match: some window title or 12345some window title890

If the symbol & the intervals are exactly the same as the window titles from start to end, switching to SetTitleMatchMode, 1 or 3 should fix this issue.
If not, you can use SetTitleMatchMode, RegEx with a needle pattern that resembles the window title.

For now, give 1 or 3 a try and let me know what happens :)
Setting the SetTitleMatchMode 1 works but it's strange as this is what I have now and the only one that does this is #2::, can you also use numbers higher than 3 for SetTitleMatchMode ?

Code: Select all

#1::
IntervalArray 	:= [ 1, 2, 3, 5, 10, 15, 30, 60 ]
SymbolArray 	:= [  "DBX",  "VXX",  "UVXY",  "SVXY",  "DUST",  "NUGT",  "FAZ", "FAS",  "LABU", "LABD", "HLF", "USO", "SCO",  "DGAZ",  "UGAZ",  "DRIP",  "GUSH",  "JNUG",  "JDST",  "UWT",  "DWT",  "SPXL", "SPXU",  "TQQQ",  "SQQQ",  "SOXL", "SOXS",  "TECL",   "TECS",   "TZA",   "TNA"  ]
SetTitleMatchMode 2
For Each, Symbol in SymbolArray
{
	For Each, Interval in IntervalArray
	{
		WinTitle := Symbol " (" Interval " Min)"

		
		if WinExist( WinTitle )
		{
			WinActivate % WinTitle
		}
	} 
}

Return

!1::
IntervalArray 	:= [ 1, 2, 3, 5, 10, 15, 30, 60 ]
SymbolArray 	:= [  "BABA",  "BIDU",  "FB",  "NVDA",  "TSLA",  "NFLX",  "AAPL", "AMZN"  ]
SetTitleMatchMode 2
For Each, Symbol in SymbolArray
{
	For Each, Interval in IntervalArray
	{
		WinTitle := Symbol " (" Interval " Min)"

		
		if WinExist( WinTitle )
		{
			WinActivate % WinTitle
		}
	} 
}

Return

#2::
IntervalArray 	:= [ 1, 2, 3, 5, 10, 15, 30, 60 ]
SymbolArray 	:= [  "WEED",  "ABX.TO",  "TECK.B",  "DOL.TO",  "HMMJ",  "APH.TO",  "ACB",  "VET.TO",  "PPL",  "KEY.TO",  "DRG.TO",  "AFN",  "BEI.UN",  "EIF",   "CGX",  "SRU.UN",  "CIX",  "FN",  "ENF",  "SJR.UN",  "REI.UN",  "ALA",  "IPL",  "HR.UN",  "AD",  "ECI",  "CHE.UN",  "MTL",  "PZA",  "CUF.UN",  "BK.TO",  "AX.UN",  "BNE",  "PEY",  "RNW.UN",  "NWH.UN",  "CPG",  "HOT.UN",  "BDT",  "CBL",  "CJR.B"  ]
SetTitleMatchMode 2
For Each, Symbol in SymbolArray
{
	For Each, Interval in IntervalArray
	{
		WinTitle := Symbol " (" Interval " Min)"

		
		if WinExist( WinTitle )
		{
			WinActivate % WinTitle
		}
	} 
}

Return

#5::
IntervalArray 	:= [ 1, 2, 3, 5, 10, 15, 30, 60 ]
SymbolArray 	:= [  "$EURCAD",  "$GBPCAD",  "$USDCAD",  "$EURGBP"  ]
SetTitleMatchMode 2
For Each, Symbol in SymbolArray
{
	For Each, Interval in IntervalArray
	{
		WinTitle := Symbol " (" Interval " Min)"

		
		if WinExist( WinTitle )
		{
			WinActivate % WinTitle
		}
	} 
}

Return
Thanks Again :)
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: [SOLVED] winget, myList, list

18 May 2018, 14:24

geotabs wrote:Setting the SetTitleMatchMode 1 works but it's strange as this is what I have now and the only one that does this is #2::, can you also use numbers higher than 3 for SetTitleMatchMode ?
It's most likely activating windows if the symbol is contained in their title.
There's no higher SetTitleMatchMode than 3 but there is RegEx mode that allows you to use advanced Regular Expressions as the matching pattern.

BTW AHk allows you to wrap parts of you script that repeat into functions.
For instance:

Code: Select all

#1::
IntervalArray 	:= [ 1, 2, 3, 5, 10, 15, 30, 60 ]
SymbolArray 	:= [  "DBX",  "VXX",  "UVXY",  "SVXY",  "DUST",  "NUGT",  "FAZ", "FAS",  "LABU", "LABD", "HLF", "USO", "SCO",  "DGAZ",  "UGAZ",  "DRIP",  "GUSH",  "JNUG",  "JDST",  "UWT",  "DWT",  "SPXL", "SPXU",  "TQQQ",  "SQQQ",  "SOXL", "SOXS",  "TECL",   "TECS",   "TZA",   "TNA"  ]

ActivateWindows( IntervalArray, SymbolArray, 2 )
Return

!1::
IntervalArray 	:= [ 1, 2, 3, 5, 10, 15, 30, 60 ]
SymbolArray 	:= [  "BABA",  "BIDU",  "FB",  "NVDA",  "TSLA",  "NFLX",  "AAPL", "AMZN"  ]

ActivateWindows( IntervalArray, SymbolArray, 2 )
Return


#2::
IntervalArray 	:= [ 1, 2, 3, 5, 10, 15, 30, 60 ]
SymbolArray 	:= [  "WEED",  "ABX.TO",  "TECK.B",  "DOL.TO",  "HMMJ",  "APH.TO",  "ACB",  "VET.TO",  "PPL",  "KEY.TO",  "DRG.TO",  "AFN",  "BEI.UN",  "EIF",   "CGX",  "SRU.UN",  "CIX",  "FN",  "ENF",  "SJR.UN",  "REI.UN",  "ALA",  "IPL",  "HR.UN",  "AD",  "ECI",  "CHE.UN",  "MTL",  "PZA",  "CUF.UN",  "BK.TO",  "AX.UN",  "BNE",  "PEY",  "RNW.UN",  "NWH.UN",  "CPG",  "HOT.UN",  "BDT",  "CBL",  "CJR.B"  ]

ActivateWindows( IntervalArray, SymbolArray, 2 )
Return


#5::
IntervalArray 	:= [ 1, 2, 3, 5, 10, 15, 30, 60 ]
SymbolArray 	:= [  "$EURCAD",  "$GBPCAD",  "$USDCAD",  "$EURGBP"  ]

ActivateWindows( IntervalArray, SymbolArray, 2 )
Return

ActivateWindows( IntervalArray, SymbolArray, Mode = 1 ) ; ActivateWindows( **Interval Array**, **Symbol Array**, **Title Match Mode** )
{
	SetTitleMatchMode % Mode
	For Each, Symbol in SymbolArray
	{
		For Each, Interval in IntervalArray
		{
			WinTitle := Symbol " (" Interval " Min)"
		
			if WinExist( WinTitle )
			{
				WinActivate % WinTitle
			}
		} 
	}
}
htms
DRocks
Posts: 565
Joined: 08 May 2018, 10:20

Re: [SOLVED] winget, myList, list

19 May 2018, 08:10

This last example is very nice TLM

thank you for your help it also helped me indirectly. This method allowed me to write my own Window manager for specific needs and its better than one I was evaluating worth 20USD!

thanks a bunch :)
geotabs
Posts: 15
Joined: 14 May 2018, 14:20

Re: [SOLVED] winget, myList, list

29 May 2018, 11:01

How would I add a 2nd IntervalArray for seconds and ticks
I tried this

Code: Select all

!1::
IntervalArray 	:= [ 1, 2, 3, 5, 10, 15, 30, 60 ]
SymbolArray 	:= [  "BABA",  "BIDU",  "FB",  "NVDA",  "TSLA",  "NFLX",  "AAPL", "AMZN"  ]
SetTitleMatchMode 2
For Each, Symbol in SymbolArray
{
	For Each, Interval in IntervalArray
	{
		WinTitle := Symbol " (" Interval " Min " Seconds)"

		
		if WinExist( WinTitle )
		{
			WinActivate % WinTitle
		}
	} 
}

Return
didn't work


then this

Code: Select all

!1::
IntervalArray 	:= [ 1, 2, 3, 5, 10, 15, 30, 60 ]
IntervalArray 	:= [ 1, 2, 3, 5, 10, 15, 30, 60 ]
SymbolArray 	:= [  "BABA",  "BIDU",  "FB",  "NVDA",  "TSLA",  "NFLX",  "AAPL", "AMZN"  ]
SetTitleMatchMode 2
For Each, Symbol in SymbolArray
{
	For Each, Interval in IntervalArray
	{
		WinTitle := Symbol " (" Interval " Min)"
                WinTitle := Symbol " (" Interval " Seconds)" 

		
		if WinExist( WinTitle )
		{
			WinActivate % WinTitle
		}
	} 
}

Return
This didn't work

This is how I was able to make it work

Code: Select all

!1::
IntervalArray 	:= [ 1, 2, 3, 5, 10, 15, 30, 60 ]
SymbolArray 	:= [  "BABA",  "BIDU",  "FB",  "NVDA",  "TSLA",  "NFLX",  "AAPL", "AMZN"  ]
SetTitleMatchMode 2
For Each, Symbol in SymbolArray
{
	For Each, Interval in IntervalArray
	{
		WinTitle := Symbol " (" Interval " Min)"
                		
		if WinExist( WinTitle )
		{
			WinActivate % WinTitle
		}
	} 
}
IntervalArray 	:= [ 1, 2, 3, 5, 10, 15, 30, 60 ]
SymbolArray 	:= [  "BABA",  "BIDU",  "FB",  "NVDA",  "TSLA",  "NFLX",  "AAPL", "AMZN"  ]
SetTitleMatchMode 2
For Each, Symbol in SymbolArray
{
	For Each, Interval in IntervalArray
	{
		WinTitle := Symbol " (" Interval " Seconds)"
                		
		if WinExist( WinTitle )
		{
			WinActivate % WinTitle
		}
	} 
}
Return
Is there a better way to code this so as to also add Ticks?

Thanks TLM :)
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: [SOLVED] winget, myList, list

29 May 2018, 20:42

DRocks wrote:thank you for your help it also helped me indirectly....
awezz :D!!
geotabs wrote:How would I add a 2nd IntervalArray
To extended the IntervalArray you'd do just that... add more values (non-elegant approach lol)

Code: Select all

IntervalArray 	:= [ 1, 2, 3, 5, 10, 15, 30, 60, 1, 2, 3, 5, 10, 15, 30, 60 ]
A simple array will parse based on the order of values while an object array will parse on the keyname so this should be fine for your usage.

Can you elaborated on `ticks`?
geotabs
Posts: 15
Joined: 14 May 2018, 14:20

Re: [SOLVED] winget, myList, list

30 May 2018, 09:29

geotabs wrote:How would I add a 2nd IntervalArray
To extended the IntervalArray you'd do just that... add more values (non-elegant approach lol)

Code: Select all

IntervalArray 	:= [ 1, 2, 3, 5, 10, 15, 30, 60, 1, 2, 3, 5, 10, 15, 30, 60 ]
A simple array will parse based on the order of values while an object array will parse on the keyname so this should be fine for your usage.

This didn't work! I think I need to add Seconds some where in the code to work just don't know where?

Can you elaborated on `ticks`?[/quote]

You can plot a chart using Minutes, seconds or ticks. Minute and seconds are time based and ticks are based on traded.
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: [SOLVED] winget, myList, list

30 May 2018, 13:54

Okay then can you give an example of a window title that you're trying to activate with the different titles?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], ntepa and 117 guests