Is there a way to define variables so they can be used over multiple threads in the same script?
For example, suppose you define a rectangular area on your screen with the following dimensions:
xPos:=400, yPos:=300, Width:=3000, Height:=1500
Each of the following hotstring threads will move the active window to one of the four quadrants of that defined area.
Code: Select all
:*:mwlu:: ; Move Window Left-Upper
xPos:=400, yPos:=300, Width:=3000, Height:=1500
WinGetActiveTitle, title
WinMove, %Title%,, xPos, yPos, Width/2, Height/2
Return
:*:mwll:: ; Move Window Left-Lower
xPos:=400, yPos:=300, Width:=3000, Height:=1500
WinGetActiveTitle, title
WinMove, %Title%,, xPos, yPos+Height/2, Width/2, Height/2
Return
:*:mwru:: ; Move Window Right-Upper
xPos:=400, yPos:=300, Width:=3000, Height:=1500
WinGetActiveTitle, title
WinMove, %Title%,, xPos+Width/2, yPos, Width/2, Height/2
Return
:*:mwrl:: ; Move Window Right-Lower
xPos:=400, yPos:=300, Width:=3000, Height:=1500
WinGetActiveTitle, title
WinMove, %Title%,, xPos+Width/2, yPos+Height/2, Width/2, Height/2
Return
However, rather than having to include the variable values in each thread, is there a way to define them once and have each thread recognize them (ie something like this):
Code: Select all
xPos:=400, yPos:=300, Width:=3000, Height:=1500
:*:mwlu:: ; Move Window Left-Upper
WinGetActiveTitle, title
WinMove, %Title%,, xPos, yPos, Width/2, Height/2
Return
:*:mwll:: ; Move Window Left-Lower
WinGetActiveTitle, title
WinMove, %Title%,, xPos, yPos+Height/2, Width/2, Height/2
Return
:*:mwru:: ; Move Window Right-Upper
WinGetActiveTitle, title
WinMove, %Title%,, xPos+Width/2, yPos, Width/2, Height/2
Return
:*:mwrl:: ; Move Window Right-Lower
WinGetActiveTitle, title
WinMove, %Title%,, xPos+Width/2, yPos+Height/2, Width/2, Height/2
Return
Thanks