list of every object type/property/method

Discuss the future of the AutoHotkey language
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

list of every object type/property/method

10 Feb 2018, 23:47

[updated: 2019-09-29]

- 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
List of object types for different objects as reported by the Type() function.

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
Script to retrieve the object type for different objects via the Type() function.

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
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.
[contradictory information in the documentation]
Objects
https://lexikos.github.io/v2/docs/Objects.htm
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.
[from an old version of the documentation, it suggests that all meta-functions are methods]
[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
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.
[from the AHK v1.1.28.00 source code, __New is a meta-function]
[so meta-functions mentioned in official sources: __New, __Delete, __Get, __Set, __Call]
// 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") };
[EDIT:] Edits:
Menu.Standard -> Menu.AddStandard
Last edited by jeeswg on 29 Sep 2019, 12:56, edited 30 times in total.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
nnnik
Posts: 4500
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: list of every object type/property/method

11 Feb 2018, 05:56

Also Next is not a Method for all objects - it's only available for Enumerator Objects.
Recommends AHK Studio
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: list of every object type/property/method

11 Feb 2018, 07:01

There are (at least) three types of built-in enumerator objects,

Code: Select all

Gui.Enumerator
ComObjArray.Enumerator
Object.Enumerator
User avatar
nnnik
Posts: 4500
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: list of every object type/property/method

11 Feb 2018, 08:24

I would add _NewEnum, __New,__Delete and __Init as Meta-Functions.
Without adding them the distinction between Meta-Functions and not Meta-Functions becomes pointless.
And yeah __Class is a key.
Recommends AHK Studio
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: list of every object type/property/method

11 Feb 2018, 10:29

- @Helgef: I've added BoundFunc, it appears to only have one method, Call.
- I meant to collect a list of types returned by the Type() function, I will look into that and update the OP. Thanks. [EDIT: Done. See OP. Do notify of any omissions. Cheers.]

- @nnnik: I've split the 'Object' list into two: those items on the 'Object' page, and 'further'. 'Next' is now in the 'further' list, I believe it's better in that list, than not listed as a method for standard objects at all.
- The documentation mentions __Delete as a meta-function. I'm unsure about __Init/__New, although they seem like strong candidates. I was more unsure about _NewEnum/Next.
- Thanks re. '__Class', I've removed the question mark.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
nnnik
Posts: 4500
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: list of every object type/property/method

11 Feb 2018, 19:36

With .next you mention something that does not even exist for every object. Why?
It is only part of the enumerators, not part of any normal object.
Writing it into further is just wrong.

A distinction between 2 groups exists because there are reasons for this distinction.
If you do not find things that are unique to a specific group then there is simply no reason for the existence then we should remove it.
In order to create any valueable distinction that holds any general value you either need to remove __Delete or add __New.
Since you want to stick to the documentation and keep __Delete you need to add __New which leaves __Init and _NewEnum.
Whether you mention __Init or not. But if you do mention it it should be in the same group as __New.
Which leaves us with _NewEnum. In order to decide whether _NewEnum is a Meta Function or not we should simply compare the differences between the 2 groups.

-Methods: Called by the programmer in explicit calls. Used to modify the state the object is in or gain information about it's state.
-Meta Functions: Called by AutoHotkey when specifics actions are taken on the object. Used by the programmer to completely modify the behaviour of an object when these actions are taken.
-_NewEnum: Mostly called by AutoHotkey when the for loop is used. Can be used to completely modify how the object is enumerated during a for loop. It is rarely called manually though it is difficult to define a single reason for doing so.

I think _NewEnum is a better fit for Meta Functions than Methods and if you disagree, it might be difficult to come up with an easy distinction between methods and meta functions.
Recommends AHK Studio
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: list of every object type/property/method

12 Feb 2018, 05:52

I agree with nnnik.

Code: Select all

[Object]
Object
e.g. MyClass [for a class instance]
Class [for a class object]
Specifically, it returns Class for an Object having a __class key. If an Object, say obj, lacks such a key it will report (recursively) obj.base.__class (or Object if not found.)

Code: Select all

Object.Enumerator [for a built-in or custom object enumerator]
Object.Enumerator is only returned for built-in enumerator unless you explicitly set obj.base.__class := "Object.Enumerator".
? P base
P for property is correct.
Extra, type() can return the name of a com class object, eg,

Code: Select all

ie := ComObjCreate("InternetExplorer.Application")
msgbox type(ie)
ie.quit()
Cheers

Edit, tried to clarify, on the phone. :?
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: list of every object type/property/method

14 Feb 2018, 02:30

- @nnnik: Re. 'Next'. The key question is: what built-in methods/properties are commonly redefined in custom AHK classes, 'Next' is one of them.
- Re. distinction. Built-in AHK methods/properties are listed, they are separated based on which are listed on the 'Object' documentation page.
- Re. meta-functions. I'm concerned that potentially any method can be considered a meta-function, if you can find a roundabout justification. It might be simpler to ignore _NewEnum and Next as special cases relating to enumeration, (you yourself mentioned a distinction between built-in methods that do/don't relate to enumerators,) and thus I would settle for the same 6 meta-functions as GeekDude did in his classes tutorial: 'CDGINS'.
- ... Although I might say overall, that the question of, which methods are meta-functions, doesn't really matter, the documentation appears to contradict itself, causing confusion, and new readers may be unsure of how important the distinction is, and may try to seek clarification (which could take a lot of time, and which would yield no definitive answers at present). If there was an official source that just said: these are the meta-functions, that could bring the matter to a satisfactory close.
- ... The concept of meta-functions is at least important though, as regards working with class objects directly, there may be other points.
- Out of interest, would you consider 'Next' a meta-function, or any of the other methods that don't start with '_'? What about base or __Class?
- It looks like meta-functions are under review:
v2-thoughts
https://autohotkey.com/v2/v2-thoughts.htm

- @Helgef: Good tips about checking for the __Class key. Important information, thanks.
- Is there any good evidence that __Class is a key, and that base is a property? Perhaps that __Class has a value and works with HasKey (so is a key), and that base doesn't, however, you can assign it in a get/set like manner and it doesn't use parentheses (implying a property).
- Thanks re. Type() and COM objects, I've added a few examples above.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
nnnik
Posts: 4500
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: list of every object type/property/method

14 Feb 2018, 03:42

No none of the other methods qualify - as you have already seen by my defintion. next simply does not qualify because it modifies the behaviour of an object other than its own.
The rest does not match the definition that I gave. You can argue that enumeration is not something that should be supported by every object - however in AutoHotkey every Object is a Map/Dictionary data type - and that data type gets enumerated.
Then again _NewEnum is the only method that does not directly interfere with the normal flow of information and it doesn't need to be defined in a base either but can be in the object itself - however same goes for __New and __Init
I would call .base a meta-property simply because it defines the base object. ( a sort of meta object ). __Class is a normal key.

I see that you are having troubles ordering things accordingly if objects grow too large - thats because you don't know of interfaces yet.
I would move __New, __Set, __Get and so on to a section named "class". next does not belong there and would only add confusion.

BTW in the Exception Object everything is a normal key. They are not properties.
Recommends AHK Studio
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: list of every object type/property/method

14 Feb 2018, 13:10

- Thanks re. the Exception object, I've corrected the OP to state keys instead of properties. Btw the documentation says 'properties', hence why I originally listed them as properties:
Throw
https://autohotkey.com/docs/commands/Throw.htm
Exception(Message [, What, Extra])

Creates an object with the following properties
- I've written some example code for checking whether something is a key or a property, here:
object classes: redefine __Set() temporarily / general queries - Page 4 - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 99#p200499

- Having trouble ordering what? In what way are interfaces significant?
- I've ordered everything in the OP by key/method/property, and I split any lists in the same way that the documentation did.
- I've dealt with raw interfaces where you call the methods in the verb tables directly (e.g. for Explorer), and simpler IDispatch interfaces, that AHK can handle directly e.g. COM with Internet Explorer/Excel/Word. So I'm not sure what you mean by 'don't know of interfaces yet'. Are you describing custom complex classes written in AHK as interfaces?
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
nnnik
Posts: 4500
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: list of every object type/property/method

14 Feb 2018, 17:28

jeeswg wrote:- Having trouble ordering what? In what way are interfaces significant?
- I've ordered everything in the OP by key/method/property, and I split any lists in the same way that the documentation did.
- I've dealt with raw interfaces where you call the methods in the verb tables directly (e.g. for Explorer), and simpler IDispatch interfaces, that AHK can handle directly e.g. COM with Internet Explorer/Excel/Word. So I'm not sure what you mean by 'don't know of interfaces yet'. Are you describing custom complex classes written in AHK as interfaces?
Interfaces are probably only second to Inheritance when it comes to importance in OOP.
Although there is no language representation of Interfaces in Autohotkey, any decent OOP object will use them for designing purposes.

An Interface is a set of methods or properties with specific names that do specific things to a type of object.
For example Push and Pop could be part of a Stack Interface. You know what Push and Pop does. And using it on this object will have specific effects.
This is important because now any object can support this interface and any code that was written for this interface can be used with such an object.
I will explain it in detail in the Advanced OOP Tutorial - for better examples you can have a look at Java.
Recommends AHK Studio
lexikos
Posts: 9553
Joined: 30 Sep 2013, 04:07
Contact:

Re: list of every object type/property/method

17 Feb 2018, 17:22

From an external/interface viewpoint, key-value pairs are a sub-type of properties. A property is just something you can get or set. The caller of an interface is not supposed to be concerned about how the property or method is implemented.

Meta-functions are not invoked like normal methods. They must be defined in the object's base, not in the object itself. If you call a method in script (or when for calls _NewEnum or Next), the __Call meta-function is invoked for that method call. This does not occur when a meta-function is invoked internally. However, this might only apply to v1.x and v2.0-alpha.

The distinction between meta-functions and normal methods should be easy, because all meta-functions are given an obvious prefix (this implies that standard methods are not given the prefix, not that the prefix has only this meaning).
nnnik wrote:Then again _NewEnum is the only method that does not directly interfere with the normal flow of information and it doesn't need to be defined in a base either but can be in the object itself - however same goes for __New and __Init
No, the same does not go for __New or __Init. When they are called by the new operator, they are called via the class object, not via the new instance. There is no way to define __Init in the object itself prior to it being called, but you can assign a value to this.__New without interfering with the __New meta-function.

Code: Select all

class C {
    ; __new := "foo"  ; Causes "Duplicate declaration."
    _ := this.__new := "foo"
    __new() {
        MsgBox "new"
    }
}
o := new C
MsgBox o.__new
If you call __New or __Init directly, they can be defined in the object itself, but the same is true for anything you call directly.
jeeswg wrote:[contradictory information in the documentation]
It could just as well have said "Methods define ..." and still been correct. It doesn't say all meta-functions.

On the other hand, it was probably written that way because __get/set/call were the only meta-functions at the time.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: list of every object type/property/method

17 Feb 2018, 17:59

- @lexikos: Many thanks for your detailed response.
- I read the documentation and thought: there are exactly 3 meta-functions, they are called when keys/methods aren't found. But your explanation makes a lot of sense. Also, changing(/declining) grammar standards in schools might lead people to miss meanings when older styles are used.
- Meta-functions have an obvious prefix (__Call/__Delete/__Get/__Init/__New/__Set), but what about __Class which has the same prefix (a meta-property?), base (a standard property?), _NewEnum (1 underscore to match Explorer objects perhaps, would it have 2 or 0 underscores otherwise).
- And not that it's crucially important, but, can any of the other methods, e.g. Next, be logically argued to be meta-functions? I.e. anything that you can find a way to invoke indirectly.

- I've changed my lists to use 'PK' (a property which is known to be a standard AutoHotkey array key) instead of 'K'.
- I've added the ClipboardAll Object to the list.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: list of every object type/property/method

25 Jul 2018, 17:29

Based on the comments and the sources listed above:
In my tutorial, I intend to list these as meta-functions:
__Call/__Delete/__Get/__Init/__New/__Set.

(I will probably also mention the difference between the documentation implying __Call/__Get/__Set, and other sources.)

I'm still curious about the best names for these:
- __Class (a meta-property?)
- base (a standard property?)
- _NewEnum (a meta-function?) (would it have 0 or 2 underscores if it didn't have to be consistent with existing COM objects)
- Next (arguably a meta-function?)
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
lexikos
Posts: 9553
Joined: 30 Sep 2013, 04:07
Contact:

Re: list of every object type/property/method

26 Jul 2018, 05:03

The best names for those things are the simplest ones; the ones you just used, which are also used in the documentation. Why add further (poorly-defined!) labels to them?

__Class is the name of a property.
base is the name of a property.
_NewEnum is the name of a method.
Next is the name of a method.

There is nothing special about the way that _NewEnum or Next are called by the for-loop; you can call them directly for the same effect. The for-loop is fairly simple syntax sugar.

Double-underscore does not mean "meta". It is simply used to avoid reserving names that the script might otherwise want to use.

I don't know why you think there's anything "meta" about __Class; it's just data. base, on the other hand, is closely tied to meta-functions and the behaviour/presence/definition of the object's methods and properties (including object.base itself!). But there is no other property like that, so just call it by its name.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: list of every object type/property/method

26 Jul 2018, 05:21

Thanks for your input.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “AutoHotkey Development”

Who is online

Users browsing this forum: No registered users and 44 guests