View Single Post
Old 11-10-2017, 09:34 AM
Hang Hang is offline
Registered User
Join Date: Jul 2016
Posts: 21
use ReadString to match a regular expression


I like a script to match a regular expression to make it more universal but when I try it out, it doesn't work. I get an error saying ReadString need to match with a string.

I know the regex I have there works for what I need to match because I have tested.

# $language = "python"
# $interface = "1.0"
import re

def Main():

	p = re.compile("([\*[A|B].*\#])")
	szPrompt = p

	objTab = crt.GetScriptTab()
	objTab.Screen.Synchronous = True
	objTab.Screen.IgnoreEscape = True

	szCommand = "show card"
	objTab.Screen.Send(szCommand + "\n")

	szResult = objTab.Screen.ReadString(szPrompt)



Last edited by Hang; 11-10-2017 at 09:37 AM.
Reply With Quote