Jump to content

How do I make it loop?


Recommended Posts

HotKeySet("{END}", "End")
HotKeySet("{DEL}", "Go")

While 1
    Sleep(1)
WEnd

Func End()
    Exit
EndFunc

Func Go()
    MouseClick("left", 493, 462, 1, 2)
    Send("1")
    Send("{ENTER}")
EndFunc

I don't understand the command reference part about loops :-/ What do I need to add to make it loop till I press END? :o

Link to comment
Share on other sites

  • Developers

HotKeySet("{END}", "End")
HotKeySet("{DEL}", "Go")

While 1
    Sleep(1)
WEnd

Func End()
    Exit
EndFunc

Func Go()
    MouseClick("left", 493, 462, 1, 2)
    Send("1")
    Send("{ENTER}")
EndFunc

I don't understand the command reference part about loops :-/ What do I need to add to make it loop till I press END? :o

Do you think anything is missing in the posted script ? did you try it ?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

The thing missing is the loop, because I didn't understand this;

http://www.autoitscript.com/autoit3/docs/i.../lang_loops.htm

This is the loop

While 1
    Sleep(1)
WEnd

It will keep your script active so the every time you press DEL it will perform the function GO.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

  • Developers

The thing missing is the loop, because I didn't understand this;

http://www.autoitscript.com/autoit3/docs/i.../lang_loops.htm

mmmh...

what do you think this portion does:

While 1
    Sleep(1)
WEnd

:o

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Here is one way

HotKeySet("{END}", "End")
HotKeySet("{DEL}", "Go")

While 1
    Sleep(1)
WEnd

Func End()
    Exit
EndFunc

Func Go()
    While 1
    MouseClick("left", 493, 462, 1, 2)
    Send("1")
    Send("{ENTER}")
    Sleep(1)
    WEnd
EndFunc


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

  • 12 years later...

The tutorial on the For loop is not very clear...and it's decrementing loops by default also, makes it confusing for beginners that know nothing about coding:

I recreated the loop example so I can understand it in the future, hope it can help other rookies!

 

#include <MsgBoxConstants.au3>

For $i = 1 To 3 Step +1
   ; MsgBox($MB_SYSTEMMODAL, "", "This will repeat the loop" & @CRLF & $i)
    MsgBox($MB_SYSTEMMODAL, "", "This will repeat the loop the ammount of times specified in the 'For' loop. Using [+] increments the loop.  Using [-] decrements the loop." & @CRLF & @CRLF & "run #" & $i)
Next
MsgBox($MB_SYSTEMMODAL, "", "Run has exectuted all steps in the loop")

 

Link to comment
Share on other sites

  • Moderators

Sigh.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...