Cancel the action of a key

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
oliv615
Posts: 6
Joined: 14 Apr 2017, 11:53

Cancel the action of a key

14 Apr 2017, 12:06

Hello,

I have a mini keyboard Rii i25 (http://www.riitek.com/product/i25.html)
The "Browser_Home" key opens my browser and i don't want that.

If I do the code below I get a popup but after the browser opens anyway.

Code: Select all

Browser_Home::
MsgBox, %A_ThisHotKey% was pressed.
return
How to make the browser does not open?

Ideally, I want to replace this key by "escape" without opening the browser afterwards

Thank you for your help.
Darayavahus
Posts: 36
Joined: 21 May 2016, 03:32

Re: Cancel the action of a key

15 Apr 2017, 01:39

Ummm... :) Try:

Browser_Home::
Sleep, 500
Return
oliv615
Posts: 6
Joined: 14 Apr 2017, 11:53

Re: Cancel the action of a key

15 Apr 2017, 11:26

Thank you for your help.
This did not work and the browser still opens. Can my remote send 2 instructions at the same time?
oliv615
Posts: 6
Joined: 14 Apr 2017, 11:53

Re: Cancel the action of a key

15 Apr 2017, 11:26

Thank you for your help.
This did not work and the browser still opens. Can my remote send 2 instructions at the same time?
snowmind
Posts: 124
Joined: 12 Nov 2015, 15:18

Re: Cancel the action of a key

15 Apr 2017, 12:21

oliv615 wrote:Thank you for your help.
This did not work and the browser still opens. Can my remote send 2 instructions at the same time?

I believe the browser loads due to an internal hardware command. Why dont you try to take some action and close the browser?. Something like this

Code: Select all

Browser_Home::
	If ProcessExist("iexplore.exe")	;If ie browser
	{
	  ProcessExist(Name)
	  {
	  Process,Close,%Name%
	  return Errorlevel
	  }
	}
;Put some code
return
oliv615
Posts: 6
Joined: 14 Apr 2017, 11:53

Re: Cancel the action of a key

15 Apr 2017, 12:48

Thank You.
If a browser is open it is closed but another is opened just after.
You must be right for the hardware command.
oliv615
Posts: 6
Joined: 14 Apr 2017, 11:53

Re: Cancel the action of a key

18 Apr 2017, 06:06

So it seems that the browser is activated due to an internal hardware command. Does anyone know how to disable this?
MaxAstro
Posts: 557
Joined: 05 Oct 2016, 13:00

Re: Cancel the action of a key

18 Apr 2017, 09:28

This should cause the key to at least close the window it opens:

Code: Select all

Browser_Home::
	WinWaitActive, ahk_exe iexplore.exe, , 5
	if (!ErrorLevel)
		WinClose
	; Anything else you want the hotkey to do goes here
	return
Unfortunately this is a fairly hacky solution; it sounds like the button operates at a level that AHK can't really interact with directly.
oliv615
Posts: 6
Joined: 14 Apr 2017, 11:53

Re: Cancel the action of a key

21 Apr 2017, 02:58

ok ! Thank you for your help.
To work around the problem I finally replaced the exe file of my browser by default with my script.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Anput, arcylix, drani, Google [Bot], Rohwedder and 208 guests