Jump to content

Small Counter


Recommended Posts

I'm totally unexperienced with AutoIt3, but i heared its a great macro speech, so i'm asking for help here. I need a little macro pressing a key for 5 times and then finishing the macro.

Can someone help me in this ?

Link to comment
Share on other sites

  • Moderators

Merlo,

First, welcome to the AutoIt forums. :)

As a complete beginner (and do not be concerned about that, we all were at some point! ;)) reading the Help file (at least the first few sections - Using AutoIt, Tutorials and the first couple of References) will help you enormously. You should also look at the excellent tutorials that you will find here and here - you will find other tutorials in the Wiki (the link is at the top of the page). There are even video tutorials on YouTube if you prefer watching to reading.

I know you want to start coding NOW, but a little study will save you a lot of trouble later on, believe me. :D

Once you have a handle on how AutoIt works, look carefully at For...Next and Send in the Help file - they will help you do what you want to do. Good luck. ;)

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

Well i saw in the example in the script editor the for and next commands but no clue how to make a program with that.

all i understand is SEND like:

Send("Enter")

So this would press the enter key right ?

But the For-Next thing is quite complicated, english is not my main language. Example said:

;Using an Array

Dim $aArray[4]

$aArray[0]="a"

$aArray[1]=0

$aArray[2]=1.3434

$aArray[3]="test"

$string = ""

FOR $element IN $aArray

$string = $string & $element & @CRLF

NEXT

Msgbox(0,"For..IN Arraytest","Result is: " & @CRLF & $string)

;Using an Object Collection

$oShell = ObjCreate("shell.application")

$oShellWindows=$oShell.windows

if Isobj($oShellWindows) then

$string=""

for $Window in $oShellWindows

$String = $String & $window.LocationName & @CRLF

next

msgbox(0,"","You have the following windows open:" & @CRLF & $String)

else

msgbox(0,"","you have no open shell windows.")

endif

Forgive me, i got no clue what they want me to do.

Link to comment
Share on other sites

  • Moderators

Merlo,

Send("Enter") [...] this would press the enter key right ?

No - read the Help file carefully. You need to put {} around named keys like that: ;)

Send("{Enter}")

the For-Next thing is quite complicated

Wrong "For" - you need "For...To...Step...Next", not "For...In...Next". My apologies! :D

Here is an example of it working:

For $i = 1 To 5
    MsgBox(0, "Hi there", "This is MsgBox No. " & $i)
Next

Is that clearer? ;)

And if you want to post code, please use code tags - put [autoit] before and [/autoit] after the code to get the nice boxes like those above. :)

M23

Edit: Double sig.

Edited by Melba23

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

Thanks for correction, i would never had done this alone :)

Tried it out and it works great. Now all i miss is starting it with a hotkey and i found the hotkeykommand:

HotKeySet("{S}")

but it just ignores the hotkeyset, i want to make the macro start when i hit s

Link to comment
Share on other sites

You dont need {} on HotKeySet ;)

HotKeySet("S")

Also im not sure if a capital(big) s would end up in s and shift.

If in doubt, use lower case! :)

And then it needs to run a function:

HotKeySet("s","function")
Edited by Maffe811

[font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]

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