SugarplumChum Posted October 20, 2017 Share Posted October 20, 2017 Hey! I found out about autoit a couple days ago and been trying to learn how it works. I used Autohotkey before but now I wanna try out autoit for my basic macros. I've been trying to copy the exact same macro from AHK to Autoit, but failed kinda hard. But whenever i try to compile the autoit script to an exe, the exe won't open and the macro obviously wont work. I would appreciate any help I could get =) This is how one of my macros look like on AHK: 3:: send, {a down} send, {b down} sleep, 50 send, {a up} send, {a up} return My attempt on Autoit: HotKeySet( "3", "test" ) Func test( ) Send("{a down}") Sleep (50) Send("{b down}") Sleep (50) Send("{a up}") Sleep (50) Send("{b up}") EndFunc Link to comment Share on other sites More sharing options...
IAMK Posted October 20, 2017 Share Posted October 20, 2017 You need to keep the script running. The easiest way is to add: While(1) Sleep(1000) WEnd Treat everything outside of "Func"s as the program that gets run. Earthshine 1 Link to comment Share on other sites More sharing options...
Malkey Posted October 20, 2017 Share Posted October 20, 2017 If using SciTE you can put the cursor over the "Send" command in an AutoIt .au3 file and the AutoIt help file will open in the Send command window when the "F1" key is pressed. And most functions do have examples at the bottom of the their page. You should notice there is no format that puts a letter inside (and at the front of) the curly bracket of a Send() command. When this example is run, the "3" key, a HotKey, will need to be pressed for the "_Test()" (User Defined) function to run. HotKeySet("3", "test") HotKeySet("{ESC}", "Terminate") ; Press Esc key to exit script. While (1) Sleep(100) WEnd Func _Test() Send("{a 4}") Send("{down 2}") Sleep(50) Send("b{down}") Sleep(50) Send("a{up}") Sleep(50) Send("b{up}") EndFunc ;==>_Test Func _Terminate() Exit EndFunc ;==>_Terminate Link to comment Share on other sites More sharing options...
SugarplumChum Posted October 20, 2017 Author Share Posted October 20, 2017 Thank you so much for the quick replies =) Its kinda fun to learn new stuff. The script works now. So will ''While (1) Sleep(1000) WEnd'' keep the script running permanently? What exactly is it doing, cuz i have no clue. Link to comment Share on other sites More sharing options...
Developers Jos Posted October 20, 2017 Developers Share Posted October 20, 2017 4 minutes ago, SugarplumChum said: What exactly is it doing, cuz i have no clue. Did you actually try to read the helpfile's explanation of this function to understand? Jos 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 More sharing options...
SugarplumChum Posted October 20, 2017 Author Share Posted October 20, 2017 14 minutes ago, Jos said: Did you actually try to read the helpfile's explanation of this function to understand? Jos Yes, but i didnt understand a single thing =/ Link to comment Share on other sites More sharing options...
Developers Jos Posted October 20, 2017 Developers Share Posted October 20, 2017 So let me see I understand this: You previously scripted with ahk and now started with AU3 and have no clue about any programming basics. Guess you've only done Cut&Paste programming till now? So, which part of the explanation in the Helpfile do you not understand? Jos 232showtime 1 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 More sharing options...
SugarplumChum Posted October 20, 2017 Author Share Posted October 20, 2017 1 minute ago, Jos said: So let me see I understand this: You previously scripted with ahk and now started with AU3 and have no clue about any programming basics. Guess you've only done Cut&Paste programming till now? So, which part of the explanation in the Helpfile do you not understand? Jos I have only done simple macros like the one I posted on top for my gaming. Link to comment Share on other sites More sharing options...
Developers Jos Posted October 20, 2017 Developers Share Posted October 20, 2017 (edited) 2 minutes ago, SugarplumChum said: gaming You just mentioned the magic word for the forum as you appear to have missed the Forum rules on your way in. (there is also a link in my signature) 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. Jos Edited October 20, 2017 by Jos 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 More sharing options...
Recommended Posts