flozcag

Simple script

7 posts in this topic

#1 ·  Posted (edited)

Hello, to begin with I would like to say hello, I'm a new guy here, If the post doesn't belong here you are welcome to move it. Soo... I need help with writing simple script, below I'm showing you guys how would it look like.

- Start/Stop key = Alt + Pause Break

when start key pressed:

- Press F1, wait 2 seconds, use right click
wait 2 seconds
- Press F2, wait 2 seconds, use right click
wait 2 seconds
- Press F3, wait 2 seconds, use right click
continue pressing "F3, wait 2 seconds, use right click" for 1-2 minutes and then repeat F1, F2 and again F3

Also I would like the script to use the right click where the mouse is set at, no need for setting coordinates.
I'm looking forward to hear from you guys.

 

Edited by flozcag

Share this post


Link to post
Share on other sites



flozcag,

Welcome to the AutoIt forums.

We do not write code to order, we help you get your code running correctly.  Think of the old saying: "Give a man a fish, you feed him for a day; give a man a net and you feed him forever". We try to be net makers and repairers, not fishmongers.

Look at MouseClick, Sleep, TimerInit/Diff, While...WEnd in the Help file and see how you get on with coding something yourself - you know where we are if you run into difficulties.

M23

P.S. Looking at your email address, you might also want to read the Forum rules just to make sure you do not stray over any of the lines drawn therein.

 

1 person likes this

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Does that make any sense?

HotKeySet("{end}", "_run")
HotKeySet("{end}", "_stop")


Func _keypress()
    Send("F1"); or should I use ControlSend?
    Sleep(2000)
EndFunc   ;==>_keypress

Func _mouseclick()
    MouseClick("right")
    Sleep(2000)
EndFunc   ;==>_mouseclick

Func _keypress()
    Send("F2"); or should I use ControlSend?
    Sleep(2000)
EndFunc   ;==>_keypress

Func _mouseclick()
    MouseClick("right")
    Sleep(2000)
EndFunc   ;==>_mouseclick

Func _keypress()
    Send("F3"); or should I use ControlSend?
    Sleep(2000)
EndFunc   ;==>_keypress

Func _mouseclick()
    MouseClick("right")
    Sleep(2000)
EndFunc   ;==>_mouseclick

; I don't know how to make the loop for the last key (F3)

Edited by Melba23
Added code tags

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

does that work any better?

#include <MsgBoxConstants.au3>


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

Global $g_bPaused = False

HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("+!d", "ShowMessage") ; Shift-Alt-d

While 1
    Sleep(100)
WEnd



Func TogglePause()
    $g_bPaused = Not $g_bPaused

    While $g_bPaused

        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    WEnd

    ToolTip("")
EndFunc   ;==>TogglePause



Func Terminate()
    Exit
EndFunc   ;==>Terminate

Func ShowMessage()
    MsgBox($MB_SYSTEMMODAL, "", "This is a message.")
 EndFunc   ;==>ShowMessage



Send("{F1}"
Sleep(2000)

MouseClick("right" ], x,y [, clicks = 1 [, speed= 10]]])
Sleep(2000)

 

Edited by Melba23
Added code tags again

Share this post


Link to post
Share on other sites

flozcag,

Sorry, dinner intervened.

When you post code please use Code tags - see here how to do it.  Then you get a scrolling box and syntax colouring as you can see above after I added the tags.

does that work any better?

You tell me - does it do what you want? If not , what does not work?

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
#include <MsgBoxConstants.au3>

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

Global $g_bPaused = False

HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("+!d", "ShowMessage") ; Shift-Alt-d

While 1
    Sleep(100)
WEnd

Func TogglePause()
    $g_bPaused = Not $g_bPaused
    While $g_bPaused
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    WEnd
    ToolTip("")
EndFunc   ;==>TogglePause

Func Terminate()
    Exit
EndFunc   ;==>Terminate

Func ShowMessage()
    MsgBox($MB_SYSTEMMODAL, "", "This is a message.")
EndFunc   ;==>ShowMessage

Func _Send1()
Send("{F1}"
Sleep(2000)
EndFunc

Func _MouseClick1()
MouseClick("right")
Sleep(2000)
EndFunc

Func _Send2()
Send("{F2}")
Sleep(2000)
EndFunc

Func _MouseClick2()
MouseClick("right")
Sleep(2000)
EndFunc

Func _Send3() ; I don't know if that's right, corret me if so
$i = 0
While $i < 120
Send("{F3}")
$i+=4
WEnd
EndFunc

Func _MouseClick3() ; Should this go together with the Func _Send 3()?
MouseClick("right")
Sleep(2000)
EndFunc

I have no errors but the whole script doesn't work, it's not doing anything. I wan't to use it for my game I play in.

Share this post


Link to post
Share on other sites

flozcag,

I wan't to use it for my game I play in.

I see you did not bother to read those Forum rules to which I linked you. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked.

M23

 

 


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.