Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def winCommand(*command):
buf = c_buffer(255)
command = ' '.join(command).encode()
errorCode = int(windll.winmm.mciSendStringA(command, buf, 254, 0))
if errorCode:
errorBuffer = c_buffer(255)
windll.winmm.mciGetErrorStringA(errorCode, errorBuffer, 254)
exceptionMessage = ('\n Error ' + str(errorCode) + ' for command:'
'\n ' + command +
'\n ' + errorBuffer.value)
raise PlaysoundException(exceptionMessage)
return buf.value
def winCommand(*command):
buf = c_buffer(255)
command = ' '.join(command).encode()
errorCode = int(windll.winmm.mciSendStringA(command, buf, 254, 0))
if errorCode:
errorBuffer = c_buffer(255)
windll.winmm.mciGetErrorStringA(errorCode, errorBuffer, 254)
exceptionMessage = ('\n Error ' + str(errorCode) + ' for command:'
'\n ' + command.decode() +
'\n ' + errorBuffer.value)
raise PlaysoundException(exceptionMessage)
return buf.value
def do_macro(macro):
if '$playsound' in macro:
file = macro.replace('$playsound ','')
try:
Filepath = path.abspath('Resources\\Audio\\'+file)
playsound(Filepath, False)
except PlaysoundException:
print(file, 'not found in Resources\\Audio\\')
if '$playvideo' in macro:
file = macro.replace('$playvideo ','')
Filepath = path.abspath('Resources\\Video\\'+file)
self.p_vid.send(Filepath)
if '$text' in macro:
macro=macro+' '
text = macro.replace('$text','').upper()
self.p_txt.send(text)
if '$RandText' in macro:
text = macro.replace('$RandText-','').upper()
if 'INSULT' in text:
line = HP.SetWrittenLine(self.Insults,self.hyp_dom.get(),self.hyp_sub.get(),self.FemSex.get())
text = text.replace('INSULT','')+' '+line
elif 'PRAISE' in text:
line = HP.SetWrittenLine(self.Praise,self.hyp_dom.get(),self.hyp_sub.get(),self.FemSex.get())