I'm trying to do some automated testing to the GUI of my software and to validate some stuff I need to compare exported files, for witch I use fc in command line.
I need the handle of my program and cmd in order to switch between them. Unfortunately Sikuli behaves very unpredictable when calling
cmd = App("cmd.exe")
Sometimes it opens a new console and sometimes it focuses on the console already open from the sikuli IDE.
Is there a smarter and robust way to work with console and sikuli?
Yes,
App
class can behave funny sometimes and is not 100% reliable. What you can do, is to avoid invoking the actual cmd windows which can by itself lead to confusion. Instead, you can run your actual cmd command from Sikuli script directly and read the output to a variable. For example:Then the
output
variable will contain the actual output of thedir
command as if you'd run it from command line. So in your case: