Here is a well commented and simple example that beginners should be able to follow. It deals with a lot of beginner consepts, a ton of them being consepts I started with.
You must have discord running, and you will have to modify the Window title names, but it should otherwise work right out of the box for you.
;This will help us keep a running tally of how often we've thought about our S.O.
;We could do this totally in ram, but we would lose our count any time the program crashes or restarts.
;This allows us to reset our count according to our wishes.
If Not FileExists( "count" ) Then ;If file doesn't exist,
FileWriteLine( "count", "0" ) ;create the file with the number 0
EndIf
;This sets * on the numberpad as our hotkey to launch the main function.
;The loop just gives us a reason to be running in the background. Script can't end until we want it to or our hotkey isn't being watched for.
HotKeySet("{NUMPADMULT}", "KissAndTell"); * on the numberpad.
While 1
Sleep( 10000 )
WEnd
Func KissAndTell() ;Create Function KissAndTell
$count = FileReadLine( "count" ); Get number of times executed.
$count = $count + 1; Account for this time by adding one.
FileDelete("count"); Delete our file to ensure blank slate.
FileWriteLine( "count", $count );write current count to file, recreating it.
Do;Keep...
WinActivate( "TheNuggetQueen - Discord");... activating this window until...
Until WinActive( "TheNuggetQueen - Discord" );... we see that it's active.
Send("My program is recording how much I think about you. I've thought about you " & $count & " times today! I love you!",1)
Send("{ENTER}")
EndFunc ;EndFunction