Sign in to follow this  
Followers 0
Aeowon

[Help] Simple Program to Close Current Window

4 posts in this topic

#1 ·  Posted (edited)

This is my first application so, be gentle.

I just cannot figure out how for the life of me, how to tie the 'Hotkey' to a func or whatever it needs to be in order to Close the Current Window/Process. I want it to Kill the process by pressing a button on the keyboard and also stay open so that I could use the hotkey to close other applications(loop). Rewrite the code if you have to.. give me pointers. I'm just trying to learn. Is there a book I can buy to learn this stuff? I'm a technology hobbyist and I'm dipping my foot into this territory and heard this is a good way to learn. Thank you.

HotKeySet("{f5}", "close")

Global $ON = False


;close func
Func close()
$ON = True
EndFunc

if $ON = True then
WinClose( "{ACTIVE}" )
endif
Edited by Aeowon

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Here. Ow and the best way to learn is to read the helpfile(F1), it should be your best friend when coding in autoit :)

HotKeySet("{F11}", "close")


While 1
    Sleep(10)
    WEnd

;close func
Func close()
WinClose("[ACTIVE]", "")
EndFunc
Edited by darkmaster071

Share this post


Link to post
Share on other sites

Thank you darkmaster071 for the quick response and rewritten code.

I'll get to reading now :]

Thanks again.

Share this post


Link to post
Share on other sites

... Close the Current Window/Process. ...

You might try Alt-F4 instead of a script... but that is not a bad script to learn from.

Welcome to the forum.


[size="1"][font="Arial"].[u].[/u][/font][/size]

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  
Followers 0