Sending Variables to consecutive cells in google sheets. Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Barnaby Ray
Posts: 45
Joined: 09 Nov 2021, 07:48

Sending Variables to consecutive cells in google sheets.

Post by Barnaby Ray » 27 May 2022, 15:06

Hi, can anyone help with this?

I have a list of variables I want to add into consecutive cells in google sheets document.
I've tried adding the variables to an array, then sending the array to the first cell in google sheets.
If I put `n between the variables, it adds the variables in consecutive cells going down, but how could I make it add them left to right?

Code: Select all


#SingleInstance Force
#Persistent
^+Y::
testArray := []
Thing1 = 12345
Thing2 = abcde
Thing3 = elephant

MsgBox, %Thing1% %Thing2% %Thing3%

data = %Thing1%`n %Thing2%`n %Thing3%`n
testArray.Push(data)

MsgBox, % testArray[1]
return

^+u::
send, % testArray[1]
return

ESC::ExitApp
Thanks


[Mod edit: Changed code box from .txt format to default .ahk format.]

User avatar
boiler
Posts: 16767
Joined: 21 Dec 2014, 02:44

Re: Sending Variables to consecutive cells in google sheets.

Post by boiler » 27 May 2022, 15:29

Try replacing `n with {Right}, which should send the right arrow key.

Also, don’t put a space after the `n (as you currently have it) or the {Right} unless you want to actually send a space character in addition to the contents of your variables.

Barnaby Ray
Posts: 45
Joined: 09 Nov 2021, 07:48

Re: Sending Variables to consecutive cells in google sheets.

Post by Barnaby Ray » 27 May 2022, 15:41

Thanks @boiler - Unfortunately that doesn't work.. it just sends them all together in the first cell like this:

12345abcdeelephant

Barnaby Ray
Posts: 45
Joined: 09 Nov 2021, 07:48

Re: Sending Variables to consecutive cells in google sheets.  Topic is solved

Post by Barnaby Ray » 27 May 2022, 15:44

Ah, it works with the Tab Key:

data = %Thing1%{Tab}%Thing2%{Tab}%Thing3%{Tab}

Thanks for the help! :)

User avatar
boiler
Posts: 16767
Joined: 21 Dec 2014, 02:44

Re: Sending Variables to consecutive cells in google sheets.

Post by boiler » 27 May 2022, 15:48

:thumbup:

I wonder why, though. {Right} works for me.

Barnaby Ray
Posts: 45
Joined: 09 Nov 2021, 07:48

Re: Sending Variables to consecutive cells in google sheets.

Post by Barnaby Ray » 27 May 2022, 16:29

Ah, it's because I had 'Enable compatible spreadsheet shortcuts' set to off. When that's set to on, the {Right} works as well.

Post Reply

Return to “Ask for Help (v1)”