Sign in to follow this  
Followers 0
misioooo

Executing function on keypress, but send this key "normally" to OS

2 posts in this topic

#1 ·  Posted (edited)

Hi!

I want to do something like:

#include <ScreenCapture.au3>
#include <Misc.au3>

Local $hDLL = DllOpen("user32.dll")
Global $running = 1

Func Quit()
    $running = 0
EndFunc

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

MsgBox(0, "Running screen-capper!", "All fine captain!", 5)

While $running
    If _IsPressed("0D", $hDLL) Then
        Sleep(800)
        _ScreenCapture_Capture(@MyDocumentsDir & "\Tutorial_screens\Tutorial_Image_" & @MON & "_" & @MDAY & "_" & @HOUR & @MIN & @SEC & ".jpg")
        While _IsPressed("0D", $hDLL)
            Sleep(250)
        WEnd
    EndIf
WEnd
DllClose($hDLL)
exit 0 

It works as i want it to work (takes a screenshot whenever i press enter key. But maybe is there some better/less resource hungry approach to this? It should take a screenshot when i press enter, but mentioned Enter must also work "normally". I tried registering it as a hotkey, but then it didnt worked "normaly".

And you may ask "Why Enter key?". Well, i want to do some tutorials with pictures and after some analysis above method will make my work much more natural and pleasurable.

Edited by misioooo

Share this post


Link to post
Share on other sites



Hi,

You can use the >HotKey UDF and assign a hotkey with the flag $HK_FLAG_NOBLOCKHOTKEY.

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

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  
Followers 0