Anyone facing problems for "ControlSend"on bluestacks 4?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
gchino
Posts: 5
Joined: 17 Mar 2019, 00:35

Anyone facing problems for "ControlSend"on bluestacks 4?

17 Mar 2019, 00:43

It seems that there is a problem with ControlSend for AHK on bluestacks 4. When my window is unfocussed, it could not detect the keys.

It was working on bluestacks 3N however after i upgraded it, this problem happened :(
gregster
Posts: 9068
Joined: 30 Sep 2013, 06:48

Re: Anyone facing problems for "ControlSend"on bluestacks 4?

17 Mar 2019, 02:21

Welcome to the forum,
I moved your topic to the proper subforum, 'Ask for Help'.
The 'Scripts and Functions' subforum is only for posting (non-trivial) working scripts and functions.

Probably the control names changed in the new Bluestacks version. I don't use the new version yet, but it might be helpful for potential helpers to post your (relevant) code. (Please use [code][/code] tags around it.)

You can try to check the control names with the WindowSpy.ahk script that is included with AHK.
Or, you might have to run your script 'as admin' now. It is even possible that they made bigger changes and Controlsend won't work any longer on BlueStacks4, but hard to say without actually testing it...
gchino
Posts: 5
Joined: 17 Mar 2019, 00:35

Re: Anyone facing problems for "ControlSend"on bluestacks 4?

17 Mar 2019, 02:53

Hi! Thanks for replying and helping me to shift it. :)
I've tried running it in admin and used the WindowSpy to check for the control as well. Nothing seem to be working on BS4.

Here's my code

Code: Select all

NP1:
Loop
{
	Random, Rdm, 1, 3 ;chooses the key to send
	Random, TRdm, 25, 200 ;chooses the delay between sends
	if Rdm = 1
		ControlSend,WindowsForms10.Window.8.app.0.1ca0192_r9_ad11,z,BlueStacks NoxPox1
	if Rdm = 2
		ControlSend,WindowsForms10.Window.8.app.0.1ca0192_r9_ad11,z,BlueStacks NoxPox1
		sleep, 100
		ControlSend,WindowsForms10.Window.8.app.0.1ca0192_r9_ad11,x,BlueStacks NoxPox1
		sleep, 100
		ControlSend,WindowsForms10.Window.8.app.0.1ca0192_r9_ad11,c,BlueStacks NoxPox1
		sleep, 100
		ControlSend,WindowsForms10.Window.8.app.0.1ca0192_r9_ad11,v,BlueStacks NoxPox1
	if Rdm = 3
		ControlSend,WindowsForms10.Window.8.app.0.1ca0192_r9_ad11,z,BlueStacks NoxPox1
		sleep, 100
		ControlSend,WindowsForms10.Window.8.app.0.1ca0192_r9_ad11,b,BlueStacks NoxPox1
	sleep, %TRdm%
}
gregster
Posts: 9068
Joined: 30 Sep 2013, 06:48

Re: Anyone facing problems for "ControlSend"on bluestacks 4?

17 Mar 2019, 03:00

I will probably update in the next few days... now, I don't have the right computer with me.
So, if no one can test it yet, I will come back to this. But I can't promise that I will make it work.
gchino
Posts: 5
Joined: 17 Mar 2019, 00:35

Re: Anyone facing problems for "ControlSend"on bluestacks 4?

17 Mar 2019, 03:03

Sure Gregster. Thank you so much! I'll prolly revert to the earlier version of bluestacks at the mean time i guess. Such a pity, BS4 performance is pretty good
gregster
Posts: 9068
Joined: 30 Sep 2013, 06:48

Re: Anyone facing problems for "ControlSend"on bluestacks 4?

17 Mar 2019, 03:04

Btw, if you want more than one conditional line after an if or while etc., you have to use code blocks { }, like

Code: Select all

if Rdm = 3
{
		ControlSend,WindowsForms10.Window.8.app.0.1ca0192_r9_ad11,z,BlueStacks NoxPox1
		sleep, 100
		ControlSend,WindowsForms10.Window.8.app.0.1ca0192_r9_ad11,b,BlueStacks NoxPox1
}
Otherwise, only the next line after If will be executed conditionally... and the next lines after that will be executed in any case, unconditionally.
gchino
Posts: 5
Joined: 17 Mar 2019, 00:35

Re: Anyone facing problems for "ControlSend"on bluestacks 4?

17 Mar 2019, 03:40

Anw, I cant seem to revert to the earlier version of Bluestacks, they said that it is corrupted. ohwell
gregster
Posts: 9068
Joined: 30 Sep 2013, 06:48

Re: Anyone facing problems for "ControlSend"on bluestacks 4?

24 Mar 2019, 06:55

Finally, I got around to update and I found that this seems to work, when BlueStacks 4 is not focussed (but not, if the window is minimized):

Code: Select all

wintitle := "BlueStacks"

Space::				; hit Space key
ControlFocus, , % wintitle
ControlSend, ,{Esc}, % wintitle
return 
I left the control parameter blank, so that the target window's topmost control will be used.
(I wasn't succesful with the control name BlueStacksApp1 which I determined via WindowSpy.ahk; the control you tried to use, called WindowsForms10.Window.8.app.0.1ca0192_r9_ad11, just seemed to shortly flash sometimes while loading and didn't work either)

The WinTitle always seemed to be just "BlueStacks" with all the apps I tested (not sure what NoxPox1 is... ?)

I hope this helps...

Edit: And now it stopped working :roll: - not sure, what the problem is. I will investigate further.
gregster
Posts: 9068
Joined: 30 Sep 2013, 06:48

Re: Anyone facing problems for "ControlSend"on bluestacks 4?

24 Mar 2019, 08:56

Another attempt:

Code: Select all

wintitle := "BlueStacks ahk_exe Bluestacks.exe"

1::				; hit 1
ControlFocus,WindowsForms10.EDIT.app.0.1ca0192_r6_ad11 , % wintitle
ControlSend,WindowsForms10.EDIT.app.0.1ca0192_r6_ad11 ,{Esc}, % wintitle
return 

2::					; hit 2
ControlFocus, , % wintitle
ControlSend, ,{Esc}, % wintitle
return
Please try pressing 1 and/or 2. Both should send Esc (for testing).

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 141 guests