Page 1 of 1

Cancel the action of a key

Posted: 14 Apr 2017, 12:06
by oliv615
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.

Re: Cancel the action of a key

Posted: 15 Apr 2017, 01:39
by Darayavahus
Ummm... :) Try:

Browser_Home::
Sleep, 500
Return

Re: Cancel the action of a key

Posted: 15 Apr 2017, 11:26
by oliv615
Thank you for your help.
This did not work and the browser still opens. Can my remote send 2 instructions at the same time?

Re: Cancel the action of a key

Posted: 15 Apr 2017, 11:26
by oliv615
Thank you for your help.
This did not work and the browser still opens. Can my remote send 2 instructions at the same time?

Re: Cancel the action of a key

Posted: 15 Apr 2017, 12:21
by snowmind
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

Re: Cancel the action of a key

Posted: 15 Apr 2017, 12:48
by oliv615
Thank You.
If a browser is open it is closed but another is opened just after.
You must be right for the hardware command.

Re: Cancel the action of a key

Posted: 18 Apr 2017, 06:06
by oliv615
So it seems that the browser is activated due to an internal hardware command. Does anyone know how to disable this?

Re: Cancel the action of a key

Posted: 18 Apr 2017, 09:28
by MaxAstro
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.

Re: Cancel the action of a key

Posted: 21 Apr 2017, 02:58
by oliv615
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.