toolbar-navigating macro doesn't work as function Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Pythagorean
Posts: 7
Joined: 26 Apr 2014, 22:33

toolbar-navigating macro doesn't work as function

23 Mar 2024, 18:24

I use a bunch of macros to select text & highlight color in Google Docs. They're repetitive, so I tried to condense them into a function, and I'm hoping someone can tell me why it doesn't work.

Here's the macro for blue text, which works fine:

Code: Select all

^+b::
		send !n					; extensions menu - gets focus into header
		sleep 100
		send {tab 3}{right 14}{enter}	; tabs move focus to toolbar, 14 steps right selects color palette
		sleep 100
		send {home}{down 6}{right 6}{enter}		; co-ordinates of the desired color
		return
As a function:

Code: Select all

^+b::
	colorPick(14,6,6)
	return
	
colorPick(toolbarX,paletteX,paletteY){
	send !n
	sleep 100
	send {tab 3}{right toolbarX}{enter}
	sleep 100
	send {home}{down paletteY}{right paletteX}{enter}
	}
The function doesn't open the palette, and seems to generate Undo, (move to beginning of line), Enter. As a hint towards explaining that, the macro does put focus on the Undo toolbar button before {right 14}. Thanks for any help!
User avatar
JoeWinograd
Posts: 2200
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: toolbar-navigating macro doesn't work as function  Topic is solved

23 Mar 2024, 18:57

Code: Select all

send {tab 3}{right %toolbarX%}{enter}
send {home}{down %paletteY%}{right %paletteX%}{enter}
Pythagorean
Posts: 7
Joined: 26 Apr 2014, 22:33

Re: toolbar-navigating macro doesn't work as function

23 Mar 2024, 19:41

Well of course - too literal, or not literal enough. Thanks!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Spawnova, TAC109 and 269 guests