Good morning everyone!
Okay, so I have a small issue that's been bugging me. I've been trying to automate more and more with AHK and so far, it's been wonderful. I've just been doing simple stuff so far.
Now I'm branching out and trying to see if I can automate copying cells from a google sheet, then using ahk to paste the data in different cells in the right way I want.
In other words, in both sheets, the data in the cells I need are there, they are just in the wrong order.! My solution was to:
1) Copy the data to a clipboard
2) Save that data into an array
3) Use AHK to rearrange the data in said array
4) Save that back into the clipboard
Then I could just press a button to paste everything in another sheet.
Right now, I'm stuck at part 2, I'm not sure how to do this.
an example of what I'm doing is here:
to
I'm just getting a line of info from some cells and then rearrange that. I've looked at some older posts but I can't find anything doing exactly what I want.
Clipboard to Array Topic is solved
-
- Posts: 8
- Joined: 21 Jun 2021, 09:49
-
- Posts: 1472
- Joined: 05 May 2018, 12:23
Re: Clipboard to Array Topic is solved
copy the items in excel then run this code and then go back and paste
Code: Select all
array := StrSplit(clipboard, a_tab)
Clipboard := array[2] a_tab array[4] a_tab array[1] a_tab array[3]
ExitApp
-
- Posts: 8
- Joined: 21 Jun 2021, 09:49
Re: Clipboard to Array
Thanks so much for this! This was exactly what I needed. I wasn't aware of the StrSplit command.AHKStudent wrote: ↑21 Jun 2021, 11:02copy the items in excel then run this code and then go back and paste
Code: Select all
array := StrSplit(clipboard, a_tab) Clipboard := array[2] a_tab array[4] a_tab array[1] a_tab array[3] ExitApp