Jump to content

Speed up with a lot of _ispressed

Recommended Posts

I use the following script, which one part of it is to save the file when some keys are typed. The (whole ) script runs 700 times per minute. If I drop the For loop, it runs 760 times per minute. I searched on Google and found switch is faster. I am wondering if it is possible to do something like:

$keytyped = _GetKey()

Switch $keytyped

Case .....( in the range i want)

Save File


You may think I am asking for a keylogger, but No! I have known how to do this with a lot of _ispressed and a lot of MsgBox , which can be found by Google. It is easy to find one, so if I want to use keylogger, I don't have to ask it here. If you have idea to speed up the part in my script and you don't want to post it on this forum, please PM me.

While 1


For $i = 48 to 90
        If  _isPressed(Hex($i), $dll) OR _isPressed("8", $dll) OR _isPressed("20", $dll) OR _isPressed( Hex( _Min($i+48, 111) ), $dll) OR _isPressed( Hex( _Min($i+138 , 190) ), $dll) Then
            Save the file
            ExitLoop ; Once a character typed is detected, don't check other characters ;;; One can delete this line and get fast render. But why???


Link to post
Share on other sites

After remove the functions I don't need from Yashied HotKey UDF, I get the following script, which

when you press a key, it will give you the decimal number $Keycode of this key. So one can use this if:

You want to check if some (many) keys are pressed. If yes, then do the same jobs.

Of course one can use _ispressed many times, but using this script, one can use Switch $Keycode, which turns out be be more fast than many if and don't check _ispressed many times!

I don't know how this script works, I just remove the parts I don't need from Yashied Hotkey UDF, but it works very well!!

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...