Need help to get this script to work with an app that has no window title Topic is solved

Ask gaming related questions (AHK v1.1 and older)
User avatar
tobsto occupied
Posts: 186
Joined: 20 Feb 2020, 09:34
Contact:

Need help to get this script to work with an app that has no window title

Post by tobsto occupied » 08 Apr 2021, 22:14

as said game launcher has no window title , i use process explorer , which is an advanced task manager, yet nothing , i only get the exe running process , no window title for the launcher nor a description either , would appreciate a solution thanks, heres the current script>

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

CoordMode, Mouse, Client
run, stp-unravel.exe, D:\Games\Unravel\
WinWaitActive, ahk_class stp-unravel.exe,, 15

ControlClick, PLAY
ExitApp
you guessed it , once the launcher is open it wont autoselect PLAY, also using TAB wont switch between PLAY and EXIT , so it dont react to keyboard input only mouse input
User avatar
boiler
Posts: 16902
Joined: 21 Dec 2014, 02:44

Re: Need help to get this script to work with an app that has no window title

Post by boiler » 08 Apr 2021, 22:37

This line is not correct:

Code: Select all

WinWaitActive, ahk_class stp-unravel.exe,, 15
It should be:

Code: Select all

WinWaitActive, ahk_exe stp-unravel.exe,, 15
User avatar
tobsto occupied
Posts: 186
Joined: 20 Feb 2020, 09:34
Contact:

Re: Need help to get this script to work with an app that has no window title

Post by tobsto occupied » 09 Apr 2021, 23:41

nope , still dont autoselect PLAY...nothing , sadly, as said only thing that shows is the actual process stp-unravel.exe this goes for command line , also only stp-unravel.exe nothing else in process explorer, well you do have PID and GDI
User avatar
boiler
Posts: 16902
Joined: 21 Dec 2014, 02:44

Re: Need help to get this script to work with an app that has no window title

Post by boiler » 09 Apr 2021, 23:47

Whether it selects PLAY yet or not, that line was incorrect so it wouldn't move past that line until it was fixed. Now that it is, you can address how to make it play. Some windows just don't respond to ControlClick. You can try seeing if running your script as administrator makes a difference. If not, then try clicking on the location of PLAY using the Click, either by known location or perhaps by finding its location first with ImageSearch.
User avatar
boiler
Posts: 16902
Joined: 21 Dec 2014, 02:44

Re: Need help to get this script to work with an app that has no window title

Post by boiler » 09 Apr 2021, 23:50

You can run this version of the script to see if recognizes the window based on the corrected title info. If it shows a MsgBox at all, it does.

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

CoordMode, Mouse, Client
run, stp-unravel.exe, D:\Games\Unravel\
WinWaitActive, ahk_exe stp-unravel.exe,, 15
MsgBox, % WinExist("ahk_exe stp-unravel.exe")
; ControlClick, PLAY
ExitApp
User avatar
tobsto occupied
Posts: 186
Joined: 20 Feb 2020, 09:34
Contact:

Re: Need help to get this script to work with an app that has no window title

Post by tobsto occupied » 10 Apr 2021, 16:34

nope , that wont work either gives a code in a message box thats random every time i try it tho, this time its this>

---------------------------
Launch Unravel , Autoplay.ahk
---------------------------
0x18b11be
---------------------------
OK
---------------------------
User avatar
boiler
Posts: 16902
Joined: 21 Dec 2014, 02:44

Re: Need help to get this script to work with an app that has no window title

Post by boiler » 10 Apr 2021, 16:49

Nope, that means it’s working actually. That “random” code is the ID of that window. That means the window is being properly identified. It changes each time the window is created. So you can move on to how to click PLAY now that the window is properly activated. You can remove the MsgBox line now because it means the WinWaitActive line is doing what it is supposed to. If it didn't, it never would have arrived at the MsgBox line.
User avatar
tobsto occupied
Posts: 186
Joined: 20 Feb 2020, 09:34
Contact:

Re: Need help to get this script to work with an app that has no window title

Post by tobsto occupied » 10 Apr 2021, 21:04

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

CoordMode, Mouse, Client
run, stp-unravel.exe, D:\Games\Unravel\
WinWaitActive, ahk_exe stp-unravel.exe,, 15
ControlClick, PLAY
ExitApp
[Mod edit: [code][/code] tags added.]


no luck , dont click Play, btw i am on an admin account fully unrestricted with UAC off


>try clicking on the location of PLAY using the Click, either by known location >

not sure how to do that
User avatar
boiler
Posts: 16902
Joined: 21 Dec 2014, 02:44

Re: Need help to get this script to work with an app that has no window title

Post by boiler » 10 Apr 2021, 21:16

tobsto occupied wrote:
no luck , dont click Play, btw i am on an admin account fully unrestricted with UAC off
Being on an admin account doesn’t cause your script to be run as admin. If the process you are trying to automate is elevated (meaning your program is running as admin), then the script usually has to be an elevated process (meaning running as admin) in order to interface with it, regardless of your account’s privilege level.

tobsto occupied wrote:
>try clicking on the location of PLAY using the Click, either by known location >

not sure how to do that
Use the Window Spy tool to determine the location of where to click PLAY when that window is active. Choose the client coordinates since that is what you already set as CoordMode in tour script. Then use the Click command to click on that location after the window is active.
User avatar
tobsto occupied
Posts: 186
Joined: 20 Feb 2020, 09:34
Contact:

Re: Need help to get this script to work with an app that has no window title  Topic is solved

Post by tobsto occupied » 10 Apr 2021, 21:26

ok got it to work this is my script, no admin shenanigans required

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

CoordMode, Mouse, Window
BlockInput, MouseMove ; should be added to any script using coords!
run, stp-unravel.exe, D:\Games\Unravel\
WinWaitActive, ahk_exe stp-unravel.exe,, 15
WinGetPos,,, ww, wh,
MouseClick,, ww*250/305,  wh*440/482 ; using scaled coords - should work an any res. (hopefully)
ExitApp
Post Reply

Return to “Gaming Help (v1)”