Jump to content
Sign in to follow this  
AngelPk

Help making an easy script

Recommended Posts

AngelPk

Hello.

I need help creating a simple script which does the following things:

Click in the keyboard "q", then "w", then "e", while the interval between each click should be 40 ms.

I need the script to be started once I click "+", then infinitly click "q","w","e" until I click "-" to pause it.

I have totally no idea how to do that, can anyone please help me? I'm new with this program and I also don't know anything about scripting.

I only found out that I can make the script click a letter by writing Send("random").

If anyone can easily make me such a script as I mentioned above, I'll thank him much, plus I would study it and try to figure out how to do better scripts, that would really help...

Thanks alot

Edited by AngelPk

Share this post


Link to post
Share on other sites
GEOSoft

Hello.

I need help creating a simple script which does the following things:

Click in the keyboard "q", then "w", then "e", while the interval between each click should be 40 ms.

I also want to activate the script by clicking "-" button, and shut it down with "+" button.

I have totally no idea how to do that, can anyone please help me? I'm new with this program and I also don't know anything about scripting.

I only found out that I can make the script click a letter by writing Send("random").

If anyone can easily make me such a script as I mentioned above, I'll thank him much, plus I would study it and try to figure out how to do better scripts, that would really help...

Thanks alot

We don't write code for people. You show us what you have tried and we will show you what you did wrong.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
AngelPk

Ok, i'm just a begginer so obviously all I managed to do is this:

"

#cs ----------------------------------------------------------------------------

AutoIt Version: 3.3.0.0

Author: myName

Script Function:

Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

Send("q")

Send("w")

Send("e")

"

How can I set the time interval between per click, in milliseconds?

How can I make the script work infinitly until I pause it?

And how can I make a start and pause button to the script?

Thats all what I need, I checked in a few tutorials and yet I haven't found any answer.

Edited by AngelPk

Share this post


Link to post
Share on other sites
GEOSoft

2 ways

1 > for 40 milliseconds use Opt("SendKeyDelay", 40) at the top of your script

Example

Opt("SendKeyDelay", 40)

Send("qwe")

2 > After each Send() use Sleep(40)

Example

Send("q")

Sleep(40)


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
AngelPk

Thanks, added to the script and it worked,

Still, 2 problems:

How do I make the script run infinitly?

And how do I set a start and pause hotkey?

Thanks.

Edited by AngelPk

Share this post


Link to post
Share on other sites
herewasplato

Thanks, added to the script and it worked,

Still, 2 problems:

How do I make the script run infinitly?

And how do I set a start and pause hotkey?

Thanks.

open the help file and search on hotkey - both of your questions are answered on the first return.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites
AngelPk

I do not understand anything there...

This is the script it shows me as an example:

Example:

; Press Esc to terminate script, Pause/Break to "pause"

Global $Paused

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

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

HotKeySet("+!d", "ShowMessage") ;Shift-Alt-d

;;;; Body of program would go here ;;;;

While 1

Sleep(100)

WEnd

;;;;;;;;

Func TogglePause()

$Paused = NOT $Paused

While $Paused

sleep(100)

ToolTip('Script is "Paused"',0,0)

WEnd

ToolTip("")

EndFunc

Func Terminate()

Exit 0

EndFunc

Func ShowMessage()

MsgBox(4096,"","This is a message.")

EndFunc

I dont understand which lines should I copy to my script and where to put them... it's all very confusing.

I'd really appreciate if you explain instead of giving me clues, I have countless questions and problems with that, talking straight would help me alot

Edited by AngelPk

Share this post


Link to post
Share on other sites
JSThePatriot

First did you figure out what part of the "body of the program goes here" means to you?

Second you see the function used at the top to declare a "{PAUSE}" hotkey, can you not use the definition in the helpfile to explain how that's working, and what else you might want to copy out? Have you tried copying anything out and running it to see if it performs as you're desiring. Don't be afraid to try it. It's not going to blow up your computer, or mess anything up. (At least not that code).

Thanks,

Jarvis


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites
AngelPk

Ok I think I managed to add a pause and exit hotkeys.

; Script Start - Add your code below here
Global $Paused
; Press Esc to terminate script, Pause/Break to "pause"

Global $Paused
HotKeySet("-", "TogglePause")
HotKeySet("*", "Terminate")

;;;; Body of program would go here ;;;;
Send("q")
Sleep(40)
Send("w")
Sleep(40)
Send("e")
Sleep(40)
;;;;;;;;

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc

EndFunc

Now I'm trying to make the script works infinitly until I pause it, I dont know the script for that either or at least it's name so I can search in the help file... anyone?

Edited by AngelPk

Share this post


Link to post
Share on other sites
GEOSoft

Ok I think I managed to add a pause and exit hotkeys.

; Script Start - Add your code below here
Global $Paused
; Press Esc to terminate script, Pause/Break to "pause"

Global $Paused
HotKeySet("-", "TogglePause")
HotKeySet("*", "Terminate")

;;;; Body of program would go here ;;;;
Send("q")
Sleep(40)
Send("w")
Sleep(40)
Send("e")
Sleep(40)
;;;;;;;;

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc

EndFunc

Now I'm trying to make the script works infinitly until I pause it, I dont know the script for that either or at least it's name so I can search in the help file... anyone?

While / WEnd loops are also in the help file

; Script Start - Add your code below here
Global $Paused
; Press Esc to terminate script, Pause/Break to "pause"

Global $Paused
HotKeySet("-", "TogglePause")
HotKeySet("*", "Terminate")

;;;; Body of program would go here ;;;;
While 1 ;;  Good luck with this
    Send("q")
    Sleep(40)
    Send("w")
    Sleep(40)
    Send("e")
    Sleep(40)
WEnd
;;;;;;;;

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc

EndFunc

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
AngelPk

edit:

Nevermind. I just finished the script and it works just as I expected!!! thanks for the help everyone!

Edited by AngelPk

Share this post


Link to post
Share on other sites
JSThePatriot

Glad you were able to get there with assistance. Thanks for being useful to yourself, and being willing to work for yourself!

Jarvis


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.