Jump to content


Photo

AutoHotkey_L v1.1.00


  • Please log in to reply
17 replies to this topic

#1 Lexikos

Lexikos
  • Administrators
  • 8856 posts

Posted 01 May 2011 - 04:42 AM

1.1.00.00 (May 1)

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 guest3456

guest3456
  • Members
  • 1338 posts

Posted 01 May 2011 - 05:44 AM

new docs are better, i am grasping the whole objects thing a lot more than last time. but i found the this.base.base stuff confusing in the object method section

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 guest3456

guest3456
  • Members
  • 1338 posts

Posted 01 May 2011 - 05:56 AM

more docs comments:

"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 shajul

shajul
  • Members
  • 571 posts

Posted 01 May 2011 - 07:19 AM

AddedFunc() for retrieving a reference to an existing function and improvedIsFunc to recognize function references

This is awesome!

#5 Lexikos

Lexikos
  • Administrators
  • 8856 posts

Posted 01 May 2011 - 07:54 AM

but i found the this.base.base stuff confusing in the object method section

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.)

1. perhaps you should note how an object can be destroyed with an example.

You can't explicitly destroy an object. See Reference Counting.

2. how is the variable this.ptr accesible to both functions?

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.

its not declared as a class member variable.

That's completely irrelevant. The concept of member visibility does not apply to objects in AutoHotkey, which are basically just associative arrays. See below.

Class variable declarations [...] do little more than storing a value in the class object.
Source: Objects - class vars

"meta-functions" link under Custom Objects is 404

Thanks. I frequently forget the "#" when linking to a location within the same document.

this could probably use a code example (quoted from object Prototypes)

That paragraph applies directly to the example above it. If you're referring to the part "by name (rather than by reference)":
[*: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 HotKeyIt

HotKeyIt
  • Fellows
  • 6134 posts

Posted 01 May 2011 - 10:33 AM

New docs are great :!:
Class is really nice :)
Thank you very much :D

#7 fragman

fragman
  • Members
  • 1591 posts

Posted 01 May 2011 - 02:34 PM

Very nice! I will use class syntax for new objects I'll create.

#8 Frankie

Frankie
  • Members
  • 2930 posts

Posted 01 May 2011 - 05:45 PM

Upgraded, thanks.

The docs look much much better. I'm looking them over and starting to get some of the newer syntax.

#9 nimda

nimda
  • Members
  • 4301 posts

Posted 01 May 2011 - 05:53 PM

Oh my, I need to make a script to auto-update _L! So many good things in every release :)
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 Lexikos

Lexikos
  • Administrators
  • 8856 posts

Posted 01 May 2011 - 10:39 PM

Oh my, I need to make a script to auto-update _L!

There's an update script included in the installer.

#11 nimda

nimda
  • Members
  • 4301 posts

Posted 01 May 2011 - 10:41 PM

:lol: my bad... I'll add it to startup...

#12 guest3456

guest3456
  • Members
  • 1338 posts

Posted 03 May 2011 - 04:50 PM

but i found the this.base.base stuff confusing in the object method section

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.)


yeah i got it now. reading that and also the latest comments in the Class Syntax thread helped

2. how is the variable this.ptr accesible to both functions?

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.

its not declared as a class member variable.

That's completely irrelevant. The concept of member visibility does not apply to objects in AutoHotkey, which are basically just associative arrays. See below.

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 Lexikos

Lexikos
  • Administrators
  • 8856 posts

Posted 04 May 2011 - 06:25 AM

would defining the class this way have any merit other than code readability and reader comprehension?

Generally no.

#14 tank

tank
  • Members
  • 4110 posts

Posted 04 May 2011 - 02:42 PM

Very nice

#15 a4u

a4u
  • Guests

Posted 04 May 2011 - 06:34 PM

Added Func() for retrieving a reference to an existing function and improved IsFunc to recognize function references.

Very nice - though I just realized that this returns a Func Object. Should this be listed under objects in the the Help File?