bennyvo Posted March 1, 2005 Share Posted March 1, 2005 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... Link to comment Share on other sites More sharing options...
Insolence Posted March 1, 2005 Share Posted March 1, 2005 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. Link to comment Share on other sites More sharing options...
bennyvo Posted March 1, 2005 Author Share Posted March 1, 2005 WinWaitActive("Untitled - Notepad") HotKeySet("{ESC}", "Close") While 1 Sleep(100) WEnd Func Close() WinClose("Untitled - Notepad", "") EndFunc i think i found my solution Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now