I'm not too sure what you are asking for - you might need to explain a little more.
If you are just looking for a way that two process can communicate without using a file then two methods spring to mind.
- Use the registry. The two scripts agree on a sub-key or value and then use it to communicate. This is excellect for two-way communication, especially when you need a high degree of handshaking.
- Execute a process with fixed option values. Excellent if you don't want to leave any traces, but much harder to code and may only be supportable with XP and 2003.
The first option is an obvious method and very easy. The second option is a little more complicated.
The way it works is simple. In the "talking" script you run a command like:
Code:
Shell '"'+%COMSPEC%+'" /C "SLEEP 9999 && REM IPC: Some Message'
In the "listening" script you do:
Code:
Break ON
$=SetOption("Explicit","ON")
$=SetOption("WrapAtEOL","ON")
Dim $oWMI,$oProcess,$oProcesses,$iQuit,$sMessage
Dim $sSentinel,$iTerminate
$sSentinel="REM IPC: "
$oWMI=GetObject("Winmgmts:{impersonationLevel=impersonate}")
While Not $iQuit
Sleep $iTerminate $iTerminate=0 ; Give terminated processes a change to close.
$oProcesses=$oWMI.ExecQuery('Select CommandLine from Win32_Process')
If @ERROR "2 " @ERROR " " @SERROR ? EndIf
For Each $oProcess in $oProcesses
If InStr($oProcess.CommandLine,$sSentinel)
$sMessage=$oProcess.CommandLine
$sMessage=SubStr($sMessage,InStr($sMessage,$sSentinel)+Len($sSentinel))
Select
Case $sMessage="QUIT"
$iQuit=1
Case "Not handled"
"Unhandled message from talker: "+$sMessage+@CRLF
EndSelect
$=$oProcess.Terminate
$iTerminate=2
EndIf
Next
Loop
Exit 0
Now, you can tidy up the select clause and improved the wait for the terminated process, but I'm sure that you get the idea.
If you abstract the "talk" and "listen" processes into functions it makes the whole thing fairly easy.
The only drawback is that "CommandLine" may not be universally supported.