AutoHotkey Community

It is currently May 27th, 2012, 1:18 pm

All times are UTC [ DST ]




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1036 posts ]  Go to page Previous  1 ... 52, 53, 54, 55, 56, 57, 58 ... 70  Next
Author Message
 Post subject:
PostPosted: September 12th, 2010, 2:08 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
Quote:
Revision 59 - September 12, 2010
  • Fixed: #If expression should now evaluate each expression at most once per keypress in all cases.
  • Changed: SplashImage uses common image-loading routines; now supports PNG and similar, but results may differ from before for icon files.
  • Added: For x,y in z.
  • Added: Loop .. Until expression, usable with any Loop or For-loop.
  • Added: Named loops; continue outer_loop, break 2, etc.
  • Debugger: Encode stdout and stderr packets as UTF-8.
  • Debugger: Allow user to Abort, Retry or Ignore when the initial connection fails.
  • Debugger: Allow attaching a debugger client by sending the script a registered window message.
  • Debugger: Allow detaching debugger client by sending the "detach" DBGp command.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2010, 3:37 pm 
Online
User avatar

Joined: May 5th, 2007, 7:24 pm
Posts: 1240
Location: Seville, Spain
Great release, a for loop was needed to improve readability of enumerations :)

PD: Dev S4AHK already supports the new constructs.

EDIT: This code gives truncation warnings when compiling the x64 build, the highlighted text is a fix:
Code:
// Debugger.h, line 130
   int Depth()
   {
      return (int)(mTop + 1 - mBottom);
   }

or even:
Code:
   INT_PTR Depth()
   {
      return mTop + 1 - mBottom;
   }


EDIT2: This too:
Code:
// script.cpp, line 4446
      int vars = 1;
      for (mark = (int)(in - action_args); mark > 0; --mark)
         if (action_args[mark] == g_delimiter)
            ++vars;

_________________
fincs
Highly recommended: AutoHotkey_L (see why) (all my code snippets require it)
Formal request to polyethene - I support the unity of the AutoHotkey community
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list]


Report this post
Top
 Profile  
Reply with quote  
 Post subject: AutoHotkey_L: New AHK
PostPosted: September 12th, 2010, 6:06 pm 
Offline

Joined: December 14th, 2005, 3:08 pm
Posts: 219
Does L have auto-scrolling menus by any chance?

The menu command produces arrows at the top and bottom of the menu when it gets long. But it doesn't auto-scroll when the mouse is over the end sections or if the mouse left click is held down when over either arrow.

If L doesn't have this feature, what does the author think about adding it?

:D


P.S.
Any chance the front page of this thread be kept up to date as most of the links there don't seem to work.

_________________
Stuart Halliday


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2010, 9:47 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5482
Location: the tunnel(?=light)
Fantastic additions of loop functionality, Lex. Your work is sincerely appreciated.

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2010, 10:47 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
fincs wrote:
EDIT: This code gives truncation warnings when compiling the x64 build,
Thanks for pointing them out.
quatermass wrote:
If L doesn't have this feature, what does the author think about adding it?
The author thinks this is not a Wish List thread. It can be done with MI_GetMenuHandle() and SetMenuInfo in any (32-bit?) build of AHK.
Quote:
Any chance the front page of this thread be kept up to date as most of the links there don't seem to work.
Not a chance in the world. Or maybe. Incidentally, eleven of the thirteen links were already working.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 13th, 2010, 12:20 am 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
Quote:
Revision 59 - September 12, 2010

Sooooo gooood release. :D

Here is the usual for loop:

Code:
for x in list(-4,4,3)
   msgbox % x


list(Start, End, Step=1) {
   r := Object()
   loop, % (End - Start + Step) // Step 
      r[Start+(A_Index-1)*Step] := ""
   return r
}


That is one of those things I wished I had around many times....

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 13th, 2010, 5:10 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
Note the list values don't need to be pre-calculated (though in this simple case pre-calculating might perform better):
Code:
for x in list(-4,4,3)
   msgbox % x

list(Start, End, Step=1) {
   static base := Object("_NewEnum", "list_enum", "Next", "list_next")
   return Object(1, Start-Step, 2, End, 3, Step, "base", base)
}
list_enum(list) {
   return list
}
list_next(list, ByRef var) {
   return (var := list[1] := list[1] + list[3]) <= list[2]
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 13th, 2010, 9:10 am 
Offline

Joined: April 14th, 2009, 10:40 am
Posts: 182
sinkfaze wrote:
... Your work is sincerely appreciated.

+1

@majkinetor & Lexikos : Thank you guys for your examples!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 13th, 2010, 9:49 am 
Offline

Joined: December 14th, 2005, 3:08 pm
Posts: 219
Lexikos wrote:
The author thinks this is not a Wish List thread. It can be done with MI_GetMenuHandle() and SetMenuInfo in any (32-bit?) build of AHK.


Oh I don't know. Looks like the only place discussing L. :D

And those two links don't mean anything to me.
How does one use SetMenuInfo in AHK then?


Quote:
Not a chance in the world. Or maybe. Incidentally, eleven of the thirteen links were already working.


I must have been unlucky then to have clicked on the 2 that didn't work.
Just seemed broken to me at first glance.

:D

_________________
Stuart Halliday


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 13th, 2010, 11:19 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
quatermass wrote:
How does one use SetMenuInfo in AHK then?
One searches the forums, then one posts in Ask for Help if one can't figure it out for oneself.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 13th, 2010, 6:31 pm 
Offline
User avatar

Joined: May 24th, 2009, 5:35 am
Posts: 2099
Location: Iowa, USA
Wow - amazing release! I'm beginning to run out of things I wish were implemented into AHK :D

Lexikos wrote:
I wrote:
Are there any plans to incorporate a built-in array object in the future?
No. What features should it have? FYI, Object started out as just an associative array.

Though it doesn't affect me much personally, I believe a simple array object would be more noobie-friendly. For instance, it could be restricted to positive, integer keys. Also, with the new For-loop, wouldn't it be more intuative for the user to write:
Code:
for item in array
... rather than:
Code:
for index,item in array
... , especially since with a simple array, the index would already be stored in A_Index?

EDIT - I should prolly retract the previous statement since the following could still be pretty intuitive:
Code:
For, Each, item in array

_________________
Image
Recommended: AutoHotkey_L
Basic Webpage Controls


Last edited by jethrow on September 20th, 2010, 4:29 pm, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 14th, 2010, 11:07 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
jethrow wrote:
For instance, it could be restricted to positive, integer keys.
I don't see that being of much benefit to anyone.
Quote:
Also, with the new For-loop, wouldn't it be more intuative for ...
That behaviour can be applied to temp01's Array library by adding "_NewEnum", "Array_NewEnum" to the ArrBase declaration and adding this to the script:
Code:
Array_NewEnum(arr){
   static base := Object("Next", "Array_Enum_Next")
   return Object(0, ObjNewEnum(arr), "base", base)
}

Array_Enum_Next(enum, ByRef item){
   return enum[0].Next(_, item)
}
Alternatively, a function can be written using the same method as my previous example:
Code:
arr := Object(1, "one", 2, "two", 4, "four")

for x in values(arr)
   MsgBox % x

values(obj) {
   static base := Object("_NewEnum", "values_enum", "Next", "values_next")
   return Object(0, ObjNewEnum(obj), "base", base)
}
values_enum(enum) {
   return enum
}
values_next(enum, ByRef var) {
   return enum[0].Next(_, var)
}
One could write an enumerator that returns array[1 .. array.MaxIndex()], including any in between which weren't set and therefore wouldn't normally be enumerated. I suppose that would be more intuitive for arrays.


I plan to add {key: value} and [value, value2, ...] syntax relatively soon and have been considering what to do with []. Some of the options are:
  1. Make it pure shorthand for Object(1, value, 2, value2, ...).
  2. As above, but set a common base object. This base object might implement the most basic behavioural changes needed to be intuitive, but could also be extended by script.
  3. Implement a simpler, faster and more memory-efficient array object. It might be strictly one-based, or flexible (arbitrarily-based). An item's location in memory would be directly calculated from its index; i.e. no key lookups. Arrays might have a common base object as in #2, but it would be invoked only by method-calls such as arr.concat(arr2), not get/set. Unlike #2, reassigning the base as in arr.base:=x would either be disallowed or would affect all arrays.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 14th, 2010, 12:12 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
Lex wrote:
Alternatively, a function can be written using the same method as my previous example:

Alternatively, you could allow key omittion:
Code:
for ,value in object


Quote:
I plan to add {key: value} and [value, value2, ...]

Why using different syntax ?

Code:
1. { key1: val1, .... keyN: valN } ; define everything yourself
2. {val1, ... valN} ; implies sequential ordering of keys starting form 1
3. {"key1": val1, val2, "key2": val3, val4} ; mixed, already defined number key is just skipped
4. {"key1":, "key2": .... } ;define only keys

Also, one could perhaps have advanced form of autonumbering:
Code:
{2:val1, val2, val3 ... } ; start counting from 2, a[3]=val2, a[4]=val3

This is problematic cuz of 3 but can be solved using some autonumbering metachar or somehing similar like 2{val1, val2, ... val3}.

Actually, you might want to see how it is defined in Lua if you already didn't: table initializers

About faster arrays, I think that is probably good thing to do altho I wouldn't give it high priority. Perhaps introducing special integrated base could serve for marking fast arrays (since you mentioned base might be read only after initialization).

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 14th, 2010, 1:19 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
majkinetor wrote:
Alternatively, you could allow key omittion:
That is bound to cause more confusion than it is worth, thanks to AutoHotkey's command syntax. Your example accidentally supports my argument:
Code:
for ,value in object
It's missing a comma. Since it would need for ,, value in object, may as well just do for _, value in object.
Quote:
Why using different syntax ?
Originally I had intended to use only [], leaving {} as invalid in an expression. After a lot of thinking over a substantial amount of time, I came to the conclusion that it will be far easier to implement if it is strictly key:value, key:value, etc. I think there's rarely a real need to mix numeric indices with other keys, and doing so often causes problems, particularly with enumeration.

Additionally, JSON has the advantage of familiarity; in that sense, the syntax you are proposing and the slightly different syntax I originally had in mind could be considered "different syntax".
Quote:
{"key1": val1, val2, "key2": val3, val4}
What is the practical application of mixing numbered and named keys in that way?
Quote:
{"key1":, "key2": .... }
Every key stored in an object must be associated with a value. Allowing "" to be omitted would mean a loss in error-detection with very little gain in convenience.
Quote:
{2:val1, val2, val3 ... }
To support mixing of keys, I think the most feasible implementation would convert the syntax to a sequence of "instructions", like (pseudo-code):
Code:
Object().@Set(2,val1).@Append(val2).@Append(val3)
...where @Set and @Append would perform the obvious action and return a reference to the target to allow chaining.
Quote:
This is problematic cuz of 3 but can be solved using some autonumbering metachar or somehing similar like 2{val1, val2, ... val3}.
You seem to be condemning "different" syntax and suggesting new and/or unusual (i.e. "different") syntax in the same breath...
Quote:
About faster arrays, I think that is probably good thing to do altho I wouldn't give it high priority.
I had been considering initially making [a,b] shorthand for Object(1,a,2,b), with the warning that certain functionality might be removed or changed in future; i.e. when I change to a more efficient, more conventional array implementation. So it might just be "different syntax" at first, but later it would reflect the different functionality.
Quote:
Perhaps introducing special integrated base could serve for marking fast arrays
I don't understand what you're suggesting or how it relates to the following statement:
Quote:
(since you mentioned base might be read only after initialization).
I said nothing to that effect in my previous post. I recall saying something like that about Object() a while back; i.e. Object("base",x,"y",z) could store z in .y without triggering the base object. Is that what you're talking about?

In my previous post, I said "it would be invoked only by method-calls"; in other words, arr.foo() would be equivalent to arr.base.foo(arr), but arr[n] would never trigger a meta-function regardless of what value n contains. In retrospect, arr[0]() should be allowed and should not trigger a meta-function, whereas arr.foo should trigger a meta-function since it cannot have any other purpose. It would've been better to suggest that any non-numeric key or name may trigger a meta-function and any numeric index may not.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 14th, 2010, 1:39 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
Quote:
I said nothing to that effect in my previous post. I recall saying something like that about Object() a while back; i.e. Object("base",x,"y",z) could store z in .y without triggering the base object. Is that what you're talking about?

No, I refer to your thoughts:
Quote:
3...... Unlike #2, reassigning the base as in arr.base:=x would either be disallowed or...



Quote:
You seem to be condemning "different" syntax and suggesting new and/or unusual (i.e. "different") syntax in the same breath...

I am throwing some ideas. It doesn't mean I totally digested them. Its not very wise to involve substantial effort in precise semantics if you don't think the proposition has its merits. I can always do so if you seem interested in idea.

Quote:
What is the practical application of mixing numbered and named keys in that way?

Fast Initialization of arrays obviously:
Code:
MyConstants := {1.2312, 2.123123, "pi":3.419", 0:0}


It could also be used for easier dynamic initialization of arrays based on some program input.

BTW, are you planning to support multidimensional initializers ?

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1036 posts ]  Go to page Previous  1 ... 52, 53, 54, 55, 56, 57, 58 ... 70  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group