Jump to content

A favour to a noob plz


Guest giorgos
 Share

Recommended Posts

Guest giorgos

Well i downloaded auto-it 2-3 days before and i find it hard for me to create a script.i need a simple script that does this work: press a button key (for example number 2) every XX seconds.(i will be changing number of seconds after some days if it's easy to see what i should change at script) can anyone make a script like this and post it if its not so hard plz... :evil:

ty guys and i hope someone will help me :)

Link to comment
Share on other sites

Okay...

Bad idea to download a scripting language and then just ask someone to write the code for you. You didnt have to download it. You could have just asked for someone to write and compile it for you since that is only seconds longer and is the easy part.

Now since I dont believe in stupid questions just ignorant people you may want to try reading some in the help file or searching the forums before which time you ask such a question as this. There have been so many of these lately its not even funny. I am getting really tired of this.

Just look in the help file at the While...WEnd loop along with the Sleep() function and Send() and ControlSend(). After you give this some effort and you still cant figure something out because it isnt already in the helpfile (not going to be the case) or if you just simply cant figure it out then by all means ask a question, but dont be ignorant.

I am sorry if this seems a bit harsh, but I am tired of everyone expecting something for free.

JS

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)

Link to comment
Share on other sites

Guest giorgos

Okay...

Bad idea to download a scripting language and then just ask someone to write the code for you. You didnt have to download it. You could have just asked for someone to write and compile it for you since that is only seconds longer and is the easy part.

Now since I dont believe in stupid questions just ignorant people you may want to try reading some in the help file or searching the forums before which time you ask such a question as this. There have been so many of these lately its not even funny. I am getting really tired of this.

Just look in the help file at the While...WEnd loop along with the Sleep() function and Send() and ControlSend(). After you give this some effort and you still cant figure something out because it isnt already in the helpfile (not going to be the case) or if you just simply cant figure it out then by all means ask a question, but dont be ignorant.

I am sorry if this seems a bit harsh, but I am tired of everyone expecting something for free.

JS

<{POST_SNAPBACK}>

ok :) lol
Link to comment
Share on other sites

ahhm... i could write you a script like this, but i think it's better for you to explore the language on yourself... press f1, read in the helpfile... look after functions, which make this, you want to have and learn it this way... or search for tutorials... on the autoit.com page are too 2 or 3 tutorials... theyre not sooo good, but they're not bad and if you have downlaoded autoit already, in the help (f1) is an example to each function... you can learn very much by looking at them... but here is a typical program/script:

;This is a comment... every parts of the script with a ";" are comments

#include <GUIConstants.au3>

;creates a gui window. the "Example" is the title, 212 the width 144 the height...
;@DesktopWidth and @DesktopHeight are built in variables, which are set to your screen resolution
;the (@DesktopWidth-212)/2, (@DesktopHeight-144)/2 places the GUI Window exactly at the center of your Screen
;the last things are different styles...
GUICreate("Example", 212, 144,(@DesktopWidth-212)/2, (@DesktopHeight-144)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

;this creates a button... the button got the variable $Button, because you want to do something with it...
;if you only want to have a label with some text, which you don't want to edit in the script you don't need to save it in a variable
;the "Button" is the text on the button, 60 the x position and 40 the y position... 90 is the width and the last 60 the height
$Button = GUICtrlCreateButton("Button", 60, 40, 90, 60)

GUISetState()

;this is an endless loop, but you can end it with clicking at the X in the top right corner...
While 1
;this is for asking if something was clicked...
    $msg = GUIGetMsg()
;here the program waits until you do something
    Select
;$GUI_EVENT_CLOSE is another built in variable, in which is saved the X in the top right corner...
    Case $msg = $GUI_EVENT_CLOSE
   ;here the loop was exited
        ExitLoop
;this part of the script will run if the button is pressed
    Case $msg = $Button
        MsgBox(0, "Title", "Text")
    EndSelect
WEnd
Exit

i think this helps you much, but the exactly code, which you want to have is this:

#include <GUIConstants.au3>
AutoItSetOption("MouseCoordMode", 2)

GUICreate("Example", 212, 144,(@DesktopWidth-212)/2, (@DesktopHeight-144)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Button = GUICtrlCreateButton("Button", 60, 40, 90, 60)

GUISetState()

;sets the hotkey esc... if esc is pressed now, he calls the function ecit1(), where it ends the script...
HotKeySet("{ESC}", "Exit1")

While 1
    MouseClick("left", 95, 70, 1, 0)
;5000ms = 5s wait
    Sleep(5000)
WEnd

Func Exit1()
    Exit
EndFunc

try to script some little things, and if you got problems ask me first ^^...

Edited by Lord_Doominik
Link to comment
Share on other sites

press f1, read in the helpfile...

<{POST_SNAPBACK}>

Perhap's you should take some of your own advice, especially the reading part.

giorgos said a button key, not a mouse click.

With the script you provided above you are throwing them right into the deep end of the AutoIt swimming pool.

I think a more appropriate script for an AutoIt grommit would be

While 1
   Send("{NUMPAD2}"); Look in the help file under Send() for more key options
   Sleep(1000); Time in Milliseconds, ie. 1000 = 1 second.
Wend

qq

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...