Jump to content

HotKeySet Problem


hirntot
 Share

Recommended Posts

HotKeySet ("!s" , "sendok")
Func sendok()
$ok = $msg
EndFunc

$ok = GUICtrlCreatebutton ("Send",312,10,183,20)

Do
    $msg = GUIGetMsg()
    if $msg = $ok then
_FileCreate ("C:\WINDOWS\Temp\send.bat")
endif
Until $msg = $GUI_EVENT_CLOSE

I want to run the Do part if you press the Hotkey, i'ver tried it several ways but everytime it fails or runs the script twice or something else ;).

But it works with the Control.

Link to comment
Share on other sites

how about this

HotKeySet ("!s" , "sendok")
Func sendok()
_FileCreate ("C:\WINDOWS\Temp\send.bat")
EndFunc

$ok = GUICtrlCreatebutton ("Send",312,10,183,20)

Do
    $msg = GUIGetMsg()
    if $msg = $ok then
    sendok()
endif
Until $msg = $GUI_EVENT_CLOSE

i did not test your code

8)

NEWHeader1.png

Link to comment
Share on other sites

HotKeySet ("!s" , "sendok")
Func sendok()
$ok = $msg
EndFunc

$ok = GUICtrlCreatebutton ("Send",312,10,183,20)

Do
    $msg = GUIGetMsg()
    if $msg = $ok then
_FileCreate ("C:\WINDOWS\Temp\send.bat")
endif
Until $msg = $GUI_EVENT_CLOSE

I want to run the Do part if you press the Hotkey, i'ver tried it several ways but everytime it fails or runs the script twice or something else ;).

But it works with the Control.

looks like you just have a simple scope problem. have you tried:

Global $ok
Func sendok()
$ok = $msg
EndFunc

$ok = GUICtrlCreatebutton ("Send",312,10,183,20)

Do
    $msg = GUIGetMsg()
    if $msg = $ok then
_FileCreate ("C:\WINDOWS\Temp\send.bat")
endif
Until $msg = $GUI_EVENT_CLOSE

***edit*** forgot my

Edited by cameronsdad
Link to comment
Share on other sites

how about this

HotKeySet ("!s" , "sendok")
Func sendok()
_FileCreate ("C:\WINDOWS\Temp\send.bat")
EndFunc

$ok = GUICtrlCreatebutton ("Send",312,10,183,20)

Do
    $msg = GUIGetMsg()
    if $msg = $ok then
    sendok()
endif
Until $msg = $GUI_EVENT_CLOSE

i did not test your code

8)

works perfect, thx.

I think my code was rubish ;)

@cameronsdad:

I've already used Valuaters code before you wrote this and my old Code seems not to work correctly even if i add Global.

@admins: Thread can be closed

Edited by hirntot
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...