Home > Blockchain >  How can I run and close an exe file with a mouse key?
How can I run and close an exe file with a mouse key?

Time:06-28

I have an exe file and I want to run it and close it by pressing a mouse button or a keyboard button. For eg. say it is a music.exe and I want to open it while I am gaming/doing spread sheet by pressing the key 'm' or mouse button.

I have access to a logitech macro supported mouse. Also a no macro generic microsoft mouse. I am thinking about some kind of macro , or tasker or some script that can do this easily. ( not that I dont want to directly click the exe file or close the exe file by clicking x on the window)

Any suggestion would be helpful ;)

CodePudding user response:

I did it with AutoHotKey software. If anyone is interested , here is the code

XButton2:: if WinExist("WindowName") WinClose ; else Run *runas "%directory%\Music.exe" return

This code will run and close the Music app with admin previlages. ( Change "Run *runas" to "run" if you want it to run normally)

  • Related