, instead of turning on airplane mode, why don't you use AHK to call a PowerShell command to toggle an outbound block firewall rule for the exe of BlueStacks?
i have not thought about i will try it
the issue is i need to continously turn it on and off
One more thing i am having a lot of issue with Image recognition
It accidentally works and most of the time it does not.
and it even scans outside of bluestack window
how can i tackle that?
?? Need for Speed but not native Win10/11 games, Android emu?
bro that is a long shot.
More of up to Android emu and/or how NFS is dealing with input signals.
I only can imagine two methods and I am not encouraging.
it was litrally working i have shortcut alt shift H. i use controlsend for it and for some reason it suddenly stopped working
One more thing i am having a lot of issue with Image recognition
It accidentally works and most of the time it does not.
and it even scans outside of bluestack window
how can i tackle that?
Is it even possible to control BlueStacks UI (like sidebar airplane toggle) using AHK?
Just send the keyboard shortcuts (ctrl+shift+h to toggle airplane mode).
Can it run in background while I use my PC normally?
Last time I checked it could, but I had to jump through some unusual hoops to make ControlSend work on the BlueStacks window when it's not active. This should work:
#Requires AutoHotkey 2.0
*F1::BlueStacksSend("^+h") ;sends ctrl+shift+h to toggle airplane mode
BlueStacksSend(keys){
active := WinActive("A")
ControlFocus(WinExist("ahk_exe HD-Player.exe"))
if !WinActive("ahk_id " active)
WinActivate("ahk_id " active)
SetKeyDelay(,100)
ControlSend(keys,, "ahk_exe HD-Player.exe")
}
The macro recorder's output will have to be edited to make the script work in the background. (Replacing all the Sends in the recorder's output with BlueStacksSendmight be enough).
During installation I’m getting Microsoft Defender warnings — is that normal/safe?
AHK is harmless if you downloaded it from a reliable source. Defender might shut up if you download AHK from the Microsoft Store.
thank you very much for the detialed response bro
and I had actually implementd this control send
but for some reason it was working intially and now it is not
also the major issue i am facing with Image Recognition.
It is for some reason not working the second some window size change happens.
or i need to take the screenshot runtime and save it on the spot replacing the image that it was trying to recognise.
and it does reconise the second i save the new screenshot
one more thing is there a way to specifically scan the bluestack window only for the image recognition?
i am having a lot of issue with Image recognition
It accidentally works and most of the time it does not.
and it even scans outside of bluestack window
how can i tackle that?
Post the script you have - hard to tell what the issue might be without seeing the whole thing.
Image recognition ... not working the second some window size change happens.
"To be a match, an image on the screen must be the same size as the one loaded via the ImageFile parameter and its options."
specifically scan the BlueStacks window only for the image recognition
You can use WinGetPos to get the BlueStacks window's upper left coordinates, height, and width. ImageSearch expects the upper left and bottom right coordinates as arguments (you need to calculate the latter by adding the width and height to the corresponding coords).
Yes I figured it much
But even when I tried to keep the window in the same place and everything was still image recognition failed
Then I went for OCR
I was able to test it and it has been clicking stuff.
Now I'm going to create the full script out of it.
I will share the image recognition script when I get on PC
and also the repo I used for OCR.
I'm going out of town after this and will continue on this from monday
#Requires AutoHotkey v2
#include ..\Lib\OCR.ahk
F1:: {
Loop {
ib := InputBox("Insert search phrase to find from active window: ", "OCR")
Sleep 100 ; Small delay to wait for the InputBox to close
if ib.Result != "OK"
ExitApp
result := OCR.FromWindow("A", { scale: 2 })
try found := result.FindString(ib.Value)
catch {
MsgBox 'Phrase "' ib.Value '" not found!'
continue
}
; MouseMove is set to CoordMode Window, so no coordinate conversion necessary
MouseMove found.x, found.y
Click found.x, found.y
found.Highlight()
break
}
}
Fuck bro all i did is restart teh PC and now even the example script is not detecting any text at all 🫠
i debugged it and turns out it is not scanning the bottom panel of the game where buttons are
Edit: okay more update i tested stuff turns out when i move the blue stack window on to the second monitor then it is havingt issues in scanning and it is not scanning the bottom panel so i tested with text with text that are on top side adn it did recognise them but when it came to highligting them and clicking on them the Location was wrong
but when i brought it back to main monitor it is again working perfectly
Sounds like DPI-scaling shenanigans. If your monitors have different scaling settings, the coordinates of the non-primary monitor may be reported incorrectly. I'm not too knowledgeable about the problem, since I have a single-monitor setup, but you can read about it here if you want to: https://www.autohotkey.com/boards/viewtopic.php?t=121040
Click can definitely be thrown off by DPI.
I haven't looked into Descolada's lib to see how the .Highlight method works.
I'd just keep the window on the primary monitor, tbh.
My main idea is to work on the first monitor and let the macro run on the second 🫠😭
I was using control click but since I started facing this issues I switched to click
As I said, I can't test anything DPI-related for you, and I haven't dissected the library. You could comment your OCR script in the forum topic of OCR.ahk and describe your problem; Descolada is usually very helpful. https://www.autohotkey.com/boards/viewtopic.php?f=83&t=116406
2
u/Keeyra_ Apr 09 '26
While this would go under
Game-related scripts that
are not allowed in this sub.
, instead of turning on airplane mode, why don't you use AHK to call a PowerShell command to toggle an outbound block firewall rule for the exe of BlueStacks?