'AHK write characters automatically and set cursor between these 2 characters

I installed ahk yesterday so I don't know very much how to use it. I want to create a script that writes characters. exemple:

I press < and it automatically puts > at the end and sets the cursor between < and >

I searched for about 30 minutes how to do this, but none of the answers were working.



Solution 1:[1]

Hotstring version (recommended):

:*?:<::<>{Left}

Hotkey version:

~<::Send >{Left}

or

$<::Send <>{Left}

Solution 2:[2]

It can be done with remapping < to

<::Send {<}{>}{Left}

When you type <, you will be typing <, >, then press the left arrow key.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 skygate
Solution 2 burningalc