Autohotkey Script wont work for Precision X1 aka cant read window Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
tobsto occupied
Posts: 186
Joined: 20 Feb 2020, 09:34
Contact:

Autohotkey Script wont work for Precision X1 aka cant read window

Post by tobsto occupied » 26 Oct 2021, 00:15

as stated above i got this AhK Script and it dont seem to be able to read Precision X1s window , anyone gots a solution to get this working? would appreciate it

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
^x::
    Run, Launch Restart Crashed Display Driver.vbs
Sleep, 30000
Send {LShift down}{V}{LShift Up}
WinWait, % Title:= "Precision X1 ahk_exe PrecisionX_x64.exe",, 30
WinActivate, % Title
WinWaitActive, % Title,, 30
ControlClick, BOOST LOCK, % Title
WinMinimize 
    return
issue with this ahk script is ....it dont respect or detect better said aka call / open up the window of Precision X1 and control click Boost Lock and minimize again
i need this to work for my complete crashed driver solution ive been working on
and part of it is the ahk script
including Precision X1
since Precision X1 dont save Boost Lock in your OC Profile
i need to use AHK...if possible
this ones a bit of a complex challenge for AHK to master

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: Autohotkey Script wont work for Precision X1 aka cant read window

Post by mikeyww » 26 Oct 2021, 04:57

If your window is activated properly, then you can use Click instead of ControlClick.

User avatar
tobsto occupied
Posts: 186
Joined: 20 Feb 2020, 09:34
Contact:

Re: Autohotkey Script wont work for Precision X1 aka cant read window

Post by tobsto occupied » 26 Oct 2021, 05:56

ok ...atleast with that the window opens now , BUT still no luck on it clicking on Boost Lock


upate> yeah nope now it dont open window
Last edited by tobsto occupied on 26 Oct 2021, 06:11, edited 1 time in total.

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: Autohotkey Script wont work for Precision X1 aka cant read window

Post by mikeyww » 26 Oct 2021, 06:10

You can post your revised script here.

User avatar
tobsto occupied
Posts: 186
Joined: 20 Feb 2020, 09:34
Contact:

Re: Autohotkey Script wont work for Precision X1 aka cant read window

Post by tobsto occupied » 26 Oct 2021, 06:12

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
WinWait, % Title:= "Precision X1 ahk_exe PrecisionX_x64.exe",, 30
WinActivate, % Title
WinWaitActive, % Title,, 30
Click, BOOST LOCK
WinMinimize 
ExitApp
to simplify things ....still no luck still dont open window and still dont select boost lock

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: Autohotkey Script wont work for Precision X1 aka cant read window

Post by mikeyww » 26 Oct 2021, 06:17

I see. Click would need coordinates (see documentation). If you need to use a control name, then you need your original command.

1. How did you determine the control name?

2. How did you determine the WinTitle? You can post a screenshot of Window Spy while hovered over your control.

3. With your target window active, does the following script alone work?

Code: Select all

F3::
ControlFocus, BOOST LOCK, % Title := "Precision X1 ahk_exe PrecisionX_x64.exe"
ControlClick, BOOST LOCK, % Title
Return
If ControlClick does not work, you may be able to use Click with coordinates.

See also: Reliability

User avatar
tobsto occupied
Posts: 186
Joined: 20 Feb 2020, 09:34
Contact:

Re: Autohotkey Script wont work for Precision X1 aka cant read window

Post by tobsto occupied » 26 Oct 2021, 06:44

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
WinWait, % Title:= "Precision X1 ahk_exe PrecisionX_x64.exe",, 30
WinActivate, % Title
WinWaitActive, % Title,, 30
WinGetPos,,, ww, wh,
MouseClick,, ww*290/300,  wh*400/472 ; using scaled coords - should work an any res. (hopefully)
ExitApp
WinMinimize 
    return
this will properly activate boost lock ....no other way around it , BUT it wont automaximize aka focus the Precision X1 window

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: Autohotkey Script wont work for Precision X1 aka cant read window

Post by mikeyww » 26 Oct 2021, 07:00

Your target window would be active according to your script. To maximize a window, use WinMaximize.

User avatar
tobsto occupied
Posts: 186
Joined: 20 Feb 2020, 09:34
Contact:

Re: Autohotkey Script wont work for Precision X1 aka cant read window  Topic is solved

Post by tobsto occupied » 26 Oct 2021, 07:09

yep that didnt work either ...simply just maximized window once i actually manually maximized it ...solution?

i added a kill command into my .vbs file that will kill the app and restart it that way the window is autofocused aka maximized and the AHK script will then work and minimize it

and just use 4t tray to have it auto-minimize to tray after a few secs in general , good for apps in general that dont autominize to tray keeps stuff clean 8-)

my full code for the AHK part >

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
^x::
    Run, Launch Restart Crashed Display Driver.vbs
Sleep, 30000
Send {LShift down}{V}{LShift Up}
WinWait, % Title:= "Precision X1 ahk_exe PrecisionX_x64.exe",, 30
WinActivate, % Title
WinWaitActive, % Title,, 30
WinGetPos,,, ww, wh,
MouseClick,, ww*290/300,  wh*400/472 ; using scaled coords - should work an any res. (hopefully)
WinMinimize 
    return

Post Reply

Return to “Ask for Help (v1)”