Jump to content
Sign in to follow this  
urmommie

Please help with hot keys

Recommended Posts

urmommie

well I read the tuts and all but I just can't get it well lets say this is my script:

$answer = msgbox(4, "Title", "Do you want to open?")
      If $answer = 6 Then
      Run("mspaint.exe")
EndIf
      If $answer = 7 Then
Exit
EndIf

And I wanted to make it like this:

$answer = msgbox(4, "Title", "Do you want to open?")
      If $answer = 6 Then
      Run("mspaint.exe")
      HotKeySet("{Esc}", "Exit"); this way the person can exit notepad by just pressing esc please help
EndIf
      If $answer = 7 Then
Exit
EndIf

Share this post


Link to post
Share on other sites
Authenticity

Look here to see how to get a window handle from PID.

You can do something like (read the help file if something isn't clear):

HotKeySet("{ESC}", "_ShutdownMSPaint")
HotKeySet("{SPACE}", "_EXIT")
.
.
.
If $Answer = 6 Then ; Yes 
     $PID = Run('mspaint.exe')
     $hwnd = _GetHwndFromPID($PID)
Else
     Exit
EndIf

While 1
     Sleep(50)
WEnd

Func _EXIT()
     Exit
EndFunc

Func _ShutdownMSPaint()
    WinClose($hwnd)
EndFunc

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.