Sign in to follow this  
Followers 0
josh77

hold space auto it macro ??

8 posts in this topic

hey guys is it possible to create an script that when i hold SPACE the macro hits space buttom several times until i release the SPACE and it stops ?? if so ... how can i do that ??

Share this post


Link to post
Share on other sites



Doesn't your computer do that on its own? It's called autorepeat.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

yeah but i need that for an app ... so i need a macro .

Edited by josh77

Share this post


Link to post
Share on other sites

try HotKeySet("{space down}", "SomeFunc")


edited

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

guys all i need is a macro that when i press and hold letter X for example the macro will press several times the spacebar for me until i release the X and it stops ... thats all i need , i tried many times and i cant make that macro work , can someone help me out whit that ?? how would u guys make that script ??

HotKeySet( "{x}", "_somefunc" )

While 1

Sleep(10)

wend

Func _somefunc()

Send("space down")

Send("space down")

Send("space down")

Send("space down")

EndFunc

something like that but that one if i stop the macro it will keep hitting space even after im done ... i need a macro that will hits space while i hold and stop when i release the X .

or maybe what the other guys said earlier and autorepeater for the spacebar ... im really stucked right now ...

anyway Thanks for reading , i hope someone can help me whit this =]

Edited by josh77

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Here try these apples

event triggered when spacebar is pressed

will send $spacerepeat amount of spacebar key presses

$spacerepeatdelay is the delay between spacebar key presses 1000 equals about one second and 500 would be about 1/2 a second good luck

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

$spacerepeat= 10
$spacerepeatdelay= 1000
$hgui= GUICreate("send space app", 200, 60)
GUISetState();shows the gui window
do
    $guimsg= GUIGetMsg()
    if _IsPressed("20") Then
        for $i=0 to $spacerepeat-1
            $timer= TimerInit()
            while TimerDiff($timer)<$spacerepeatdelay
                
            wend
            send("{space}")
        next
    endif
until $guimsg= $GUI_EVENT_CLOSE
Edited by songersoft

I am not a lawyer.  (-_-) Xandy About  (^o^) Discord - Xandy Programmer

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

If you want to use the 'x' key to trigger the event

replace the _ispressed("20") with _ispressed("58") a complete list is in the help file

just look up _ispressed.

I added the gui dialog for a method of program termination.

You can remove all the gui crap if you want and the program/script whatever will still work.

the _ispressed responds like a global hotkey except the triggering keypress is not removed from the windows event que, but you can use any key such as scroll-lock or F11

Edited by songersoft

I am not a lawyer.  (-_-) Xandy About  (^o^) Discord - Xandy Programmer

Share this post


Link to post
Share on other sites

Thanks songersoft its perfect ... thank you . =]

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