In Autohotkey you can not use Line breaks into a single Codeline.
But if you want to make lines into one (single) line.
you Can try this,
1 - Put it into a string.
2 - Convert it + Save it to a file.
3 - and then run the Script from a External file.
note - i did make the Script so how you did want it, save it + ?Reload=run example1.ahk + Send text (It does not work exact so how you did like it, but it is almost. it is for me not clear why you want to reload the script?)
Try this code.
example1.ahk
; [+ = Shift] [! = Alt] [^ = Ctrl] [# = Win]
#SingleInstance force
sleep 100
return
right:: ConvertAndRun("Sendinput, ^s | run example1.ahk | runwait example1.ahk | Send, hello world")
left:: ConvertAndRun("Sendinput, ^s | run example1.ahk | runwait example1.ahk | Send, it works")
~esc::exitapp
ConvertAndRun(y)
{
FileDelete, Runscript.ahk
;1 - Convert the String in single codeline's with return - Character | is the breakline.
StringReplace,y,y, |, `n, all
sleep 150
;2 - Save the String to a file
x:="#notrayicon `n "
z:="`n "
FileAppend, %x%%y%%z%, Runscript.ahk
sleep 150
;3 - Now it can Run all the commands from that string.
run Runscript.ahk
sleep 150
exitapp
}
;
Note - This Script Does Save the String to a file (on the HardDisk c:) that is not so fast, but If you use a Ramdisk, then you can save and run the file's from there, it will increase the speed - a Ramdisk is a virtual Disk (stored on the RAM MEMORY z:) and that is +-100x faster then a Hard disk. - You can find this Free Tool from Here (Imdisk)