4.- Run Notepad and Kill Notepad.
#include "TCPServer.au3"
_TCPServer_OnReceive("received")
_TCPServer_DebugMode(True)
_TCPServer_SetMaxClients(10)
_TCPServer_Start(8081)
Func received($iSocket, $sIP, $sData, $sParam)
$iPosition = StringInStr($sData, "notepad")
if $iPosition <> 0 Then
Run("notepad.exe", "", @SW_SHOWMAXIMIZED)
_TCPServer_Send($iSocket, "HTTP/1.0 200 OK" & @CRLF & _
"Content-Type: text/html" & @CRLF & @CRLF & _
"Notepad running.")
_TCPServer_Close($iSocket)
EndIf
$iPosition = StringInStr($sData, "kill")
if $iPosition <> 0 Then
Run(@ComSpec & " /c " & 'taskkill /IM "notepad.exe" /F', "", @SW_HIDE)
_TCPServer_Send($iSocket, "HTTP/1.0 200 OK" & @CRLF & _
"Content-Type: text/html" & @CRLF & @CRLF & _
"Killing Notepad.")
_TCPServer_Close($iSocket)
EndIf
EndFunc ;==>received
