I'm kinda new to this language but I have a modest programming background. You know the title. I've been searching new ideas and methods for these ideas during a few days. I decided the shortest way must be just "copy it to the clipboard", in other ways it goes too hairy (to me at least ). Maybe it's not suitable for big projects but I think, newbies like me will love it . If you have any improvements for that please comment. Hope, it'd be useful for you.
Run, cmd.exe /k echo off & cls & dir echo Hello World & title OKE WinWait, OKE ClipBoard = Send !{Space}es{Enter} MsgBox %ClipBoard%
So all the thing goes in the first line. If you wonder what's going there you can continue to read.
1st Line:
1- We run cmd.exe or you can use %comspec% for that.
Note: You can't use RunWait because AHK will wait until you close the prompt.
2- /k parameter simply means execute the code and don't terminate.
3- echo off simply means don't show my working directory. It's important because we don't want anything useless.
4- By putting an & between them, you can execute multiple commands in one line.
5- It clears the screen.
7,8- Just any command. It can be echo Hello World! or devcom restart *
10,11- When it finished, in some way we need to let AHK know our process finished. I did it changing title, you can do it in another way.
2nd Line: Wait for a window named OKE.
3rd Line: Clear the clipboard.
4th Line: Send the key combination ALT+SPACE+E+S and press enter, which selects all and copies it.
5th Line: Show the clipboard in a message box.