Cant left click in an application button

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Benjamin755
Posts: 2
Joined: 09 Aug 2019, 14:17

Cant left click in an application button

09 Aug 2019, 15:48

Hello All ,

I am new in this forum and I need a script AutoHotKey that sends Left click to Betternet VPN desktop application for windows to connect and disconnect (it is free to download). I ve tried my self many scripts but it seems that the application detects automated clicks and doesnt allow it (knowing that a simple mouse left click is just fine to connect/disconnect to the vpn)

Here is my last script that I used (suggested by a memeber in Discord who I thanks by the way) :

Sleep, 3000
Send, {Lbutton Down}
Send, {Lbutton Up}

I also tried other combinations .

Please I really need your help.
Thank you so much.
Attachments
betternet.JPG
betternet.JPG (20.54 KiB) Viewed 1561 times
User avatar
Sir Teddy the First
Posts: 94
Joined: 05 Aug 2019, 12:31
Contact:

Re: Cant left click in an application button

10 Aug 2019, 04:21

Hi,
I downloaded the app but unfortunately, this is not a solution.
This is the script I used:

Code: Select all

#SingleInstance Force

CoordMode, Mouse, Client
DetectHiddenWindows On

WinActivate, ahk_class HwndWrapper[Betternet.exe;;b60a3822-1de3-4a13-84f3-57da579f214d]

WinGetActiveStats, Title, Width, Height, X, Y
MsgBox % Title ", " Width ", " Height ", " X ", " Y

Click, 125, 315

return
;ahk_exe Betternet.exe; 125 315 (Coordinates relative to client window)
But the problem is: It does not work.
And it's not like your suggestion, that the application might block any automated clicks, it's rather that AHK itself stops working as soon as you activate that window.

The Clicking works fine until I add the "WinActivate" part, then the mouse won't move a single pixel.
But the script is able to get the applications active stats, which is very strange and I've never seen something like this before.

This problem is definetively not as simple as it seems.
It might have something to do with the fact that the class is "HwndWrapper". This is probably not a normal window, rather something similar to the Adobe Creative Cloud Window.
:eh: :think:
gregster
Posts: 9002
Joined: 30 Sep 2013, 06:48

Re: Cant left click in an application button

10 Aug 2019, 05:18

Since it wasn't mentioned, if anyone tried to run the script as admin, I'll just remind you of this possibility.
(Afaik, it is possible, to get the window stats of an elevated window with a non-elevated script, so this would still fit the description so far)
trust_me
Posts: 98
Joined: 29 Jul 2017, 10:46

Re: Cant left click in an application button

10 Aug 2019, 11:03

Code: Select all

 I've never seen something like this before
It is very strange , if the window is active MouseMove, X, Y just does not move the cursor :wtf:
gregster
Posts: 9002
Joined: 30 Sep 2013, 06:48

Re: Cant left click in an application button

10 Aug 2019, 11:43

trust_me wrote:
10 Aug 2019, 11:03
It is very strange , if the window is active MouseMove, X, Y just does not move the cursor :wtf:
Again, this seems to make perfect sense when your script is not running as admin and you try to interact with an elevated window/program.

Try this (run once as admin and once as non-admin):

Code: Select all

run taskmgr.exe		; starts task manager
WinWaitActive ahk_exe Taskmgr.exe
WinGetActiveStats, Title, Width, Height, X, Y
MsgBox % Title ", " Width ", " Height ", " X ", " Y		; works in both cases
return 

Space::Click, 125, 300

1::MouseMove, 250, 100
The window stats work in both cases (like Windows Spy works on elevated windows), but the hotkeys Space and 1 only work on the active task manager window (which will be elavated), if you run your script as admin.
trust_me
Posts: 98
Joined: 29 Jul 2017, 10:46

Re: Cant left click in an application button

10 Aug 2019, 13:16

I guess you are right gregster , unfortunately i uninstalled betternet and now my PC went into a " windows is repairing your system " loop :?
On top of that my system backup ( only a few days old ) refuses to recover it because " the backup is made with a newer windows version " ????
So i will spend the evening with a clear install of ...... everythingq ....... :cry: :cry:
Benjamin755
Posts: 2
Joined: 09 Aug 2019, 14:17

Re: Cant left click in an application button

11 Aug 2019, 05:44

Your are awsome guys thank you very much.

I ve created a shortcut of the script and in propreties , in advanced (tab = ShortCut )run it as Admin and it works

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: scriptor2016 and 278 guests