Jump to content
Sign in to follow this  
hirntot

HotKeySet Problem

Recommended Posts

hirntot

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.

Share this post


Link to post
Share on other sites
Valuater

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

Share this post


Link to post
Share on other sites
seandisanti

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

Share this post


Link to post
Share on other sites
hirntot

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

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  

×