Jump to content

Recommended Posts

Posted

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...

Posted

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.
Posted

WinWaitActive("Untitled - Notepad")

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

While 1

Sleep(100)

WEnd

Func Close()

WinClose("Untitled - Notepad", "")

EndFunc

i think i found my solution

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
×
×
  • Create New...