But, after coming across the old project I decided to give it another shot and it turned out great(Yay for the Survival Guide and Kale's Guide!) for my own use. Maybe someone could benefit from this.


It probably doesn't look pretty, but it works.

Code: Select all
Global hInput
Procedure SendConsole(szText.s)
szLength = Len(szText.s)
For sz = 0 To szLength+1
szCharacter$ = Mid(szText.s,sz+1,1)
szLetterByLetter=Asc(szCharacter$)
PostMessage_(hInput,#WM_CHAR,szLetterByLetter,0)
Next
PostMessage_(hInput,#WM_CHAR,13,0)
EndProcedure
hInput = FindWindow_(0,"Administrator: c:\Windows\system32\cmd.exe")
If hInput = 0
Debug "Error, command prompt not open or string mismatch!"
Else
SendConsole("echo Hello world!! This is a string, I think? What about numbers? 1+1=393")
EndIf