Is it possible to "Inject a button class" on a window?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
necomerx
Posts: 57
Joined: 01 Jan 2021, 09:09

Is it possible to "Inject a button class" on a window?

29 Jan 2021, 03:05

Hi everybody,
i have a question, i don't know if it is in the right section of the forum but feel free to move it mr the mods if it isn't.

Is it possible to create a button class on a button or parameter of a window application witch doesn't have one? I want the button class control and not a mouse type control or imagesearch or FindText, to be able to control the specific button or parameter even if it is out of the screen or if the window application is minimised. Let's take the exemple of the play button of windows media player for win 7 witch doesn't show or have a button class. Could it be possible with a script on any other application to create an "injected button class" so i could control it even if the player is reduced or the play button is not shown in the screen?
Thanks in advance for your replies.
Pepineros
Posts: 45
Joined: 16 Apr 2018, 17:26
Location: Ireland

Re: Is it possible to "Inject a button class" on a window?

29 Jan 2021, 03:48

I don't think this is possible. If a GUI button is not accessible by its name or ID or (in case of IE) through the DOM, there's not much AHK can do with it directly.

A workaround would be to bind a single hotkey to:
- activate and resize the window
- click the location of the button
- minimise the window
Which would only take a split second but it's not really an answer to your question. Just suggesting it as the only behaviour I can think of that kinda comes close.
necomerx
Posts: 57
Joined: 01 Jan 2021, 09:09

Re: Is it possible to "Inject a button class" on a window?

29 Jan 2021, 05:50

Thanks for your reply.
I know about that workaround, but was wondering if that could be possible even with another software or language than Autohotkey. That's unfortunate if that's not possible. I hope some programmer expert can enlighten us
AHKStudent
Posts: 1472
Joined: 05 May 2018, 12:23

Re: Is it possible to "Inject a button class" on a window?

29 Jan 2021, 06:17

necomerx wrote:
29 Jan 2021, 05:50
Thanks for your reply.
I know about that workaround, but was wondering if that could be possible even with another software or language than Autohotkey. That's unfortunate if that's not possible. I hope some programmer expert can enlighten us
with some programs including chrome you could do things via ACC.
necomerx
Posts: 57
Joined: 01 Jan 2021, 09:09

Re: Is it possible to "Inject a button class" on a window?

29 Jan 2021, 06:43

Thanks that's good to know. I'm gonna do some researches but when you say chrome, do you talk about Google Chrome or another application named like that? Can you explain us a little bit what's that ACC?
Rao Shaheryar
Posts: 2
Joined: 06 Jan 2021, 03:36

Re: Is it possible to "Inject a button class" on a window?

29 Jan 2021, 07:07

I read your then I researched that when after research to about my knowledge I have two buttons, both without links, and want to add a link to one when the other is clicked. How can I make one button with an onclick give a link attribute to something else on the page? If not a button, maybe a div
The following is my current code:
<div class="container">
<div class="jumbotron" style="background-color:#000000 !important;">
<img id="myImage" src="images/closed.png" style="width:100%">
<p id="texthere"></p>
<div class="container">
<div class="row">
<div class="col">
<button onclick="document.getElementById('myImage').src='images/open.png'" class="btn btn-primary active btn-block">Open Eyes</button>
</div>
<div class="col">
<button onclick="document.getElementById('myImage').src='images/closed.png'"class="btn btn-primary active btn-block">Close eyes</button>
</div>
</div>
</div>
Thank You!!
AHKStudent
Posts: 1472
Joined: 05 May 2018, 12:23

Re: Is it possible to "Inject a button class" on a window?

29 Jan 2021, 08:00

necomerx wrote:
29 Jan 2021, 06:43
Thanks that's good to know. I'm gonna do some researches but when you say chrome, do you talk about Google Chrome or another application named like that? Can you explain us a little bit what's that ACC?
Google Chrome

ACC lets you control windows well beyond what you could do with the standard built in AHK commands. For example, with ACC you could change chrome tabs even when its minimized, with ACC you could get data that controlgettext cannot etc.

Without knowing what app you are talking about, its really just theoretical as to what is possible.
necomerx
Posts: 57
Joined: 01 Jan 2021, 09:09

Re: Is it possible to "Inject a button class" on a window?

29 Jan 2021, 08:32

That's seems the way to go, thanks for your lights, I will investigate that ACC.
The applications that I want to control are mainly music softwares, somethings like mixers with many buttons that don't have any buttons class, only a main window (like FL Studio for example) or some music player like windows media player.
necomerx
Posts: 57
Joined: 01 Jan 2021, 09:09

Re: Is it possible to "Inject a button class" on a window?

29 Jan 2021, 09:21

Rao Shaheryar wrote:
29 Jan 2021, 07:07
I read your then I researched that when after research to about my knowledge I have two buttons, both without links, and want to add a link to one when the other is clicked. How can I make one button with an onclick give a link attribute to something else on the page? If not a button, maybe a div
The following is my current code:
<div class="container">
<div class="jumbotron" style="background-color:#000000 !important;">
<img id="myImage" src="images/closed.png" style="width:100%">
<p id="texthere"></p>
<div class="container">
<div class="row">
<div class="col">
<button onclick="document.getElementById('myImage').src='images/open.png'" class="btn btn-primary active btn-block">Open Eyes</button>
</div>
<div class="col">
<button onclick="document.getElementById('myImage').src='images/closed.png'"class="btn btn-primary active btn-block">Close eyes</button>
</div>
</div>
</div>
Thank You!!
I don't know if your question is for me, and I would like to help you but what your wrote is out of my knowledge

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], Mateusz53, MrHue, mstrauss2021, Rohwedder and 313 guests