Sign in to follow this  
Followers 0
Lukeprox

Press button after holding down another button

17 posts in this topic

Hi

I need a simple script and i dont know, how to create that.

I need this:

If i press left mouse button for exactly 5 secs (NO MORE OR LESS), it will press X button

(If left mouse button will be released earlier, nothing will happen - time must be exactly 5 sec in row - without any pause)

When it press X button, it needs to be ready to do it all again.

Any ideas?

Thx

Lucas (From Czech republic....so sry my English)

Share this post


Link to post
Share on other sites



ok, think i got it... checks if you are pressing left mouse button every second, after 5 seconds of continuously pressing it, automatically presses X.

Go on and test it, then say something.

#include <Misc.au3>
Global $dll
$dll = DllOpen("user32.dll")

While 1
    If _IsPressed ("01", $dll) Then
    pressed()
    EndIf
WEnd
DllClose ($dll)

Func pressed()
Sleep (1000)
If _IsPressed ("01", $dll) Then
check()
EndIf
EndFunc

Func check()
Sleep (1000)
If _IsPressed ("01", $dll) Then
check2()
EndIf
EndFunc

Func check2()
Sleep (1000)
If _IsPressed ("01", $dll) Then
check3()
EndIf
EndFunc

Func check3()
Sleep (1000)
If _IsPressed ("01", $dll) Then
check4()
EndIf
EndFunc

Func check4()
Sleep (1000)
If _IsPressed ("01", $dll) Then
Send ("x")
EndIf
EndFunc

Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

 

Share this post


Link to post
Share on other sites

Hmmm...interesting idea to check every specific time ...my previous idea was something like this:

If LMB !down! Then

add time counts (1 + 1 for every sec.) until 5 apears

If count = exactly 5 then press X and reset count numbers

If LMB !Up! Then

reset count numbers

...something like this...

But i will try yours :D

Thx for answer

Share this post


Link to post
Share on other sites

ok, think i got it... checks if you are pressing left mouse button every second, after 5 seconds of continuously pressing it, automatically presses X.

Go on and test it, then say something.

#include <Misc.au3>
Global $dll
$dll = DllOpen("user32.dll")

While 1
    If _IsPressed ("01", $dll) Then
    pressed()
    EndIf
WEnd
DllClose ($dll)

Func pressed()
Sleep (1000)
If _IsPressed ("01", $dll) Then
check()
EndIf
EndFunc

Func check()
Sleep (1000)
If _IsPressed ("01", $dll) Then
check2()
EndIf
EndFunc

Func check2()
Sleep (1000)
If _IsPressed ("01", $dll) Then
check3()
EndIf
EndFunc

Func check3()
Sleep (1000)
If _IsPressed ("01", $dll) Then
check4()
EndIf
EndFunc

Func check4()
Sleep (1000)
If _IsPressed ("01", $dll) Then
Send ("x")
EndIf
EndFunc

OMG My autoIT dont know function _IsPressed ^^

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Gotta have the

#Include <Misc.au3>

If you already put it, then maybe its down to the version u got.

i got v3.3.6.1

If LMB !down! Then

add time counts (1 + 1 for every sec.) until 5 apears

If count = exactly 5 then press X and reset count numbers

If LMB !Up! Then

reset count numbers

Let us know if you do it, how you did it. :D

Edited by careca

Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

 

Share this post


Link to post
Share on other sites

Gotta have the

#Include <Misc.au3>

If you already put it, then maybe its down to the version u got.

i got v3.3.6.1

I have misc.au3 in "include" directory. I copied your script in to that directory as well...so it should work. Maybe i have bad version...ill try to reinstall.

Share this post


Link to post
Share on other sites

Gotta have the

#Include <Misc.au3>

If you already put it, then maybe its down to the version u got.

i got v3.3.6.1

Let us know if you do it, how you did it. :D

Reinstaled &same error :oops:

Share this post


Link to post
Share on other sites

Gotta have the

#Include <Misc.au3>

If you already put it, then maybe its down to the version u got.

i got v3.3.6.1

Let us know if you do it, how you did it. :D

Sry my fault ^^ i know where was mistake. Its work now and im gonna to try that

Share this post


Link to post
Share on other sites

Gotta have the

#Include <Misc.au3>

If you already put it, then maybe its down to the version u got.

i got v3.3.6.1

Let us know if you do it, how you did it. :D

Anyway it not work :oops: (i mean that script)

Share this post


Link to post
Share on other sites

Works here man, just did, i opened a txt file and kept pressed left mouse button inside the notepad, after 5 secs a "X" apeared.

Maybe i understood wrong what you wanted, you want, left mouse button pressed for 5 secs press X key. right?


Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

 

Share this post


Link to post
Share on other sites

Works here man, just did, i opened a txt file and kept pressed left mouse button inside the notepad, after 5 secs a "X" apeared.

Maybe i understood wrong what you wanted, you want, left mouse button pressed for 5 secs press X key. right?

U understand that correctly and i did same thing with that notepad...but didnt work. Ill try once more

Share this post


Link to post
Share on other sites

Works here man, just did, i opened a txt file and kept pressed left mouse button inside the notepad, after 5 secs a "X" apeared.

Maybe i understood wrong what you wanted, you want, left mouse button pressed for 5 secs press X key. right?

Yup, not work. I opened notepad, run that script and after 5 sec X didnt appeard. :D

Share this post


Link to post
Share on other sites

Works here man, just did, i opened a txt file and kept pressed left mouse button inside the notepad, after 5 secs a "X" apeared.

Maybe i understood wrong what you wanted, you want, left mouse button pressed for 5 secs press X key. right?

But its weird...i replaced that pressing X with msgbox, and that works :D

Share this post


Link to post
Share on other sites

Works here man, just did, i opened a txt file and kept pressed left mouse button inside the notepad, after 5 secs a "X" apeared.

Maybe i understood wrong what you wanted, you want, left mouse button pressed for 5 secs press X key. right?

And it works perfectly - exactly as i wanted that. :D Thx...i will make a few upgrades...like decreasing time, becouse its after 7 sec not 5, and make few more stuff...this was exactly key i needed. Thx again :oops:

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

hmm weird, but if the msgbox opens, its all good till there, just the sendkey thingy is messed up...

EDIT: so the key does work?

Edited by careca

Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

 

Share this post


Link to post
Share on other sites

hmm weird, but if the msgbox opens, its all good till there, just the sendkey thingy is messed up...

EDIT: so the key does work?

Keys not work, wich is another big problem. :D It will ctreate msg box, but dont write that X in to notes (when i checking it)

Another big problem is, that when i run this script my CPU speed comes to 100%

Share this post


Link to post
Share on other sites

The window has to be active, for it to write there, anyway if it still doesnt work, dont know how can i help anymore.


Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

 

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