Probably Easy. Change column variable?

Get help with using AutoHotkey and its commands and hotkeys
User avatar
eblanc
Posts: 71
Joined: 08 May 2019, 14:41

Probably Easy. Change column variable?

10 Jul 2019, 12:56

I have a long script, that will pull info from COM EXCEL, I won't get you guys bored with all the numbers here. But here's the simplified problem I'm trying to solve.

Code: Select all

%Cam1::
Combojget= "Excel file"
send, excel value from("B2").value
send, excel value from("B4").value
send, excel value from("B8").value
send, excel value from("B10").value
send, excel value from("B12").value
Cam 1 pulls data from column "B"

I would like to do something like
%cam2 pulls data from column "C"
%cam3 pulls data from column "D"
%cam4 pulls data from column "E"

So I'm guessing I should make the column value a variable, But I'm not sure how I would link it?
User avatar
TheDewd
Posts: 1449
Joined: 19 Dec 2013, 11:16
Location: USA

Re: Probably Easy. Change column variable?

10 Jul 2019, 13:45

You want something like this?

Code: Select all

#SingleInstance, Force

XL := ComObjActive("Excel.Application")

F1::
	XLGetValues("B")
return

F2::
	XLGetValues("C")
return

F3::
	XLGetValues("D")
return

F4::
	XLGetValues("E")
return

XLGetValues(Column) {
	Global XL

	Send, % XL.Range(Column "2").Value
	Send, % XL.Range(Column "4").Value
	Send, % XL.Range(Column "8").Value
	Send, % XL.Range(Column "10").Value
	Send, % XL.Range(Column "12").Value
}
Image Bulldozer - Sokoban inspired game from 1994 recreated in AutoHotkey.

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], CotswoldsMaker, downstairs, mikeyww, necomerx, songdg, Vaklev and 48 guests