 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
olegbl
Joined: 13 Dec 2006 Posts: 48
|
Posted: Fri Oct 31, 2008 5:21 pm Post subject: |
|
|
ClipboardAll is used to save data such as pictures, music, files, etc, and thus rather difficult to store as an array of strings.
If you would like to store a clipboard that only has text-data, you might as well use Clipboard instead of ClipboardAll.
Anyway, here's some quick untested code that should work:
| Code: |
arr := AHKA_NewArray();
Loop, parse, clipboard, `n, `r
{
arr := AHKA_Add(arr, A_LoopField);
}
|
Hope that helps.
EDIT:
And yes, it should be just as easy with SimpleArray. |
|
| Back to top |
|
 |
infogulch
Joined: 27 Mar 2008 Posts: 649
|
Posted: Mon Nov 03, 2008 6:15 pm Post subject: |
|
|
If you need to store binary data in an array you could use DerRaphael's [stdlib] A_Array - True Binary Arrays. It stores binary data directly in a variable. I'm not sure if it will work with ClipboardAll since it's handled in a special way, but you might be able to set a variable to the contents of ClipboardAll and pass the variable to the ByRef A_Set() function.
But if even that doesn't work, you could use my psuedo array library: [lib] pgArray - A solution for Manipulating AHK's Arrays _________________ Scripts - License |
|
| Back to top |
|
 |
animeaime
Joined: 04 Nov 2008 Posts: 1045
|
Posted: Sat Nov 08, 2008 5:23 am Post subject: Escape character instead of hexing |
|
|
Not sure if anyone mentioned this as an idea, but why don't you use escape characters?
Either use ` like AHK uses for default, or use \ like in some other programming languages.
This way you don't have to waste TONS of space converting everything to hex - since we are all used to escaping text.
If ` was the escape character
`[ would be a [
`] would be a ]
`| would be a |
`, would be a ,
`` would be a `
This way, less fuss, bet still able to use this amazing system.
So if the user has
"[12`[`,A,[1,2]]
The first element would be "12[,A"
The second element would be "[1,2]".
This solves the problem - if it still exists. Like I said, haven't read all the posts. _________________ As always, if you have any further questions, don't hesitate to ask.
Add OOP to your scripts via the Class Library. Check out my scripts. |
|
| Back to top |
|
 |
olegbl
Joined: 13 Dec 2006 Posts: 48
|
Posted: Sat Nov 08, 2008 6:55 am Post subject: |
|
|
This has been mentioned, but is redundant due to hexing, as that fixes this problem.
The whole library is basically obsolete now.
It is in perfectly working condition, but I will no longer work on it.
Instead, I might work on the Linked List I created (see the first post of this topic), in order for it to become a replacement.
Controls characters are actually used in SA (SimpleArray) (or will be soon), which is actually more effective than escaping everything anyway. |
|
| Back to top |
|
 |
JoeSchmoe
Joined: 17 Feb 2008 Posts: 303
|
Posted: Sat Jan 03, 2009 6:19 pm Post subject: |
|
|
Hi, olegbl, (or anyone else, as olegbl hasn't posted in a month and a half)
What do you mean by "The whole library is basically obsolete?" Do you mean that Infogulch's SimpleArray library renders it obsolete? I'd like to learn an array library, and I'm not sure which one to learn. (I want one that stores regular data in a string, so I've ruled out DerRaphael's A_Array and InfoGulch's pgArray.)
JS |
|
| Back to top |
|
 |
olegbl
Joined: 13 Dec 2006 Posts: 48
|
Posted: Sat Jan 03, 2009 7:16 pm Post subject: |
|
|
By obsolete I mean there's much more powerful (& fast) techniques for creating true arrays now than how AHKA does it. AHKA was built a while ago when some of these techniques simply weren't possible (or at least "invented" yet). For example, true binary arrays are perfectly possible now. (See http://www.autohotkey.com/forum/viewtopic.php?t=37512)
If you're just looking for an array lib. to use in another program I'd recommend InfoGulch's SimpleArray (http://www.autohotkey.com/forum/viewtopic.php?t=35041). |
|
| Back to top |
|
 |
m3 Guest
|
Posted: Mon Mar 09, 2009 10:06 pm Post subject: new_function |
|
|
Would like to see AHKA_DeleteDuplicates function ...
It would be great to have function that deletes the duplicate values from array and rebuilds its index ...
Thank you in advance. |
|
| Back to top |
|
 |
olegbl
Joined: 13 Dec 2006 Posts: 48
|
Posted: Mon Mar 09, 2009 11:17 pm Post subject: |
|
|
Sorry, AHKA is outdated and I no longer support it or work on it.
You can ask InfoGulch to add this function to his array library (http://www.autohotkey.com/forum/viewtopic.php?t=35041).
Here's a quick mockup though.
| Code: | index := 0
Loop
{
tempIndex := AHKA_Find(array, AHKA_Get(array, index), -1)
if (index != tempIndex)
{
array := AHKA_Remove(array, tempIndex)
index --
}
index ++
if (index > AHKA_Size())
break
} |
|
|
| Back to top |
|
 |
D3Z
Joined: 12 Oct 2009 Posts: 10
|
Posted: Mon Oct 19, 2009 3:47 pm Post subject: |
|
|
| i'd just like to use a 2 dim array to track x,y coords for a couple hundred mouse clicks. code would look more clean with a 2 dim array but i dont see how to do it. i can use to dif arrays for now. i see something to do with multi dim under utils in doc but no info. |
|
| Back to top |
|
 |
olegbl
Joined: 13 Dec 2006 Posts: 48
|
Posted: Mon Oct 19, 2009 4:45 pm Post subject: |
|
|
| Code: |
; Some x,y Coordinates For Testing
x1 := 1
y1 := 1
x2 := 3
y2 := -2
; Initialize
myArray := AHKA_NewArray()
; Adding First Ordered Pair
myOrderedPair := AHKA_NewArray()
myOrderedPair := AHKA_Add(myOrderedPair, x1)
myOrderedPair := AHKA_Add(myOrderedPair, y1)
myArray := AHKA_Add(myArray, myOrderedPair)
; Let's Add Another Value, Quicker
myArray := AHKA_Add(myArray, AHKA_NewArray("[" + x2 + "," + y2 + "]"))
; Let's Retrieve Some Values
x1g := AHKA_Get(myArray, 1, 1)
y1g := AHKA_Get(myArray, 1, 2)
x2g := AHKA_Get(myArray, 2, 1)
y2g := AHKA_Get(myArray, 2, 2)
|
Hope that helps.
P.S. The utility functions aren't documented since they're not meant to be used by the end-user anyway (they're internally used, and in a real programming language would be declared as private), and I'm too lazy to document them for a product I no longer work on. |
|
| Back to top |
|
 |
D3Z
Joined: 12 Oct 2009 Posts: 10
|
Posted: Mon Oct 19, 2009 8:11 pm Post subject: |
|
|
| ok i understand. burned out on this one ? working on anything else AHK related ? just curious. |
|
| Back to top |
|
 |
olegbl
Joined: 13 Dec 2006 Posts: 48
|
Posted: Mon Oct 19, 2009 11:36 pm Post subject: |
|
|
Well, this one simply became obsolete a couple of years ago with the invention of low_level, which allows you to have real data structures (linked lists, trees, etc), rather than parsed strings.
Not working on any AHK projects ATM. |
|
| Back to top |
|
 |
win9x supporter Guest
|
Posted: Tue Oct 20, 2009 11:25 am Post subject: |
|
|
| Not obsolete or useless. Some of use still have to make sure our scripts will work on Win9x boxes, and unfortunately, low_level will not work on those systems. |
|
| Back to top |
|
 |
olegbl
Joined: 13 Dec 2006 Posts: 48
|
Posted: Tue Oct 20, 2009 2:35 pm Post subject: |
|
|
| Haha, yes, I suppose for backwards-compatibility/support, AHKA would still be a choice. ^.^ |
|
| Back to top |
|
 |
mike643 Guest
|
Posted: Fri Dec 18, 2009 4:15 pm Post subject: |
|
|
Hi,
Is there any documentation available? |
|
| 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
|