Sign in to follow this  
Followers 0
AlfzZz

simple starter script

11 posts in this topic

Hi can anyone show me a script that sends the keystroke of "a" every 2 seconds? I tried doing this but it would just type the "a" key really fast. I think i set the delay wrong.

Share this post


Link to post
Share on other sites



Hi can anyone show me a script that sends the keystroke of "a" every 2 seconds? I tried doing this but it would just type the "a" key really fast. I think i set the delay wrong.

post what you have and we can help you from there...

keep in mind that the sleep function accepts milliseconds, not seconds


[font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font]

Share this post


Link to post
Share on other sites

Im asuming you have "Sleep(2)" in your script, try "Sleep(2000)" instead


[quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

i have no clue what im doing, it took me a while to get this set up, i dont know if this is the right way

Global $Paused

HotKeySet("{INSERT}", "TogglePause")

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

While 1

Sleep(110)

WEnd

Func TogglePause()

$Paused = NOT $Paused

While $Paused

Opt("SendKeyDelay", 10000000) ;5 milliseconds

Opt("SendKeyDownDelay", 10000) ;1 millisecond

Send("{a down}")

WEnd

EndFunc

Func Terminate()

Exit 0

EndFunc


you can probably code somthing like this in a more simple way...

ok so i fixed it by adding sleep(800) on a new line after send("{a down}")
will there be an easier way to write this script? like a shorter way


            
                


    Edited  by AlfzZz
    
    

            
        

        
            
                

    
        
            
        
    


            
        

        
            
                
                
                
            
            
                
            
        
        
    

    
        
            Share this post
            
Link to post
            
            
            

            
                Share on other sites
                

    
        
            

    

        
            

    

        
            

    

        
            

    

        
    

            
        
    


    

                    
                
                    
                    
                    






    
    
        
SmOke_N   

    
        
    
             178
    
        
    

        
            
                It's not what you know ... It's what you can prove!
            
            

            
                

    
        
    

            
            Moderators
            
                
            
            
                

    
        
    
             178
    
        
    

                16,119 posts
                
                

            
        
    
    
        


    

    
        
            
            
                
            
            
        

        
    #5 · 
            Posted 
            
            
            
        
    

    


            
        
            Looks like you need a basic understanding of the options for time.$millisecond = 1
$second = 1000
$minute = 60000
$hour = 3600000

See a pattern there?

Also, I'd suggest trying this:

http://www.autoitscript.com/forum/index.php?showtopic=21048

Once you understand it, you'll be able to answer most questions yourself without the need for being told to RTFM.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Opt("SendKeyDownDelay", 10000) ;1 millisecond

Your delays are way off...

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

Hey you, RTFM!!!

:):P

Share this post


Link to post
Share on other sites

what does RTFM mean?

i understand the time, :\

the only problem was that i set the delays wrong and when i added sleep (number) it turned out to be way easier

Share this post


Link to post
Share on other sites

what does RTFM mean?

i understand the time, :\

the only problem was that i set the delays wrong and when i added sleep (number) it turned out to be way easier

Usually I try to search for something if I don't know what it does or what it means. :)

http://www.google.com/search?q=RTFM&st...:en-US:official


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Edited: :)

Edited by evilelf

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