Jump to content

Press button after holding down another button


 Share

Recommended Posts

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)

Link to comment
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

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

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

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

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

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.

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

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

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
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

Link to comment
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 ^^
Link to comment
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

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

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

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

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

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

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.

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

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

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
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.

Link to comment
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

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

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

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

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

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.

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

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

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
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

Link to comment
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

Link to comment
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

Link to comment
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:

Link to comment
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?

Edited by careca
Spoiler

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

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

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

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

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.

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

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

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
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%

Link to comment
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

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

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

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

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

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.

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

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

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...