AutoHotkey_L v1.1.00
#1
Posted 01 May 2011 - 04:42 AM
New features:
Implemented basic class definition syntax.
Implemented the new keyword for creating a derived object.
Added Func() for retrieving a reference to an existing function and improved IsFunc to recognize function references.
Added support for ++ and -- with object fields, such as x.y[z]++.
Changes:
Changed __Delete to not trigger __Call.
Changed OnClipboardChange to use AddClipboardFormatListener when available (i.e. on Windows Vista and later) to improve reliability.
Auto-concat with ( is more selective, so some invalid expressions like 12(34) will no longer work.
Fixes:
Fixed SetTimer Label, -0 to be treated as "run-once, very soon".
Fixed A_MyDocuments etc. to use SHGetFolderPath instead of undocumented registry keys.
Fixed non-empty ExcludeText causing windows with no text to be excluded.
If you found the old documentation for objects hard to follow, please give the new documentation a try.
Downloads (etc.)
#2
Posted 01 May 2011 - 05:44 AM
also, from this link:
<!-- m -->http://www.autohotke... ... _NewDelete<!-- m -->
1. perhaps you should note how an object can be destroyed with an example.
2. how is the variable this.ptr accesible to both functions? its not declared as a class member variable. (same Q for the this.RGB var in the Color class example)
thanks
#3
Posted 01 May 2011 - 05:56 AM
"meta-functions" link under Custom Objects is 404
this could probably use a code example (quoted from object Prototypes)
When thing.test() is called, thing is automatically inserted at the beginning of the parameter list. However, for backward-compatibility, this does not occur when a function is stored by name (rather than by reference) directly in the object (rather than being inherited from a base object). By convention, the function is named by combining the "type" of object and the method name.
#4
Posted 01 May 2011 - 07:19 AM
This is awesome!AddedFunc() for retrieving a reference to an existing function and improvedIsFunc to recognize function references
#5
Posted 01 May 2011 - 07:54 AM
Which part? I wrote that section to clear up any misconception a user might have about using this.base.base.Method() to invoke the super-class version of Method. (See for instance the first comment in finc's post and my response.)but i found the this.base.base stuff confusing in the object method section
You can't explicitly destroy an object. See Reference Counting.1. perhaps you should note how an object can be destroyed with an example.
Quite obviously, via this. As the documentation explains, this is a hidden function parameter (i.e. an ordinary variable) which typically contains a reference to the object. Any reference to any object can be used to retrieve values stored in that object.2. how is the variable this.ptr accesible to both functions?
That's completely irrelevant. The concept of member visibility does not apply to objects in AutoHotkey, which are basically just associative arrays. See below.its not declared as a class member variable.
Class variable declarations [...] do little more than storing a value in the class object.
Source: Objects - class vars
Thanks. I frequently forget the "#" when linking to a location within the same document."meta-functions" link under Custom Objects is 404
That paragraph applies directly to the example above it. If you're referring to the part "by name (rather than by reference)":this could probably use a code example (quoted from object Prototypes)
[*:3tx27owk]I'd prefer not to duplicate the example to show such a minor difference. "FuncName" is a function name, while Func("FuncName") returns a function reference. This should be obvious if you've read the Function References section.
[*:3tx27owk]The ability to use function names in objects should be considered deprecated, since the behaviour is inconsistent (as explained in that paragraph) and performance is worse than with function references. I'd prefer not to write any examples using deprecated functionality.
#6
Posted 01 May 2011 - 10:33 AM
Class is really nice
Thank you very much
#7
Posted 01 May 2011 - 02:34 PM
#8
Posted 01 May 2011 - 05:45 PM
The docs look much much better. I'm looking them over and starting to get some of the newer syntax.
#9
Posted 01 May 2011 - 05:53 PM
Thanks very much for improving OnClipboardChange - there goes all my workarounds out the window
We're just missing 1 thing from the "what can't AutoHotkey do?" thread - native toast support
; Purpose - new toast syntax ideas MakeToast, OutputToast, time, settings Toast := MakeToast(Time, settings, butter=false)Although with class syntax...
Thanks again for all your efforts Lexikos
#10
Posted 01 May 2011 - 10:39 PM
There's an update script included in the installer.Oh my, I need to make a script to auto-update _L!
#11
Posted 01 May 2011 - 10:41 PM
#12
Posted 03 May 2011 - 04:50 PM
Which part? I wrote that section to clear up any misconception a user might have about using this.base.base.Method() to invoke the super-class version of Method. (See for instance the first comment in finc's post and my response.)but i found the this.base.base stuff confusing in the object method section
yeah i got it now. reading that and also the latest comments in the Class Syntax thread helped
Quite obviously, via this. As the documentation explains, this is a hidden function parameter (i.e. an ordinary variable) which typically contains a reference to the object. Any reference to any object can be used to retrieve values stored in that object.2. how is the variable this.ptr accesible to both functions?
That's completely irrelevant. The concept of member visibility does not apply to objects in AutoHotkey, which are basically just associative arrays. See below.its not declared as a class member variable.
Class variable declarations [...] do little more than storing a value in the class object.
Source: Objects - class vars
would defining the class this way have any merit other than code readability and reader comprehension?
class GMem
{
[color=red] var ptr[/color]
__New(aFlags, aSize)
{
this.ptr := DllCall("GlobalAlloc", "uint", aFlags, "ptr", aSize, "ptr")
if !this.ptr
return ""
MsgBox % "New GMem of " aSize " bytes at address " this.ptr "."
}
__Delete()
{
MsgBox % "Delete GMem at address " this.ptr "."
DllCall("GlobalFree", "ptr", this.ptr)
}
}
#13
Posted 04 May 2011 - 06:25 AM
Generally no.would defining the class this way have any merit other than code readability and reader comprehension?
#14
Posted 04 May 2011 - 02:42 PM
#15
a4u
Posted 04 May 2011 - 06:34 PM
Very nice - though I just realized that this returns a Func Object. Should this be listed under objects in the the Help File?Added Func() for retrieving a reference to an existing function and improved IsFunc to recognize function references.




