Jump to content
Sign in to follow this  
seesoe

hotkey type checks

Recommended Posts

seesoe

hello, i have a function that i need to run when alt+shift+4 is pressed on the keyboard.

here is the function

Func button_4($user_id)
    $url        =    _HTTPEncodeString($var&"="&$user_id)
    $socket        =    _HTTPConnect($host)
    $post        =    _HTTPPost($host,$page,$socket,$url)
    $recv        =    _HTTPRead($socket,1)
EndFunc

the thing is, i need to put all that in another function and i need that function to wait for the hotkeys to be pressed and button_r function to finish processing before moving on.

Share this post


Link to post
Share on other sites
herewasplato

It may just be me - but I'm not positive that I understand your request.

If you need one func to complete before a user can ask to start a new one, then do not define the HotKeys until after the first func completes... Again - I might not even be close to what you want... but here is something for you to look and and say where it fails ya:

HotKeySet("!+r", "button_r")

While 1
    Sleep(9)
WEnd

Func button_r()
    ;do stuff here
    ;;
    ;;
    ;until the func finishes
    HotKeySet("!+4", "button_4")
EndFunc   ;==>button_r

Func button_4()
    ;do stuff here
    ;;
    ;;
    HotKeySet("!+4", "")
EndFunc   ;==>button_4

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites
BinaryBrother

Will "HotKeySet" not work?

You have 2 methods of accomplishing this... 1 being...

HotkeySet("keys","Function")

HotkeySet("!+4","button_4") ; ! = Alt, + = Shift
Func button_4($user_id)
    $url        =    _HTTPEncodeString($var&"="&$user_id)
    $socket        =    _HTTPConnect($host)
    $post        =    _HTTPPost($host,$page,$socket,$url)
    $recv        =    _HTTPRead($socket,1)
EndFuncoÝ÷ Ù²,>·¬±çjºa{Ê«¨·öåµ8b²+'ßÛmêâpk+hvaÆî¶+l¶'£¢ëZºÚ"µÍÚ[ÛYH   ÓZØË]LÉÝÈÈZØÈ[ÛYHÈYYYÌÍÙHÜ[  ][ÝÝÙÌ  ][ÝÊHÈÛÈZXY[Ü[HÈ[ÝHÜX[ÙBÚ[HBYÒÔÜÙY
    ][ÝÌL][ÝË   ÌÍÙ
H[ÒÔÜÙY
    ][ÝÌL ][ÝË  ÌÍÙ
H[ÒÔÜÙY
    ][ÝÌÍ    ][ÝË  ÌÍÙ
H[ÙÐÞ
    ][ÝÕ]I][ÝË  ][ÝÐ[
ÈÚY
È
ÈY[ÜÙY][ÝÊB[YÑ[
Edited by BinaryBrother

Share this post


Link to post
Share on other sites
seesoe

i would like to use

HotkeySet("!+4","button_4")

however, i need to run function button_4(45) not just button_4

Share this post


Link to post
Share on other sites
BinaryBrother

I see what your saying, this may not be the right answer, but it works... ^_^

HotkeySet("!+4","button_4aaaa") ; ! = Alt, + = Shift

Func Button_4aaaa
     button4(45)
EndFunc
Func button_4($user_id)
    $url        =    _HTTPEncodeString($var&"="&$user_id)
    $socket        =    _HTTPConnect($host)
    $post        =    _HTTPPost($host,$page,$socket,$url)
    $recv        =    _HTTPRead($socket,1)
EndFunc

Share this post


Link to post
Share on other sites
seesoe

hmm, ya it works, however, 45 was just an example the function's input where 45 is at is suppose to have $id[2], and $id[2] is provided by the rest of the script...

maybe setting it as global?

*edit*

that didn't seem to work

Edited by seesoe

Share this post


Link to post
Share on other sites
herewasplato

... that didn't seem to work

can you post the code that did not work?

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites
BinaryBrother

hmm, ya it works, however, 45 was just an example the function's input where 45 is at is suppose to have $id[2], and $id[2] is provided by the rest of the script...

maybe setting it as global?

*edit*

that didn't seem to work

It will work if you do it right. ^_^

Without knowing what you've tried, what issue your getting with your code, or some more detailed insight, my advise in minimal.

Share this post


Link to post
Share on other sites
seesoe

the code is the whole program, it works as a whole i can't really cut some out and show you the part we are working on...

i have a program that accepts socket data and then when it finds specified types of data strings it phrases that, prints it, and writes to a database, the part that we are working on is the last part right after the database writing, where it looks for a key press and when it does it will send a signal to a server and then the server emails a confirmation email saying we got that data that was sent

the program is tied to a few other servers and things, i will do my best to recreate some simple workable code environment for everyone here to see and mess with.

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  

×