views:

546

answers:

4
+1  Q: 

AutoHotkey??

I am trying to extract the contents of cmd.exe IDE to a text file using autohotkey scripts ie one test.ahk and its written as shown below:

 WinGetText, text, "C:\WINDOWS\system32\cmd.exe"
 FileAppend, %text%, C:\ThreePartition\ACTUAL.txt

I am not able to extract the contents. Can anyone please suggest the correct way to do the extraction?

+1  A: 

The text retrieved is generally the same as what Window Spy shows for that window.

The Window Spy shows no text elements for CMD windows - what you see is not necessarily what you can get :)

What you can do is to simulate the Select All and Paste commands, and then use the clipboard contents.

MaxVT
Hi,Can anyone plz help me out as i m very new to AutoHotkey...If i want to extract the contents from the cmd.exe window,hw am i supposed to do it??
Maddy
A: 

Hi MaxVT, But we dont need to simulate the copy -paste option as we dont do that normally to retrieve anything from the command prompt window.

Correct me if i am wrong??

Maddy
A: 

I don't believe you can extract the contents of a cmd window without somehow using DllCall to read the process memory directly.

If you just want the output of a CLI command such as Grep or AWK, using stdout via the run command should work. Honestly though, I stopped relying on AHK because this sort of thing is just too clunky.

http://www.autohotkey.com/docs/commands/Run.htm.

Edit for comments: What you want is doable, but the solution depends entirely on how your IDE works. What behavior does it have that's unique to building a project? If it makes temp files, you can overload your "build" button with an AHK subroutine that watches for the existence of those files, and then checks the modified date of the output executable to see if the build succeeded. The same kind of solution works if the IDE changes its window title when building. Be clever. :)

Failing that, you might have to install a message hook.

Duke Navarre
hey duke,So which method would u suggest to extract the whole contents of my IDE to some text file.redirection operators in .bat file seems top doesnt work properly.
Maddy
"The whole contents" of an IDE could mean a lot of things. If I wanted to manipulate the source code- say, for static analysis- I'd write a Bash script under Cygwin. It all depends on the task.
Duke Navarre
Duke,i just want some log to be created when my IDE finishes execution.i.e.the log should show if the build or compilation is successfull or not or if it contains errors in the source file etc..Plz get back to me if i m not clear.Thanks a lot
Maddy
A: 

Duke, In my case the IDE which was mentioned is "VxWorks 653 2.2.3 Development shell".I want the whole contents present in my IDE to be logged in to some text file or xml file.I was able to achieve just partial output i.e i am unable to see the errors which had come due to compilation or building.Except the errors,all the other stuffs present in my IDE was logged.I was wondering if there could be any other way by which we can get the whole contents of an IDE into some text file.So i was trying stuffs like AutoHotKey which was suggested to me in this posting.I dont know if there could be any other better method to do it. I hope i am able to convey my idea clearly. please get back to me for any more clarifiactions

Maddy