[feat] pseudo-array
CoffeeChaton opened this issue · comments
pseudo-array
from #8-3
And I think this will be a tricky one, given that is an AHK-ism.
last
is marked as unused, while it is unused there is no value assigned to the variable, it just creates a pseudo-array (lastX
,lastY
,lastW
,lastH
).GuiControlGet last, Pos, ComboBox1 Gui Add, Edit, % "x" lastX " y" lastYFrom the top of my head, I can think of two other commands.
SysGet
is the same (mon
doesn't get a value):SysGet mon, Monitor OutputDebug % monRight "x" monBottom↓↓↓ stuff below are for context ↓↓↓
WinGet
while retrieving a list of windows does get a value:WinGet wList, List, A OutputDebug % wList1To be fair, that one can be scrapped as I never seen it used in other form than this one:
WinGet wList, List, A loop % wList { hWnd := "ahk_id" wList%A_Index% OutputDebug % hWnd }
ahk-v1.1 documentation, with OutputVar's own name (to form a pseudo-array), It seems that there is no unified signature like Out
or Output
, which is convenient for me to search from the original html code, i am try to use it c++ code to search pseudo-array
, but before that, if you can help me view the v1.1 document, maybe it will be a better way! Thanks!❤
I plan to manually add the above 3 rules to the parser, but I didn’t think of the built-in cmd also use a pseudo-array.
#define OUTPUT_VAR (*sArgVar) // ExpandArgs() has ensured this first ArgVar is always initialized, so there's never any need to check mArgc > 0.
pseudo-array
minimal repeat
GuiControlGet
and sub-cmd is Pos
#Requires AutoHotkey v1.1.33+
; https://www.autohotkey.com/docs/v1/lib/GuiControlGet.htm#Pos
; https://www.autohotkey.com/board/topic/72665-ahk-l-1151-problem-with-guicontrolget-outputvar-pos/
Gui Add, Tab, hwndhwTabCtrl
GuiControlGet last, Pos , %hwTabCtrl%
; last[0 of 0]:
; lastH[3 of 3]: number
; lastW[3 of 3]: number
; lastX[2 of 3]: number
; lastY[1 of 3]: number
ListVars
MsgBox % "observe ListVars"
SysGet
and sub-cmd is Monitor
or MonitorWorkArea
#Requires AutoHotkey v1.1.33+
; https://www.autohotkey.com/docs/v1/lib/SysGet.htm#Monitor
SysGet OutputVar, Monitor
; SysGet OutputVar, MonitorWorkArea
ListVars
; OutputVar[0 of 0]:
; OutputVarBottom[4 of 7]:
; OutputVarLeft[1 of 3]:
; OutputVarRight[4 of 7]:
; OutputVarTop[1 of 3]:
MsgBox % "observe ListVars"
WinGet
and sub-cmd is List
#Requires AutoHotkey v1.1.33+
; https://www.autohotkey.com/docs/v1/lib/WinGet.htm#List
WinGet OutputVar, List ; To retrieve all windows on the entire system, omit all four title/text parameters.
ListVars
; OutputVar[0 of 0]:
; OutputVar1[0 of 0]:
; OutputVar2[0 of 0]:
; OutputVar3[0 of 0]:
; ....
MsgBox % "observe ListVars"
TODO list
- Disable diagnosis
- hover at it
- goto-def
- find-all-ref
- Completion of it.
- semantic-highlight of it
- global-var vs local-var
- handle references
#Requires AutoHotkey v1.1.33+
#Warn All, MsgBox
Colors := "red,green,blue"
StringSplit, ColorArray, Colors, `,
ListVars
; Global Variables (alphabetical)
; --------------------------------------------------
; 0[1 of 3]: 0
; A_Args: Object object
; ColorArray0[1 of 3]: 3
; ColorArray1[3 of 3]: red
; ColorArray2[5 of 7]: green
; ColorArray3[4 of 7]: blue
; Colors[14 of 63]: red, green, blue
; ErrorLevel[1 of 3]: 0
MsgBox, % "text"
- find-all-ref
- global-var vs local-var
I don’t know how to implement it better