0

I have a batch file which invokes my IDE, so I just want to know if we could extract the contents present in my IDE(whole contents) to some text files.

My batch file is written below

D:\WindRiver\wrenv.exe -p vxworks653-2.2.3 run
PAUSE

Is there any more code needed to be added to my existing batch file??

unwind
  • 391,730
  • 64
  • 469
  • 606
Maddy
  • 141
  • 1
  • 2
  • 12

4 Answers4

1

I am not sure what do you think by "extract the contents present in my IDE" but generally, that kind of problem is solved using automation tools. Such tools can grab anything in Windows environment from window names, button captions, text content... everything you may need to get from 3thd party application (even pictures of gui elements)

I suggest you take a look at AutoHotKey, ~200KB scripting language for windows automation.

You cant do this in batch, generally.

Taking a content of a window in AutoHotKey can be as simple as:

 WinGetText, text, "name of the window"
 FileAppend, %text%, c:\out.txt

It can get a bit more complicated then that, but nothing you may want doesn't involve more then 10 lines of AHK scripting.

This is the best approach becuase it doesn't depend on features of the given program, tso once you learn AHK, you can obtain any information from the system in uniform manner.

Keep in mind that some applications are using non standard windows components and that they may not be automatable (this is rare however).

On the community forum there are lots of usefull functions and libraries for basically anything you may need in order to get info - redirection of stdin/out to your file, COM Accesibilty module (system way to automate things in windows), even some ocr wrappers to scan information pictured on images.

majkinetor
  • 8,730
  • 9
  • 54
  • 72
  • Hi ,what i mean is the every imformation present in my IDE should be logged in to some text file – Maddy Apr 15 '09 at 12:48
  • hey will that make things messed up in my batch file proccessing?? hwich community forum u had mentioned about?? – Maddy Apr 15 '09 at 13:00
  • Autohotkey forum. No, it will not be messed up. You wont have any batch files :P Just 1 short AHK script. – majkinetor Apr 16 '09 at 08:09
  • hi,I really need my batch file(.bat) as it is very much needed to launch my IDe to work.So is here anyway to integrate it with my .bat file. – Maddy Apr 16 '09 at 08:21
  • hi,i jst tried with AutoHotKey.The belwo shows my test.ahk Run, "D:\WindRiver\wrenv.exe" -p vxworks653-2.2.3 run WinWaitActive, D:\WindRiver\wrenv.exe, , 2 WinGetText, text, "D:\WindRiver\wrenv.exe" FileAppend, %text%, C:\ThreePartition\ACTUAL.txt I am not able to extract the output. – Maddy Apr 16 '09 at 09:23
  • The code is not good. You can't use path with WinWait and WinGet, but window title. You should also use control name to grab the text. For instance, if WindRiver keeps output in Edit, you will have something like WinGetText, Edit1, WinRiver IDE. You need to find the info about the control holding the text, and you can use Spy utility that comes wtih AHK – majkinetor Apr 17 '09 at 09:59
0

I asked a similar question which may be of use. That sort of approach is only likely to work if your IDE outputs information to stdout/stderr etc.

I've had some (limited) success with hooking into processes that are already running to try and intercept data that they're outputting.

Specifically, what is it you're trying to capture? The output from one of it's windows? Error messages if it fails to start?

[Edit] I'm still not sure exactly what you're trying to capture, but it sounds like you could launch a Python script from your batch file. The script launches your IDE and captures stdout and stderr which will give you both normal output and any errors.

Community
  • 1
  • 1
Jon Cage
  • 36,366
  • 38
  • 137
  • 215
  • Hi jon, What i really want is to get the whole contents of my IDE into som text file.I am not able to generate any log files which shows the result of my IDE execution except in the IDE window itself.I want the whole contents to be logged in to some xml files or text files so that i can use it firth – Maddy Apr 15 '09 at 13:00
0

Sorry for the late reply.This is the actual IDE(D:\WindRiver\wrenv.exe -p vxworks653-2.2.3)when i place this one in the command prompt my IDE gets invoked.Plz get back to me for any more clarifiaction

Thanks stefen

  • All that command tells me is the executable you're using. I don't recognise that executable name so I'm still unsure what you're launching. Is it Wind River Workbench: http://is.gd/sIda ...or something else? – Jon Cage Apr 16 '09 at 08:10
  • It is actually "VXWorks 653 2.2.3 development Shell". – Maddy Apr 16 '09 at 08:39
0

>>> hi,i jst tried with AutoHotKey....

No, its not correct.

The correct code can only be made if I have installation of WindRiver which I don't have. Ok, let me explain this shortly.

First Ill assume that title of the IDE starts with "WindRiver" word. WindRiver must hold the text in some standard window control somehwere in its control hierrachy. The type of the control that is in question directs the way how can u grab the text from it. If it is ListView or ListBox for instance, you have to use

ControlGet, outputVar, List,, SysListView321, WindRiver

The above code means, "get me text of first SysListView32 control (hence 1 at the end) from application which title starts with 'WindRiver', and put it in ouputVar variable"

If it keeps in Edit box, you can simply do:

ControlGetText, OutputVar, Edit1, WindRiver

This means "get me content of first Edit control inside application with title WindRiver"

In order to get the type and number of control in question, simply open Window Spy (right click AHK tray icon) and hover over control with mouse to see its details.

The entire scripts will look like:

Run, d:\WIndriver ....
WinWaitActive, WindRiver
ControlGetText, OutputVar, Edit1, WindRiver
MsgBox %OtputVar%  

If title of window is changing constantly you will have to use window class instad title to identify window. For instance you can target notepad as

ControlGetText, o, Edit1, Untitled 

or

COntrolGetText, o, Edit1, ahk_class Notepad

First method uses window title, second one uses Window API class of the application which is better as title can change.

All in all, to get a bit fluent with AHK check out start up examples. I can ashure you that after several days of practice you will find yourself adjusting any application out there to your needs.

To see how powerfull AHK is and what amazing things can be done in it, check out Dock module.

There is no way you can do this in batch and using std redirection, so you better get used to AHK or some similar atuomation language (AutoIt, Phantom, WinRunner....). BTW, this kind of quetsion is usualy answered in a matter of hours on AHK community Ask For Help forum.

majkinetor
  • 8,730
  • 9
  • 54
  • 72
  • Thanks a lot majkinetor for putting in this much effort for the answer u had provided.Its working now perfectly.Thanks a lot again. – Maddy Apr 21 '09 at 06:55