Input a colour to change one word or phrase in HTML

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
RBBD
Posts: 20
Joined: 09 Apr 2021, 15:09

Input a colour to change one word or phrase in HTML

Post by RBBD » 30 Nov 2022, 12:02

Code: Select all

!k:: InputBox, OutputVar, Question 1, Colour? Send, <span style="color: %OutputVar%">%clipboard%</span>
Hoping to select a word or phrase and change it to the colour I input.

Thanx for any help!

User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: Input a colour to change one word or phrase in HTML

Post by mikeyww » 30 Nov 2022, 12:31

Hello,

InputBox and Send are different commands and so should appear on separate lines, also separate from the hotkey line, and then followed by Return.

RBBD
Posts: 20
Joined: 09 Apr 2021, 15:09

Re: Input a colour to change one word or phrase in HTML

Post by RBBD » 30 Nov 2022, 12:57

Trying:

Code: Select all

!k:: InputBox, OutputVar, Question 1, Colour? 
Send, <span style="color: %OutputVar%">%clipboard%</span>
return
Not working.

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

Re: Input a colour to change one word or phrase in HTML

Post by boiler » 30 Nov 2022, 13:08

As mikeyww said:
mikeyww wrote: InputBox and Send are different commands and so should appear on separate lines, also separate from the hotkey line, and then followed by Return.
You have to put the InputBox line on the line below the hotkey label because the way you have it, it is a single-line hotkey that executes only the command on the same line.

You may also need a Sleep to allow time for your window to become active again after the InputBox is dismissed before the text is sent. Or use WinActivate.

RBBD
Posts: 20
Joined: 09 Apr 2021, 15:09

Re: Input a colour to change one word or phrase in HTML

Post by RBBD » 30 Nov 2022, 13:29

Thanx, works great!

Post Reply

Return to “Ask for Help (v1)”