Jump to content
Sign in to follow this  
bennyvo

Hotkey help

Recommended Posts

hi,

I want to press a key and it close an active program.

let say i run the script then open notepad, when i press ESC key, i want it to close notepad.

anyone know the code thanks...

Share this post


Link to post
Share on other sites

This would be fairly simple, I believe.

Where are you having trouble?

First you assign the hotkey, and wait for the user to press it. You have to get the process ID via the active window title and then close it.


"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.

Share this post


Link to post
Share on other sites

WinWaitActive("Untitled - Notepad")

HotKeySet("{ESC}", "Close")

While 1

Sleep(100)

WEnd

Func Close()

WinClose("Untitled - Notepad", "")

EndFunc

i think i found my solution

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...