Merlo Posted July 4, 2011 Share Posted July 4, 2011 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 More sharing options...
Moderators Melba23 Posted July 4, 2011 Moderators Share Posted July 4, 2011 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. 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Merlo Posted July 4, 2011 Author Share Posted July 4, 2011 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 More sharing options...
Moderators Melba23 Posted July 4, 2011 Moderators Share Posted July 4, 2011 (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 complicatedWrong "For" - you need "For...To...Step...Next", not "For...In...Next". My apologies! 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 July 4, 2011 by Melba23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Merlo Posted July 4, 2011 Author Share Posted July 4, 2011 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 More sharing options...
Maffe811 Posted July 4, 2011 Share Posted July 4, 2011 (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 July 4, 2011 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 More sharing options...
Merlo Posted July 4, 2011 Author Share Posted July 4, 2011 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 ! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now