Capturing Text From A DOS App

General discussion about the Phantom Automation Language and related tools.

Capturing Text From A DOS App

Postby Orion on Sat Dec 04, 2010 12:44 am

Hello All!

I used Phantom back in the late 1990's and was very impressed with it then - And I return to it again today! The new capabilities are AMAZING but it looks like some of the OLD tools are gone...

I'm attempting to use Phantom to interact with an old DOS-Based application. Phantom needs to be able to 'read' the text on the screen in order to determine what inputs to provide to navigate through each screen.

Unfortunately, it looks like Phantom no longer has any way to capture the information in that application...GETTEXT only gives me the title of the DOS window, which does me no good at all, I'm afraid.

Can anyone guide me in the right direction?

Thanks for your help!

Jeff
Orion
 
Posts: 4
Joined: Sat Dec 04, 2010 12:41 am

Re: Capturing Text From A DOS App

Postby john on Mon Dec 13, 2010 7:08 pm

Hi All-

Orion had submitted a request to our support, and here was the response:

Unfortunately, Phantom never really dealt with command-line applications. It could be that in the 1990's you used an application called Phantom for Windows (which is made by a different company). Sorry for any confusion. Our Phantom was designed specifically for GUI automation, which is why GetText returns only the DOS window title.

You *can* automate console windows using Phantom, but it takes a little scripting. Basically, you enter the command using TypeKeys, and then select the text using the console window menu, copy it to the clipboard, retrieve it and then you can parse the result. An example of this is below:

# Define the window
window w;
w.Tag = "C:\\WINDOWS\\*"; # Any window with C:\WINDOWS in its title... you may have to change this for your window
w.Class = "*";

# Activate the window
w.SetActive();

# This automates the selection 'Edit->Select All' from the console window
w.TypeKeys("<ALT-SPACE>es");

# This copies it to the clipboard
w.TypeKeys("<ENTER>");

# This retrieves the clipboard text and displays it
string s = GetClipboardText();
disp(s);

# This is how you would enter the 'dir' command
w.TypeKeys("dir<ENTER>");

The s string contains (in my case):
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

U:\>


-John
john
 
Posts: 27
Joined: Wed Apr 22, 2009 12:32 pm


Return to Phantom

Who is online

Users browsing this forum: No registered users and 5 guests

cron