Jump to content
Sign in to follow this  
gil900

need help with a code i worte

Recommended Posts

gil900

Hello.

i worte a start of code that When I briefly pressing one of two buttons set, then an first the code check to see if this is long press or short press.

If if is long press, then a message appears:

MsgBox(0,"","long press",1)

If it short press, then a message appears:

MsgBox(0,"","short press",1)

The problem is that I want to Block the Input of these keys and i don't know how..

when i press of one of them so they send Input..

this is my code:

#include <Misc.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

HotKeySet("{ESC}", "Terminate")

;Settings
$VolumeUpKey = 68
$VolumeDownKey = 62

;-->EndSettings


Local $Sleep = 80 , $ChangeVolume = False , $Case , $timer , $dif , $SendOne = True , $StartTumer = False , $hDLL = DllOpen("user32.dll")

While 1
    Sleep($Sleep)
    If _IsPressed($VolumeDownKey, $hDLL) Or _IsPressed($VolumeUpKey, $hDLL) Then
        If $StartTumer = True Then
            ;MsgBox(0,"","",1)
            $timer = TimerInit()
            $SendOne = True
            $StartTumer = False
        EndIf
        If $ChangeVolume = False Then $ChangeVolume = True
        If _IsPressed($VolumeUpKey, $hDLL) Then $Case = 1
        If _IsPressed($VolumeDownKey, $hDLL) Then $Case = 2
    Else
        If $ChangeVolume = True Then $ChangeVolume = False
        If $StartTumer = False Then $StartTumer = True
    EndIf
    
    If $ChangeVolume = True Then
        $dif = TimerDiff($timer)
    Else
        ;ToolTip($dif)
        If  $dif > 0 Then
            If $dif < 800 Then
                If $SendOne = True Then
                    MsgBox(0,"","short press",1)
                    $SendOne = False
                EndIf
            Else
                MsgBox(0,"","long press",1)
            EndIf
        EndIf
        If $dif > 0 Then $dif = 0
    EndIf
    
    ;ToolTip($dif)
    
WEnd

Share this post


Link to post
Share on other sites
FireFox

The problem is that I want to Block the Input of these keys and i don't know how..

HotKeySet("{NUMPAD8}", "toto")
HotKeySet("{NUMPAD2}", "toto")

;your code


Func toto()
EndFunc

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
gil900

Share this post


Link to post
Share on other sites
FireFox

i don't want to do it with HotKeySet .

i want to do it on what i did...

This is too vague, because I exactly did what you asked.

Edit: Why HotKeySet does not fit your need?

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
gil900

This is too vague, because I exactly did what you asked.

Edit: Why HotKeySet does not feet you need?

yes i got it and it working..

i don't like the way it looks but it is do the job.

thanks..

if there is better way so i will heppey to know that.

i am looking for function to convert for example the 68 to {NUMPAD8} or {NUMPAD8} to 68..

Share this post


Link to post
Share on other sites
FireFox

i am looking for function to convert for example the 68 to {NUMPAD8} or {NUMPAD8} to 68..

IIRC, some of us discussed about that in my IsPressed UDF topic, you should find what you need.

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
PhoenixXL
UDF

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

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  

×