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
Anyone facing problems for "ControlSend"on bluestacks 4?
Re: Anyone facing problems for "ControlSend"on bluestacks 4?
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...
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...
Re: Anyone facing problems for "ControlSend"on bluestacks 4?
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
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%
}
Re: Anyone facing problems for "ControlSend"on bluestacks 4?
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.
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.
Re: Anyone facing problems for "ControlSend"on bluestacks 4?
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
Re: Anyone facing problems for "ControlSend"on bluestacks 4?
Btw, if you want more than one conditional line after an if or while etc., you have to use code blocks { }, like
Otherwise, only the next line after If will be executed conditionally... and the next lines after that will be executed in any case, unconditionally.
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
}
Re: Anyone facing problems for "ControlSend"on bluestacks 4?
ah ic! Thanks! shall update it
Re: Anyone facing problems for "ControlSend"on bluestacks 4?
Anw, I cant seem to revert to the earlier version of Bluestacks, they said that it is corrupted. ohwell
Re: Anyone facing problems for "ControlSend"on bluestacks 4?
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):
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 - not sure, what the problem is. I will investigate further.
Code: Select all
wintitle := "BlueStacks"
Space:: ; hit Space key
ControlFocus, , % wintitle
ControlSend, ,{Esc}, % wintitle
return
(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 - not sure, what the problem is. I will investigate further.
Re: Anyone facing problems for "ControlSend"on bluestacks 4?
Another attempt:
Please try pressing 1 and/or 2. Both should send Esc (for testing).
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
Who is online
Users browsing this forum: No registered users and 141 guests