Jump to content

My first script, doesnt seem to work


Recommended Posts

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

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

  • Developers
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

  • Developers

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

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

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

  • Developers
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. :naughty:

Jos

Edited 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

  • Jos locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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