Sign in to follow this  
Followers 0
Merlo

Small Counter

7 posts in this topic

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 ?

Share this post


Link to post
Share on other sites



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


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

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.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

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

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

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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]

Share this post


Link to post
Share on other sites

Ok will have to try that. The most important was the 1 to 5 -thing, i can start the macro from the editor also.

Many thanks all ! :)

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  
Followers 0