- Partly in preparation for an objects tutorial, and partly in preparation for looking at updating/creating scripts to backport the AHK v2 GUI/Menu objects to AHK v1. I've created a list of AHK object types and their methods/properties.
- It is intended as a companion to this thread:
list of every command/function/variable from across all versions - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=7&t=27321&p=131642#p131642
- Please mention any issues/omissions. Thanks.
==================================================
Lists of methods/properties(/keys/meta-functions) for different object types.
Code: Select all
Lists of methods/properties(/keys/meta-functions) for different object types.
[note: 'M' stands for method, 'P' stands for property, 'F' stands for function]
[note: Object: __Class property: in AHK v1, a standard key]
[note: Exception: 5 properties: in AHK v1, all standard keys]
[Object][AHK v1][function versions of methods]
F ObjClone
F ObjCount
F ObjDelete
F ObjGetAddress
F ObjGetCapacity
F ObjHasKey
F ObjInsertAt
F ObjLength
F ObjMaxIndex
F ObjMinIndex
F ObjNewEnum
F ObjPop
F ObjPush
F ObjRemoveAt
F ObjSetCapacity
[Object][AHK v1][further ObjXXX functions]
F ObjAddRef
F ObjBindMethod
F Object
F ObjRelease
[Object][AHK v1]
[note: in AHK v2, only M Clone is listed for Object]
F ObjRawGet
F ObjRawSet
F ObjGetBase
F ObjSetBase
M _NewEnum [deprecated]
M Clone
M Count [method deprecated, see property]
M Delete [see AHK v2 Array]
M GetAddress [deprecated]
M GetCapacity [deprecated]
M HasKey [deprecated, see Has]
M InsertAt [see AHK v2 Array]
M Length [method deprecated, see property]
M MaxIndex [deprecated]
M MinIndex [deprecated]
M Pop [see AHK v2 Array]
M Push [see AHK v2 Array]
M RemoveAt [see AHK v2 Array]
M SetCapacity [deprecated]
[Object][AHK v2]
F ObjClone
F ObjDeleteProp
F ObjGetBase
F ObjGetCapacity
F ObjHasOwnProp
F ObjHasProp
F ObjOwnMethods
F ObjOwnPropCount
F ObjOwnProps
F ObjRawGet [deprecated]
F ObjRawSet [deprecated]
F ObjSetBase
F ObjSetCapacity
M Clone
M DefineMethod
M DefineProp
M DeleteMethod
M DeleteProp
M GetMethod
M GetOwnPropDesc
M HasBase
M HasMethod
M HasOwnMethod
M HasOwnProp
M HasProp
M OwnMethods
M OwnProps
P Base
[Object: further]
M __Call
M __Delete
M __Get
M __Init [note: should not be used by the script]
M __New
M __Set
M Next [deprecated]
P __Class [note: created automatically by AHK]
P base
[note: deprecated: M Insert, M Remove]
[note: the 'further' list contains the methods not listed here: [url]https://autohotkey.com/docs/objects/Object.htm[/url]]
[Array Object]
M __Enum
M Clone
M Delete
M Has
M InsertAt
M Pop
M Push
M RemoveAt
P __Item
P Capacity
P Length
[BoundFunc Object]
M Call
[Buffer Object]
[note: removed: P Data]
P Ptr
P Size
[Class Object]
M New
P Prototype
[ClipboardAll Object]
[note: removed: P Data]
P Ptr
P Size
[Enumerator Object]
M Call
M Next [deprecated]
[Exception Object]
P Extra
P File
P Line
P Message
P What
[File Object]
[note: removed: M Tell, P __Handle, P Position]
M Close
M RawRead
M RawWrite
M Read
M ReadLine
M ReadXXX [XXX: UInt, Int, Int64, Short, UShort, Char, UChar, Double, Float]
M Seek
M Write
M WriteLine
M WriteXXX [XXX: UInt, Int, Int64, Short, UShort, Char, UChar, Double, Float]
P AtEOF
P Encoding
P Handle
P Length
P Pos
[Func Object]
M Bind
M Call
M IsByRef
M IsOptional
P IsBuiltIn
P IsVariadic
P MaxParams
P MinParams
P Name
[GUI Object]
[note: removed: M _NewEnum, M Cancel, M Options, P Menu]
M __Enum
M Add [or AddXXX][XXX: Text, Edit, UpDown, Picture, Button, Checkbox, Radio, DropDownList, ComboBox, ListBox, ListView, TreeView, Link, Hotkey, DateTime, MonthCal, Slider, Progress, GroupBox, Tab, StatusBar, ActiveX, Custom]
M Destroy
M Flash
M Hide
M Maximize
M Minimize
M OnEvent
M Opt
M Restore
M SetFont
M Show
M Submit
P BackColor
P ClientPos [ClientPos.X, ClientPos.Y, ClientPos.W, ClientPos.H]
P Control
P FocusedCtrl
P Hwnd
P MarginX
P MarginY
P MenuBar
P Name
P Pos [Pos.X, Pos.Y, Pos.W, Pos.H]
P Title
[GuiControl Object]
[note: removed: M Options]
M Add [ComboBox, DropDownList, ListBox, Tab][ListView, TreeView]
M Choose [ComboBox, DropDownList, ListBox, Tab]
M Delete [ComboBox, DropDownList, ListBox, Tab][ListView, TreeView]
M Focus
M Move
M OnEvent
M OnNotify
M Opt
M SetFont
M SetFormat [DateTime]
M SetIcon [StatusBar]
M SetParts [StatusBar]
M SetText [StatusBar]
M UseTab
P ClassNN
P Enabled
P Focused
P Gui
P Hwnd
P Name
P Pos [Pos.X, Pos.Y, Pos.W, Pos.H]
P Text
P Type
P Value [list of control types: [url]https://lexikos.github.io/v2/docs/objects/GuiControl.htm#Value[/url]]
P Visible
[GuiControl Object: further (listview/treeview)]
M DeleteCol [ListView]
M Get [TreeView]
M GetChild [TreeView]
M GetCount [ListView, TreeView]
M GetNext [ListView, TreeView]
M GetParent [TreeView]
M GetPrev [TreeView]
M GetSelection [TreeView]
M GetText [ListView, TreeView]
M Insert [ListView]
M InsertCol [ListView]
M Modify [ListView, TreeView]
M ModifyCol [ListView]
M SetImageList [ListView, TreeView]
[InputHook Object]
M KeyOpt
M Start
M Stop
M Wait
P BackspaceIsUndo
P CaseSensitive
P EndKey
P EndMods
P EndReason
P FindAnywhere
P InProgress
P Input
P Match
P MinSendLevel
P NotifyNonText
P OnChar
P OnEnd
P OnKeyDown
P Timeout
P VisibleNonText
P VisibleText
[Map Object]
M __Enum
M Clear
M Clone
M Delete
M Has
P __Item
P Capacity
P Count
[Menu/MenuBar Object]
M Add
M AddStandard
M Check
M Delete
M Disable
M Enable
M Insert
M Rename
M SetColor
M SetIcon
M Show
M ToggleCheck
M ToggleEnable
M Uncheck
P ClickCount
P Default
P Handle
[RegExMatch Object]
P Count
P Len
P Mark
P Name
P Pos
P Value [note: Match[N] is equivalent to Match.Value(N)]
[SafeArray]
M _NewEnum
M Clone
M MaxIndex
M MinIndex
Code: Select all
Type examples
[General]
String
Integer
Float
[Object]
Object
[Array Object]
Array
[BoundFunc Object]
BoundFunc
[Buffer Object]
Buffer
[Class Object]
e.g. MyClass [for a class instance]
Class [for a class object]
[ClipboardAll Object]
ClipboardAll
[Enumerator Object][pre-AHK v2-a104]
Object.Enumerator [for a built-in or custom object enumerator]
Gui.Enumerator [for a GUI object enumerator]
ComObjArray.Enumerator [for a SafeArray enumerator]
[Enumerator Object][post-AHK v2-a104]
Enumerator
[Exception Object]
Object [a built-in object]
[File Object]
File
[Func Object]
Func
[GUI Object]
Gui
[GuiControl Object]
Gui.Text
Gui.Edit
Gui.UpDown
Gui.Pic [not 'Gui.Picture']
Gui.Button
Gui.CheckBox [not 'Gui.Checkbox']
Gui.Radio
Gui.DDL [not 'Gui.DropDownList']
Gui.ComboBox
Gui.ListBox
Gui.ListView
Gui.TreeView
Gui.Link
Gui.Hotkey
Gui.DateTime
Gui.MonthCal
Gui.Slider
Gui.Progress
Gui.GroupBox
Gui.Tab
Gui.StatusBar
Gui.ActiveX
Gui.Custom
[note: if you apply oCtl.Type to an object, it returns one of the items above, minus the 'Gui' prefix]
[InputHook Object]
InputHook
[Map Object]
Map
[Menu/MenuBar Object]
Menu
MenuBar
[RegExMatch Object]
RegExMatch
[SafeArray]
ComObjArray
Code: Select all
;object get type
;[General]
var := "1"
MsgBox(Type(var)) ;String
var := 1
MsgBox(Type(var)) ;Integer
var := 1.0
MsgBox(Type(var)) ;Float
;[Object]
obj := {}
MsgBox(Type(obj)) ;Object
obj := Object()
MsgBox(Type(obj)) ;Object
;[Array Object]
obj := []
MsgBox(Type(obj)) ;Array
obj := Array()
MsgBox(Type(obj)) ;Array
;[BoundFunc Object]
fn := Func("StrLen").Bind()
MsgBox(Type(fn)) ;BoundFunc
;[Buffer Object]
obj := BufferAlloc(8)
MsgBox(Type(obj)) ;Buffer
;[Class Object]
obj := new MyClass
MsgBox(Type(obj)) ;MyClass
MsgBox(Type(MyClass)) ;Class
;[ClipboardAll]
obj := ClipboardAll()
MsgBox(Type(obj)) ;ClipboardAll
;[Enumerator Object][pre-AHK v2-a104]
;obj := {}._NewEnum()
;MsgBox(Type(obj)) ;Object.Enumerator
;obj := (new MyClass)._NewEnum()
;MsgBox(Type(obj)) ;Object.Enumerator
;obj := ObjNewEnum({})
;MsgBox(Type(obj)) ;Object.Enumerator
;obj := GuiCreate()._NewEnum()
;MsgBox(Type(obj)) ;Gui.Enumerator
;obj := ComObjArray(VT_VARIANT:=12, 3)._NewEnum()
;MsgBox(Type(obj)) ;ComObjArray.Enumerator
;[Enumerator Object][post-AHK v2-a104]
obj := [].__Enum()
MsgBox(Type(obj)) ;Enumerator
;obj := {}.__Enum() ;error
;MsgBox(Type(obj))
obj := Map().__Enum()
MsgBox(Type(obj)) ;Enumerator
;obj := (new MyClass).__Enum()
;MsgBox(Type(obj)) ;Object
obj := GuiCreate().__Enum()
MsgBox(Type(obj)) ;Enumerator
obj := ComObjArray(VT_VARIANT:=12, 3).__Enum()
MsgBox(Type(obj)) ;Enumerator
;[Exception Object]
obj := Exception("Error")
MsgBox(Type(obj)) ;Object
;MsgBox(obj.Message) ;Error
;[File Object]
obj := FileOpen(A_AhkPath, "r")
MsgBox(Type(obj)) ;File
;[Func Object]
fn := Func("StrLen")
MsgBox(Type(fn)) ;Func
;[GUI Object]
obj := GuiCreate()
MsgBox(Type(obj)) ;Gui
;[GuiControl Object]
obj2 := obj.Add("Edit")
MsgBox(Type(obj2)) ;Gui.Edit
;[GuiControl Object]
;GUI Object
;https://lexikos.github.io/v2/docs/objects/Gui.htm#Add
vList := "Text,Edit,UpDown,Picture,Button,Checkbox,Radio,DropDownList,ComboBox,ListBox,ListView,TreeView,Link,Hotkey,DateTime,MonthCal,Slider,Progress,GroupBox,Tab,StatusBar,ActiveX,Custom"
vOutput := ""
Loop Parse, vList, ","
{
if (A_LoopField = "ActiveX")
obj2 := obj.Add(A_LoopField,, "Shell.Explorer")
else if (A_LoopField = "Custom")
obj2 := obj.Add(A_LoopField, "ClassToolbarWindow32")
else
obj2 := obj.Add(A_LoopField)
vOutput .= Type(obj2) "`r`n"
}
MsgBox(vOutput)
;GuiText
;GuiEdit
;GuiUpDown
;GuiPic [not 'GuiPicture']
;GuiButton
;GuiCheckBox [not 'GuiCheckbox']
;GuiRadio
;GuiDDL [not 'GuiDropDownList']
;GuiComboBox
;GuiListBox
;GuiListView
;GuiTreeView
;GuiLink
;GuiHotkey
;GuiDateTime
;GuiMonthCal
;GuiSlider
;GuiProgress
;GuiGroupBox
;GuiTab
;GuiStatusBar
;GuiActiveX
;GuiCustom
;[InputHook Object]
obj := InputHook()
MsgBox(Type(obj)) ;InputHook
;[Map Object]
obj := Map()
MsgBox(Type(obj)) ;Map
;[Menu/MenuBar Object]
obj := MenuCreate()
MsgBox(Type(obj)) ;Menu
obj := MenuBarCreate()
MsgBox(Type(obj)) ;MenuBar
;[RegExMatch Object]
RegExMatch("", "", obj)
MsgBox(Type(obj)) ;RegExMatch
;[SafeArray]
obj := ComObjArray(VT_VARIANT:=12, 3)
MsgBox(Type(obj)) ;ComObjArray
class MyClass
{
}
;==================================================
;some COM objects
obj := ComObjCreate("InternetExplorer.Application")
MsgBox(Type(obj)) ;WebBrowser
obj.Quit()
obj := ComObjCreate("ADODB.Stream")
MsgBox(Type(obj)) ;Stream
obj := ComObjCreate("Excel.Application")
MsgBox(Type(obj)) ;Application
obj := ComObjCreate("HTMLFile")
MsgBox(Type(obj)) ;HTMLDocument
obj := ComObjCreate("Microsoft.Update.Session")
MsgBox(Type(obj)) ;UpdateSession
obj := ComObjCreate("SAPI.SpVoice")
MsgBox(Type(obj)) ;SpVoice
obj := ComObjCreate("Selenium.WebDriver")
MsgBox(Type(obj)) ;WebDriver
obj := ComObjCreate("Scripting.Dictionary")
MsgBox(Type(obj)) ;Dictionary
obj := ComObjCreate("Shell.Application")
MsgBox(Type(obj)) ;Shell
obj := ComObjCreate("WIA.ImageFile")
MsgBox(Type(obj)) ;ImageFile
obj := ComObjCreate("WinHttp.WinHttpRequest.5.1")
MsgBox(Type(obj)) ;WinHttpRequest
obj := ComObjCreate("Word.Application")
MsgBox(Type(obj)) ;Application
obj := ComObjCreate("MSXML2.DOMDocument.6.0")
MsgBox(Type(obj)) ;DOMDocument60
List:
Object
Array Object
BoundFunc Object
Buffer Object
Class Object
ClipboardAll Object
Enumerator Object
Exception Object
File Object
Func Object
GUI Object
GuiControl Object
InputHook Object
Map Object
Menu/MenuBar Object
RegExMatch Object
SafeArray
Links:
Object
https://lexikos.github.io/v2/docs/objects/Object.htm
Objects
https://lexikos.github.io/v2/docs/Objects.htm
Object - Methods & Properties | AutoHotkey v2
https://lexikos.github.io/v2/docs/objects/Object.htm
[Array Object]
Array Object - Methods & Properties | AutoHotkey v2
https://lexikos.github.io/v2/docs/objects/Array.htm
[BoundFunc Object]
Function Objects
https://lexikos.github.io/v2/docs/objects/Functor.htm#BoundFunc
[Buffer Object]
Buffer Object - Definition & Usage | AutoHotkey v2
https://lexikos.github.io/v2/docs/objects/Buffer.htm
[Class Object]
Class Object - Methods & Properties | AutoHotkey v2
https://lexikos.github.io/v2/docs/objects/Class.htm
[ClipboardAll Object]
Clipboard and ClipboardAll
https://lexikos.github.io/v2/docs/misc/Clipboard.htm#clipboardall-object
[Enumerator Object]
Enumerator
https://lexikos.github.io/v2/docs/objects/Enumerator.htm
[Exception Object]
Throw
https://lexikos.github.io/v2/docs/commands/Throw.htm#Exception
File Object
https://lexikos.github.io/v2/docs/objects/File.htm
Func Object
https://lexikos.github.io/v2/docs/objects/Func.htm
GUI Object
https://lexikos.github.io/v2/docs/objects/Gui.htm
GuiControl Object
https://lexikos.github.io/v2/docs/objects/GuiControl.htm
ListView (GUI)
https://lexikos.github.io/v2/docs/commands/ListView.htm#BuiltIn
TreeView (GUI)
https://lexikos.github.io/v2/docs/commands/TreeView.htm#BuiltIn
[InputHook Object]
InputHook - Syntax & Usage | AutoHotkey
https://lexikos.github.io/v2/docs/commands/InputHook.htm#object
[Map Object]
Map Object - Methods & Properties | AutoHotkey v2
https://lexikos.github.io/v2/docs/objects/Map.htm
Menu/MenuBar Object
https://lexikos.github.io/v2/docs/objects/Menu.htm
[RegExMatch Object]
RegExMatch
https://lexikos.github.io/v2/docs/commands/RegExMatch.htm#MatchObject
[SafeArray]
ComObjArray()
https://lexikos.github.io/v2/docs/commands/ComObjArray.htm
==================================================
See also:
[GuiControlGet/GuiControl sections]
v2-changes
https://autohotkey.com/v2/v2-changes.htm
ComObjType
https://lexikos.github.io/v2/docs/commands/ComObjType.htm
Type
https://lexikos.github.io/v2/docs/commands/Type.htm
==================================================
Relating to File.__Handle query:
[File.__Handle / File.Handle, which is available in which version]
Menu object - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=37&t=41973&p=191381#p191381
AutoHotkey v2 alpha (UPDATES) - Page 2 - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=37&t=2120&p=195810#p195810
==================================================
Relating to meta-functions query:
[which methods are meta-functions]
[unofficial source]
[it lists: __New, __Delete, __Get, __Set, __Call, __Init]
Classes in AHK, a Dissection (Advanced) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=7&t=6177
[contradictory information in the documentation]A meta-function is a class method that doesn't get explicitly called, but gets called when something happens to the object. Meta-functions are called from the base object not the instance.
Objects
https://lexikos.github.io/v2/docs/Objects.htm
[from an old version of the documentation, it suggests that all meta-functions are methods]Meta-functions define what happens when a key is requested but not found within the target object.
...
To run code when the last reference to an object is being released, implement the __Delete meta-function.
[re. the question: what is the overlap between meta-functions/methods]
Arrays of arrays and the [,,] operator. - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=278&p=2262#p2262
[from the AHK v1.1.28.00 source code, __New is a meta-function]Meta-functions are methods defined by an object's base which can define exactly how the object should act when an unknown key is requested.
[so meta-functions mentioned in official sources: __New, __Delete, __Get, __Set, __Call]
[EDIT:] Edits:// find and execute a specific meta-function (__new or __delete) but don't want any base
...
LPTSTR Object::sMetaFuncName[] = { _T("__Get"), _T("__Set"), _T("__Call"), _T("__Delete"), _T("__New") };
Menu.Standard -> Menu.AddStandard