Search found 454 matches
- 11 Dec 2018, 12:03
- Forum: Ask for Help (v2)
- Topic: AHK v2: converting/optimizing scripts Topic is solved
- Replies: 266
- Views: 48365
Re: Problems with objects and legacy syntax Topic is solved
Maybe we can shorten it a little? I optimized it a bit. Removed intermediate var o and made the whole calculation as a single operation: class obj{ str[_s]{ ;deref string get{ ;v:=["obj1.objN.key"] return(%(m:=StrSplit(_s,".")).RemoveAt(1)%[m*]) ;[m*] =variadic multi-dimentional } set{ ;["obj1.objN...
- 10 Dec 2018, 19:03
- Forum: Ask for Help (v2)
- Topic: AHK v2: question about enumerating
- Replies: 4
- Views: 908
Re: AHK v2: question about enumerating
well, as for now I ended up with the following: try a:=o.__Arr ;trying to get a unique key catch{ ;"Unknown property" exception means its a built-in inenumerable object t:=Type(o) t = Object type instead of object content to pretty-print my instanced classes and other global vars like this: https://...
- 10 Dec 2018, 13:59
- Forum: Ask for Help (v2)
- Topic: AHK v2: question about enumerating
- Replies: 4
- Views: 908
Re: AHK v2: question about enumerating
Because there is curretnly no difference. thank u for the quick reply! yeah, I've seen it in the documentation. I, for one, hate ambiguity in programming languages and can't wait for the moment Lexicos decides these two array types become different. He already removed <> operator (as duplicate for ...
- 10 Dec 2018, 13:39
- Forum: Ask for Help (v1)
- Topic: a few bugs?
- Replies: 5
- Views: 1448
- 10 Dec 2018, 13:20
- Forum: Ask for Help (v2)
- Topic: AHK v2: question about enumerating
- Replies: 4
- Views: 908
AHK v2: question about enumerating
1. R there new ways in AHK v2 to distinguish between [] and {} types of user-created objects? a:=0 for i in object ;throws exc here if its not an object or doesn't have _NewEnum() method. if(!(a:=i=A_Index)) ;a=0:associative (have pairs "key":value) or sparse array ([1,,3]) break so knowing which a...
- 07 Dec 2018, 12:07
- Forum: Ask for Help (v2)
- Topic: AHK v2: converting/optimizing scripts Topic is solved
- Replies: 266
- Views: 48365
Re: Problems with objects and legacy syntax Topic is solved
If you use one root object to store all the data you could access it all with the variadic parameter syntax. Good solution as well! We get rid of outdated %deref% syntax this way! It would be possible to wrap up all class prototypes and other globals, but that increases code size. Is it possible fo...
- 06 Dec 2018, 20:28
- Forum: Ask for Help (v2)
- Topic: AHK v2: converting/optimizing scripts Topic is solved
- Replies: 266
- Views: 48365
Re: Problems with objects and legacy syntax Topic is solved
just wow! U've come back with a really handy one
- 06 Dec 2018, 19:33
- Forum: Ask for Help (v2)
- Topic: AHK v2: converting/optimizing scripts Topic is solved
- Replies: 266
- Views: 48365
Re: Problems with objects and legacy syntax Topic is solved
You can wrap it in a function, too if you use it a lot. Here is the wrapped function as u suggested. :D Here we go into another trouble : when Name2Addr() returns the reference, that's not the original value's address: class a1 { static Key1:= "some string" static Key2:= "another string" class test...
- 06 Dec 2018, 19:12
- Forum: Ask for Help (v2)
- Topic: AHK v2: converting/optimizing scripts Topic is solved
- Replies: 266
- Views: 48365
Re: Problems with objects and legacy syntax Topic is solved
oif2003 , now I see parts* as a "variadic-dimensional" array, stupid me @ 3am =) A very handy cycle for dereffing nested objects! and it does work in v2 . But %objname% deref is still there. It was my afterthought 2nd question in the topic; do u have any ideas how to do it w/o deref? There r quite ...
- 06 Dec 2018, 18:45
- Forum: Ask for Help (v2)
- Topic: AHK v2: converting/optimizing scripts Topic is solved
- Replies: 266
- Views: 48365
Re: Problems with objects and legacy syntax Topic is solved
thx for ur feedback. yeah, ur weird code does work in AHK v2 but it makes things even more complicated. and we still use %deref% here. and tbh I don't get what is parts * - haven't they removed * (pointer operator) long time ago? :D PS: What I meant is need for some kind of built-in function to conv...
- 06 Dec 2018, 14:57
- Forum: Ask for Help (v2)
- Topic: AHK v2: converting/optimizing scripts Topic is solved
- Replies: 266
- Views: 48365
Re: a few bugs Topic is solved
Those are not bugs at all. I will move the post to the Ask for help forums. I see. But is there a way to get rid of %deref% syntax and use something like (I know * (pointer operator) was removed in AHK v2): for i,k in [a1.Key1, a1.Key2] ;array with prototype class members *k:="new value" Once again...
- 06 Dec 2018, 14:27
- Forum: Ask for Help (v2)
- Topic: AHK v2: converting/optimizing scripts Topic is solved
- Replies: 266
- Views: 48365
AHK v2: converting/optimizing scripts Topic is solved
We discuss multiple AHK v2 issues here. Converting from AHK v1.1, optiming for performance and code size. Chime in! page 1: using %% operator to deref "obj1.objN.key" stringified objects page ~5: super-optimized json in-out function. page 8: pretty-printing of stringified Float numbers. alternative...
- 06 Dec 2018, 12:44
- Forum: Ask for Help (v1)
- Topic: a few bugs?
- Replies: 5
- Views: 1448
Re: a few bugs
Regardless of the value of StartingPos, the return value is always relative to the first character of Haystack. For example, the position of "abc" in "123abc789" is always 4. Ah I see. :D Thank u for quick reply! I updated 1st post with the snippet and new screenshot. Old ListView focus position is...
- 06 Dec 2018, 12:39
- Forum: Ask for Help (v1)
- Topic: a few bugs?
- Replies: 5
- Views: 1448
a few bugs?
bug 1 I'm not sure if the bug exists in AHK v1.1. Negative StartingPos for InStr: msgbox(InStr("4111.3",".",,-1)) ;says [b]5[/b] instead of [b]2[/b] ;If StartingPos is negative, the search is conducted in reverse (right-to-left), ; starting at that position from the right. For example, -1 starts at...