1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-16 08:09:32 +02:00

pipetest.py to test mod-script-pipe's pipe.

First version in python (we used to use perl).
This commit is contained in:
James Crook 2017-12-20 16:36:40 +00:00
parent 217a2540d4
commit a084c3dbbf

39
scripts/pipetest.py Normal file
View File

@ -0,0 +1,39 @@
# pipetest.py
# Tests the audacity pipe. Sends 3 commands.
# Keep pipetest.py short!!
# You can make more complicated longer tests to test other functionality
# or to generate screenshots etc in other scripts.
toname = '\\\\.\\pipe\\ToSrvPipe'
fromname = '\\\\.\\pipe\\FromSrvPipe'
tofile = open( toname, 'wt' )
fromfile = open( fromname, 'rt')
def sendCommand( command ) :
print( "Send: "+command )
tofile.write( command + '\r\n\0' )
tofile.flush()
def getResponse() :
result = ''
line = ''
while line != '\n' :
result += line
line = fromfile.readline()
return result
def doCommand( command ) :
sendCommand( command )
response = getResponse()
print( "Rcvd: " + response )
return response
def quickTest() :
doCommand( 'Help: CommandName=Help' )
doCommand( 'Help: CommandName=SetPreference' )
doCommand( 'SetPreference: PrefName=GUI/Theme PrefValue=light' )
quickTest()