 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
olegbl
Joined: 13 Dec 2006 Posts: 48
|
Posted: Sat May 24, 2008 8:34 pm Post subject: |
|
|
I didn't look in depth at the code, however, if it takes a long time, that's normal. My library was built (so far) for functionality rather than speed. It IS very slow in some parts. It comes from it having to parse and unparse the same humongous string numerous times. If you look at your 100-element array, it's just one super-long, formatted string, meaning it takes a while to work with. That's a minus towards this system, but, well, there really isn't any other way to make single-variable arrays, at least until we get OOP, or in the very least pointer support.
PS. Sorry everyone that V6 is taking so long, I haven't had much time lately to work... |
|
| Back to top |
|
 |
newb Guest
|
Posted: Tue Jun 03, 2008 12:44 pm Post subject: |
|
|
Hi,
sorry for this stupid question..
how can i import your scrpt in my own..
i tried #include
but i stil get this error:
Call to nonexistent function.
Specifically: AHKA_NewArray()
---> 012: myArray := AHKA_NewArray() |
|
| Back to top |
|
 |
SoLong&Thx4AllTheFish
Joined: 27 May 2007 Posts: 4999
|
Posted: Tue Jun 03, 2008 2:46 pm Post subject: |
|
|
@newb:
Wild guess, place your include at the BOTTOM of your script. |
|
| Back to top |
|
 |
newb Guest
|
Posted: Tue Jun 03, 2008 4:30 pm Post subject: |
|
|
i tried
here is my complet test source-code:
myArray := AHKA_NewArray()
myArray := AHKA_Add(myArray, "Hello")
myArray := AHKA_Add(myArray, "World")
My2nd := AHKAGet(myArray,2)
msgbox %My2nd%
#include C:\Programme\Tools\AutoHotkey\Extras\Scripts\AHKArray.ahk |
|
| Back to top |
|
 |
SoLong&Thx4AllTheFish
Joined: 27 May 2007 Posts: 4999
|
Posted: Tue Jun 03, 2008 6:07 pm Post subject: |
|
|
@newb
1) use the code tags
2) use the proper function | Code: | myArray := AHKANewArray()
myArray := AHKAAdd(myArray, "Hello")
myArray := AHKAAdd(myArray, "World")
My1 := AHKAGet(myArray,1)
My2 := AHKAGet(myArray,2)
msgbox % My1 " " My2 | [/code] |
|
| Back to top |
|
 |
olegbl
Joined: 13 Dec 2006 Posts: 48
|
Posted: Tue Jun 03, 2008 10:35 pm Post subject: |
|
|
| Like HugoV said, the "AHKA_NewArray()" syntax is only for version 6 (which is still in alpha/beta, sorry guys, it'll be done soon...). Version 5, which is apparently what you're using ("AHKArray.ahk" rather than "AHKA.ahk"), uses "AHKANewArray()", so for now, refer to the documentation inside the post rather than the js (extjs) one I'm making for Version 6. Hope that fixes your problems. |
|
| Back to top |
|
 |
newb Guest
|
Posted: Wed Jun 04, 2008 12:28 pm Post subject: |
|
|
@ HugoV
thanks, it works  |
|
| Back to top |
|
 |
Dinky Island Guest
|
Posted: Mon Jun 16, 2008 7:48 pm Post subject: |
|
|
| Code: |
#Include AHKArray.ahk
stacks:= AHKANewArray() ; []
stacks:= AHKAAdd(stacks,2800) ; [2800]
stacks:= AHKAAdd(stacks,4700) ; [2800,4700]
stacks:= AHKAAdd(stacks,0) ; [2800,4700,0]
stacks:= AHKASort(stacks,2) ;[4700,2800,0]
Var:= AHKAGet(stacks,2) ; var=0
MsgBox %var%
ExitApp
|
the new sorted arrey looks like [4700,0,2800] instead of my expectation [4700,2800,0] |
|
| Back to top |
|
 |
SoLong&Thx4AllTheFish
Joined: 27 May 2007 Posts: 4999
|
Posted: Mon Jun 16, 2008 8:10 pm Post subject: |
|
|
Try with 1 & -1 | Code: | stacks:= AHKASort(stacks,1) ;[4700,2800,0]
stacks:= AHKASort(stacks,-1) ;[0,2800,4700] |
|
|
| Back to top |
|
 |
Dinky Island Guest
|
Posted: Mon Jun 16, 2008 8:25 pm Post subject: |
|
|
| Code: |
stacks:= AHKASort(stacks,1) ;returns this [2800,0,4700]
|
from the first page of this thread:
| Code: |
Var := AHKASort(Array,Type=1,Start=0,End=-1)
;If Type=0 Sorts and returns the array to Var, using different values for Start & End, this shouldn't be used
;If Type=1 Sorts the array from smallest to largest. Returns the sorted array to Var.
;If Type=2 Sorts the array from largest to smallest. Returns the sorted array to Var.
;If Type!={0,1,2} Returns the original array to Var.
;If Start=0 or Start=1, array is sorted from start
;If Start>0, array is sorted starting from position Start, indexes before Start are untouched
;If End=-1, array is sorted until the end
;If End>0, array is sorted until index End, indexes after End are untouched
;Current Implementation : QuickSort |
but it doesnt work like this at all |
|
| Back to top |
|
 |
SoLong&Thx4AllTheFish
Joined: 27 May 2007 Posts: 4999
|
Posted: Mon Jun 16, 2008 9:02 pm Post subject: |
|
|
Never actually used the sort but it does return the correct order I think:
| Code: | #Include AHKArray.ahk
stacks:= AHKANewArray() ; []
stacks:= AHKAAdd(stacks,2800) ; [2800]
stacks:= AHKAAdd(stacks,4700) ; [2800,4700]
stacks:= AHKAAdd(stacks,0) ; [2800,4700,0]
stacks:= AHKASort(stacks,1) ; results in 4700,2800,0
Var0:= AHKAGet(stacks,0) ;
Var1:= AHKAGet(stacks,1) ;
Var2:= AHKAGet(stacks,2) ;
MsgBox % var0 "," var1 "," var2 ; 4700,2800,0
ExitApp |
|
|
| Back to top |
|
 |
Dinky Island Guest
|
Posted: Mon Jun 16, 2008 9:24 pm Post subject: |
|
|
unfortuneatly it doesnt. if u fill ur array in different order then it wont work with your solution.
| Code: | #Include AHKArray.ahk
stacks:= AHKANewArray() ; []
stacks:= AHKAAdd(stacks,0) ; [0]
stacks:= AHKAAdd(stacks,2800) ; [0,2800]
stacks:= AHKAAdd(stacks,4700) ; [0,2800,4700]
stacks:= AHKASort(stacks,1) ; results in 4700,0,2800
Var0:= AHKAGet(stacks,0) ;
Var1:= AHKAGet(stacks,1) ;
Var2:= AHKAGet(stacks,2) ;
MsgBox % var0 "," var1 "," var2 ; 4700,0,2800
ExitApp |
not to mention if u use longer array. i couldnt figure out the logic behind it but it defenietly does not work properly. i hope oleg will look into it... |
|
| Back to top |
|
 |
neXt
Joined: 18 Mar 2007 Posts: 505
|
Posted: Fri Jun 20, 2008 6:29 pm Post subject: |
|
|
this is sweet!
What's with your site? It's all under construction. |
|
| Back to top |
|
 |
neXt
Joined: 18 Mar 2007 Posts: 505
|
Posted: Fri Jun 20, 2008 7:19 pm Post subject: |
|
|
I don't understand how to use it.
How do i create/read multidimensional arrays? Your documentation is practically blank. |
|
| Back to top |
|
 |
olegbl
Joined: 13 Dec 2006 Posts: 48
|
Posted: Sun Jun 22, 2008 4:14 pm Post subject: |
|
|
Sorry for the long time non-reply, I was on vacation, without a pc...
For the sort function to work, you would have to use the beta of version 6.
However, I still haven't finished the documentation for the version 6. (I have more done than is published but, no done yet)
So, here's the trick.
Use version 5 for now.
To have the sort work, simply download v6 beta and copy-paste the code the AHKA_Sort() function into the v5 replacing the AHKASort() function. Then rename it AHKASort() [as opposed to AHKA_Sort()] to make it consistent with v5 format.
Sorry it's taking so long, making a proper documentation must be the most annoyingly repetitive thing i've ever done in my life... But I'll get it done.
@neXt :
Use version 5, and documentation on this site, rather than the new one.
@HugoV :
@Dinky Island :
I'm pretty sure the quicksort in version 6 works, I've tested it quite a bit. Try to copy-paste it into version 5 as described above. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|