jeeswg's objects tutorial (not yet complete)

Helpful script writing tricks and HowTo's
User avatar
jeeswg
Posts: 737
Joined: 19 Dec 2016, 01:58
Location: UK

jeeswg's objects tutorial (not yet complete)

14 Mar 2017, 21:55

==================================================

CONTENTS

;LINKS (DOCUMENTATION)
;LINKS (CASE SENSITIVE/CASE INSENSITIVE ARRAYS)
;LINKS (FURTHER)
;FUNCTIONS/COMMANDS
;FUNCTIONS/COMMANDS (MORE)
;FUNCTIONS/COMMANDS (NOTES)

[to come]
;AHK FILE OBJECT
;EXPLORER / EXPLORER WINDOWS
;INTERNET EXPLORER CONTROLS (INTERNET EXPLORER / HTML HELP)
;AHK OBJECTS/ARRAYS
;SCRIPTING.DICTIONARY OBJECT
;ACC LIBRARY (MSAA)
;FURTHER: HTM (WINHTTPREQUEST), HTM (HTMLFILE), IMAGES (WIA), MS EXCEL, MS WORD

==================================================

;LINKS (DOCUMENTATION)

A list of key object-related links:
Size of htm in KB on the left (based on decompiled chm file v1.1.24.04).

[summary of functions]
https://autohotkey.com/docs/AHKL_Features.htm
https://autohotkey.com/docs/commands/index.htm

[contain 'Obj' in file name][or in 'objects' folder]
[or pages with similar titles/related pages]
5 https://autohotkey.com/docs/misc/Arrays.htm
14 https://autohotkey.com/docs/objects/Object.htm
47 https://autohotkey.com/docs/Objects.htm

10 https://autohotkey.com/docs/objects/File.htm
7 https://autohotkey.com/docs/commands/FileOpen.htm
1 https://autohotkey.com/docs/commands/Func.htm
4 https://autohotkey.com/docs/objects/Func.htm
5 https://autohotkey.com/docs/objects/Functor.htm
2 https://autohotkey.com/docs/objects/Enumerator.htm

7 https://autohotkey.com/docs/commands/ComObjActive.htm
3 https://autohotkey.com/docs/commands/ComObjArray.htm
5 https://autohotkey.com/docs/commands/ComObjConnect.htm
1 https://autohotkey.com/docs/commands/ComObjCreate.htm
1 https://autohotkey.com/docs/commands/ComObjError.htm
2 https://autohotkey.com/docs/commands/ComObjFlags.htm
2 https://autohotkey.com/docs/commands/ComObjGet.htm
4 https://autohotkey.com/docs/commands/ComObjQuery.htm
4 https://autohotkey.com/docs/commands/ComObjType.htm
1 https://autohotkey.com/docs/commands/ComObjValue.htm
1 https://autohotkey.com/docs/commands/IsObject.htm
2 https://autohotkey.com/docs/commands/ObjAddRef.htm
0 https://autohotkey.com/docs/commands/ObjBindMethod.htm

[Catch,Finally,For,Try]
2 https://autohotkey.com/docs/commands/Catch.htm
3 https://autohotkey.com/docs/commands/Finally.htm
6 https://autohotkey.com/docs/commands/For.htm
4 https://autohotkey.com/docs/commands/Try.htm

[Throw]
3 https://autohotkey.com/docs/commands/Throw.htm

==================================================

;LINKS (CASE SENSITIVE/CASE INSENSITIVE ARRAYS)

case sensitive/case insensitive arrays (maintain key order, no key autosort) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=29198&p=137384#p137384

[case sensitive, alphabetical order array]
Object
https://autohotkey.com/docs/objects/Object.htm

[case insensitive, creation order array]
[AHK_L] For Loop in order of key-value pair creation - Ask for Help - AutoHotkey Community
https://autohotkey.com/board/topic/61792-ahk-l-for-loop-in-order-of-key-value-pair-creation/?p=389662

[case sensitive, alphabetical order array]
?

[case sensitive, creation order array]
Case sensitive variables possible? - Ask for Help - AutoHotkey Community
https://autohotkey.com/board/topic/61829-case-sensitive-variables-possible/
How make Associative array keys case sensitive - Ask for Help - AutoHotkey Community
https://autohotkey.com/board/topic/61840-how-make-associative-array-keys-case-sensitive/

==================================================

;LINKS (FURTHER)

COM Object Reference [AutoHotkey v1.1+] - Scripts and Functions - AutoHotkey Community
https://autohotkey.com/board/topic/56987-com-object-reference-autohotkey-v11/
COM Object Reference - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?t=77

[share an object between 2 scripts]
ObjRegisterActive - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?t=6148

[hotkeys with function object][Hotkey, If, % FunctionObject]
log hotkeys, get extended hotkey info, interact with the *right* window (Hotkey command with FunctionObject example) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=29560

[identify the object type][code to replicate the AHK v2 'Type' function in AHK v1]
AutoHotkey-Future/Type.ahk at master · cocobelgica/AutoHotkey-Future · GitHub
https://github.com/cocobelgica/AutoHotkey-Future/blob/master/Lib/Type.ahk
type(v) for v1.1 - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?t=2306

==================================================

;FUNCTIONS/COMMANDS

appear explicitly in the index: https://autohotkey.com/docs/commands/index.htm
Object() https://autohotkey.com/docs/Objects.htm ... ive_Arrays
Array() https://autohotkey.com/docs/Objects.htm#Usage
ComObjActive() https://autohotkey.com/docs/commands/ComObjActive.htm
ComObjArray() https://autohotkey.com/docs/commands/ComObjArray.htm
ComObjConnect() https://autohotkey.com/docs/commands/ComObjConnect.htm
ComObjCreate() https://autohotkey.com/docs/commands/ComObjCreate.htm
ComObjEnwrap() https://autohotkey.com/docs/commands/ComObjActive.htm
ComObjUnwrap() https://autohotkey.com/docs/commands/ComObjActive.htm
ComObjError() https://autohotkey.com/docs/commands/ComObjError.htm
ComObjFlags() https://autohotkey.com/docs/commands/ComObjFlags.htm
ComObjGet() https://autohotkey.com/docs/commands/ComObjGet.htm
ComObjMissing() https://autohotkey.com/docs/commands/ComObjActive.htm
ComObjParameter() https://autohotkey.com/docs/commands/ComObjActive.htm
ComObjQuery() https://autohotkey.com/docs/commands/ComObjQuery.htm
ComObjType() https://autohotkey.com/docs/commands/ComObjType.htm
ComObjValue() https://autohotkey.com/docs/commands/ComObjValue.htm
FileOpen() https://autohotkey.com/docs/commands/FileOpen.htm
Func() https://autohotkey.com/docs/commands/Func.htm
IsObject() https://autohotkey.com/docs/commands/IsObject.htm

don't appear explicitly in the index:
ComObject() https://autohotkey.com/docs/commands/ComObjActive.htm
ObjAddRef() https://autohotkey.com/docs/commands/ObjAddRef.htm
ObjBindMethod() https://autohotkey.com/docs/commands/ObjBindMethod.htm
ObjRawSet() https://autohotkey.com/docs/objects/Object.htm
ObjRelease() https://autohotkey.com/docs/commands/ObjAddRef.htm

also appear in index: (Catch,Finally,For,Try) (Throw)
note: deprecated: ComObjEnwrap,ComObjMissing,ComObjParameter,ComObjUnwrap
note: ComObj() does not appear anywhere in the documentation

==================================================

;FUNCTIONS/COMMANDS (MORE)

methods (equivalent functions):
Object
https://autohotkey.com/docs/objects/Object.htm
Each method also has an equivalent function, which can be used to bypass any custom behaviour implemented by the object

(IsFunc in AHK v1.1.24.05 confirms these as functions:)
(none of these appear explicitly in the index: https://autohotkey.com/docs/commands/index.htm)
ObjInsertAt / ObjRemoveAt
ObjPush / ObjPop
ObjDelete
ObjMinIndex / ObjMaxIndex / ObjLength
ObjSetCapacity / ObjGetCapacity
ObjGetAddress
ObjNewEnum
ObjHasKey
ObjClone
(ObjRawSet)

ObjInsert
ObjRemove

note: custom function:
ComVar() [see: https://autohotkey.com/docs/commands/ComObjActive.htm]

==================================================

;COMMANDS/FUNCTIONS (NOTES)

functions/variables involving arrays (not necessarily a complete list):
A_Args [AHK v2] [this looks like the other 'A_' variables, but is an array]
StrSplit
WinGetControls [AHK v2]
WinGetControlsHWND [AHK v2]
WinGetList [AHK v2]

ComObjMissing:
m := ComObjMissing() ;AHK v1
m := ComObject(0xA, 0x80020004) ;AHK v1/v2
from:
conversion logic, v1 = -> v1 := -> v2, two-way compatibility - Page 3 - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=37&t=27069&p=131336#p131336

functions that will be removed in AHK v2:
v2-changes
https://autohotkey.com/v2/v2-changes.htm

•ComObjMissing() (write two consecutive commas instead)
•ComObjUnwrap() (use ComObjValue() instead, and ObjAddRef() if needed)
•ComObjEnwrap() (use ComObject() instead, and ObjAddRef() if needed)
•ComObjXXX() where XXX is anything other than one of the explicitly defined ComObj functions (use ComObjActive() or ComObject() instead).

•ComObjParameter() -> ComObject()

==================================================

[to come]
;AHK FILE OBJECT

==================================================

[to come]
;EXPLORER / EXPLORER WINDOWS

[get file properties via object e.g. length (duration), image dimensions]
[uses ComObjCreate("Shell.Application") and GetDetailsOf]
FileGetProperties - Ask for Help - AutoHotkey Community
https://autohotkey.com/board/topic/63697-filegetproperties/

==================================================

[to come]
;INTERNET EXPLORER CONTROLS (INTERNET EXPLORER / HTML HELP)

Basic Webpage Controls with JavaScript / COM - Tutorial - Tutorials - AutoHotkey Community
https://autohotkey.com/board/topic/47052-basic-webpage-controls-with-javascript-com-tutorial/

==================================================

[to come]
;AHK OBJECTS/ARRAYS

[get key count]
For a normal AHK array to get its key count:
vCount := NumGet(&oArray + 4*A_PtrSize)
from:
ObjCount() or ObjLength() or ObjLen() - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=37&t=3950&p=21579#p21578

[custom classes]
Classes in AHK, Basic tutorial. - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=7&p=141395#p141395

[check if array contains string]
if Var in MatchList not working with array - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=30150
Checks if a value exists in an array - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?t=23286
More Simple Array Commands - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?t=7619
AHK_L - Contains/HasValue Method - Suggestions - AutoHotkey Community
https://autohotkey.com/board/topic/84006-ahk-l-containshasvalue-method/

[search/compare/edit arrays]
More Simple Array Commands - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?t=7619
Array/object wishlist (count, printarr, contains, other). - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=13&t=7101

==================================================

[to come]
;SCRIPTING.DICTIONARY OBJECT

COM Object Reference [AutoHotkey v1.1+] - Scripts and Functions - AutoHotkey Community
https://autohotkey.com/board/topic/56987-com-object-reference-autohotkey-v11/#entry357748

==================================================

[to come]
;ACC LIBRARY (MSAA)

Acc library (MSAA) and AccViewer download links - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?t=26201

==================================================

[to come]
;FURTHER: HTM (WINHTTPREQUEST), HTM (HTMLFILE), IMAGES (WIA), MS EXCEL, MS WORD

[function: Excel_Get]
[Excel_Get and 'Word_Get']
[get access to a specific Excel/Word window for use as an object]
excel and com? - Ask for Help - AutoHotkey Community
https://autohotkey.com/board/topic/73940-excel-and-com/#entry469769

[for MS Excel and MS Word]
MS Office COM Interface Constants - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=22&t=1672

MS Office COM Basics - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=7&t=8978

==================================================

Return to “Tutorials”

Who is online

Users browsing this forum: No registered users and 4 guests