Jump to content

Hotkey Management - (Moved)


xJilo
 Share

Recommended Posts

Hi,

Can I ask someone for a help for my project I know how to put hotkey with this:
 

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$PicT = GUICreate("Keyboard", 1001, 414, 60, 0)
$Pic1 = GUICtrlCreatePic("C:\Users\JiLO\Desktop\Dokio Credentials\Keyboard-Project\Samle-3.jpg", -24, -104, 1225, 681, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
   WinWaitActive("Keyboard")
   WinClose("Keyboard")

    EndSwitch
WEnd

 

But I can't close it or easily terminate it with the same hotkey. Can someone help me solving this problem?
 

Link to comment
Share on other sites

If you want to end the running autoit script with a hotkey, then you can do it like this, use ctrl q to quit:

 

If HotKeySet("^q", "exitapp") = 0 Then MsgBox(0, "Hotkey", "Err: Could not set. ")

local $oldsec=@sec

While 1
    if $oldsec<>@sec then
        ConsoleWrite(@hour & ":" & @MIN & ":" & @sec & @crlf)
        $oldsec=@sec
    EndIf
WEnd

Func exitapp()
    exit
EndFunc

Btw, you can remove the two lines:

Quote

 

WinWaitActive("Keyboard")
   WinClose("Keyboard")

 

 

 

because they are after the exit, they never get executed.

Edited by Dan_555

Some of my script sourcecode

Link to comment
Share on other sites

  • Developers

Moved to the appropriate forum, as the AutoIt Example Scripts forum very clearly states:

Quote

Share your cool AutoIt scripts, UDFs and applications with others.


Do not post general support questions here, instead use the AutoIt Help and Support forums.

Moderation Team

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...