Sign in to follow this  
Followers 0
mozart90

How Release Hotkey If Win Isn't Active Anymore ?

5 posts in this topic

#1 ·  Posted (edited)

Hi,

I use the Enter key as a Hotkey and I would like to release the Hotkey while the my Skript Windows isn't active, so I can use the Enter key properly in other applications.

I tried this but it actually isn' working:

While 1
    if WinActive("My Skript") then  
;ToolTip("Hotkey enter active")
        HotKeySet("{Enter}", "Enter_Key_Pressed")
    else 
;ToolTip("")
        HotKeySet("{Enter}")
    endif   

    $msg = GuiGetMsg()
    Select

    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop

    Case Else
;;;;;;;
    EndSelect


wend

any suggestions??

greetings mozart90

Edited by mozart90

Share this post


Link to post
Share on other sites



HI,

this works for me. Give it a try:

Opt("WinTitleMatchMode", 4)
$title = 'YOUR TITLE'

While 1
    If WinActive($title) = 0 Then
        ToolTip("not active")
        HotKeySet("{Enter}")
    ElseIf WinActive($title) = 1 Then
        ToolTip("active")
        HotKeySet("{Enter}", "Enter_Key_Pressed")
    EndIf
    Sleep(10)
WEnd


Func Enter_Key_Pressed()
    MsgBox(0, "", "Enter")
EndFunc  ;==>Enter_Key_Pressed

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Hi,

I use the Enter key as a Hotkey and I would like to release the Hotkey while the my Skript Windows isn't active, so I can use the Enter key properly in other applications.

I tried this but it actually can't work:

While 1
    if WinActive("My Skript") then  
;ToolTip("Hotkey enter active")
        HotKeySet("{Enter}", "Enter_Key_Pressed")
    else 
;ToolTip("")
        HotKeySet("{Enter}")
    endif   

    $msg = GuiGetMsg()
    Select

    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop

    Case Else
;;;;;;;
    EndSelect
wend

any suggestions??

greetings mozart90

Well as far as I can see that should work, you might consider putting that all in a function, without the loop that is, and then do something like this...

adlibenable("check",50)

while 1
sleep(100)
wend

Func check()
    if WinActive("My Skript") then  
        HotKeySet("{Enter}", "Enter_Key_Pressed")
    else 
        HotKeySet("{Enter}")
    endif   

    $msg = GuiGetMsg()
    Select

    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop

    Case Else
    EndSelect
EndFunc

that is how I got something like this to work before...

Laterzzz,

Onoitsu2


Things I have made:[font="Trebuchet Ms"]_CheckTimeBlock UDF(LT)MOH Call Ignore List (MOH = Modem On Hold)[/font]

Share this post


Link to post
Share on other sites

Hi

very strange... I changed the titel match mode from "2" to "4" an now my code seems working...

Thanks for your ideas.

Greetings Mozart90

Share this post


Link to post
Share on other sites

Hi

very strange... I changed the titel match mode from "2" to "4" an now my code seems working...

Thanks for your ideas.

Greetings Mozart90

HI,

Welcome! Sometimes it is easier than it seems to be. :think:

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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