AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CMDret - return output from console progs [DLL version]
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Utilities & Resources
View previous topic :: View next topic  
Author Message
valenfor



Joined: 26 Feb 2005
Posts: 20

PostPosted: Fri Jun 10, 2005 12:08 am    Post subject: Wooo Hooo! Reply with quote

I know most others have already said, but just wanted to give the big

Wooo Hooo!

I got the DLL, got my tail.exe and mix em up in the same bowl and its LIKE BUTTER BABY!!!!

BCX looks cool too corrupt - thanks for introducing me to another programming platform as well.

V.
Back to top
View user's profile Send private message
Guest






PostPosted: Fri Jun 10, 2005 6:06 pm    Post subject: Re: StdErr fro command line... Reply with quote

JBensimon wrote:
Quote:
my program should also run in the command line environment, which does not separate stderr and stdout - they get mixed
If you're running the program in the command line environment of Windows NT/2000/XP/2003, you can use the "2>" syntax to redirect error output and separate it from standard output, as in
Code:
Program parameters >StdOut.txt 2>StdErr.txt

Jacques.


If you want both stdout and stderr to go to a single file, you can use:
Code:
Program parameters > Stdout-err.log 2>&1
Back to top
corrupt



Joined: 29 Dec 2004
Posts: 2383

PostPosted: Mon Jun 13, 2005 1:19 am    Post subject: Re: Wooo Hooo! Reply with quote

valenfor wrote:
I know most others have already said, but just wanted to give the big

Wooo Hooo!

I got the DLL, got my tail.exe and mix em up in the same bowl and its LIKE BUTTER BABY!!!!

BCX looks cool too corrupt - thanks for introducing me to another programming platform as well.

V.
Thanks & you're welcome Smile .
Back to top
View user's profile Send private message Visit poster's website
corrupt



Joined: 29 Dec 2004
Posts: 2383

PostPosted: Mon Jun 13, 2005 2:01 am    Post subject: Reply with quote

BCX Source (version 3.1.2)
Back to top
View user's profile Send private message Visit poster's website
daonlyfreez



Joined: 16 Mar 2005
Posts: 740
Location: Berlin

PostPosted: Mon Jun 13, 2005 11:21 am    Post subject: Reply with quote

Muy cool indeed! Cool

Very Happy

Thank you! Working with AutoHotkey is getting better and better Smile
_________________
(sorry, homesite offline atm)
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
zipzulu



Joined: 14 May 2005
Posts: 3

PostPosted: Sun Jun 26, 2005 9:52 am    Post subject: cmdret usage problems Reply with quote

Hi all,

basically, I have to agree that corrupt’s cmdret is extremely helpful. However, I’ve some problems with this tool and wonder if someone can point me in the right direction.

I’m trying to compile a C/C++ project using a PERL script (see CompileCmd below) and redirect its output to a GUI edit window within a tab control. Both versions (one using CMDret.exe and one using the cmdret.dll) basically work, that is, the output shows up in the edit control but with

version 1 (CMDret.exe)
- close to the end of the compile process the output just stops, no compiler output files are created - seems to me that the process just dies at some stage (the PERL script runs ok in a DOS box)

version 2 (cmdret.dll)
- everything works ok with regard to the compile process but the output window is not refreshed at some point - just the grey output window without the edit or tab control can be seen. Once the compile process completed, I can click on the output window to re-display the controls as well as the compiler output.
- one additional question: Is it somehow possible to get the PID of the CMD process as in the CMDret.exe version?

Version 1 using CMDret.exe:
Code:

GuiControl, 2:Choose, OutputTab, 2
SetTimer, SubOutputCompile, 250
RunWait, %RunCMD1% "p=" "%comspec% /c cd /d %vProjectFolder% && date/t &&  time /t && %CompileCmd% && date/t && time /t", , hide, CompilePID
SetTimer, RefOutputCompile, Off
Gosub, SubOutputCompile




Version 2 using cmdret.dll:
Code:

CMD = %comspec% /c cd /d %vProjectFolder% && %CompileCmd% && echo.
OutputWindow := WinExist("Output Window")
GuiControl, 2:Choose, OutputTab, 2    
StrOut := DllCall("cmdret.dll\RunInControl", "str", CMD, "Uint", OutputWindow, "str", "Edit", "int", "2")



Thanks
Back to top
View user's profile Send private message
corrupt



Joined: 29 Dec 2004
Posts: 2383

PostPosted: Sun Jun 26, 2005 5:28 pm    Post subject: Reply with quote

Hi zipzulu,

Thanks for the feedback Smile .

If using CMDret.exe you could try using cmdstub.exe
Code:
RunWait, cmdstub.exe %RunCMD1% "p=" "%comspec% /c cd /d %vProjectFolder% && date/t &&  time /t && %CompileCmd% && date/t && time /t", , hide, CompilePID
Although I am planning to update CMDret.exe soon to fix a few issues, CMDret.dll is currently considered to be an updated version of CMDret.exe.

The refresh issue with the RunInControl function in CMDret.dll seems to happen because the thread in the script is put on hold until the function in the .dll returns. This seems to prevent the Window from refreshing until the function returns. You could maybe try calling the function in the .dll from a timed sub or by creating a small script that calls the function, then execute the script using the Run command (untested). Thanks for pointing this out. I'll try and post a few sample scripts using RunInControl a bit later.
Back to top
View user's profile Send private message Visit poster's website
corrupt



Joined: 29 Dec 2004
Posts: 2383

PostPosted: Sun Jun 26, 2005 7:55 pm    Post subject: Re: cmdret usage problems Reply with quote

zipzulu wrote:
- one additional question: Is it somehow possible to get the PID of the CMD process as in the CMDret.exe version?
Out of curiosity, how would you like to use this info?
Back to top
View user's profile Send private message Visit poster's website
zipzulu



Joined: 14 May 2005
Posts: 3

PostPosted: Sun Jun 26, 2005 8:41 pm    Post subject: Reply with quote

corrupt,

first of all, thanks for the response. I haven't had the opportunity to test your suggestions but will try to do so sometime next week.

Quote:

Out of curiosity, how would you like to use this info?


The compilation process takes quite some time and sometimes I realize that my changes weren't that smart after all Wink , so I'd like to be able to stop compiling ...
Back to top
View user's profile Send private message
corrupt



Joined: 29 Dec 2004
Posts: 2383

PostPosted: Mon Jun 27, 2005 8:24 am    Post subject: Reply with quote

zipzulu wrote:
The compilation process takes quite some time and sometimes I realize that my changes weren't that smart after all Wink , so I'd like to be able to stop compiling ...
Thanks for clarifying. That sounds like it would come in handy. I'll try and get the .exe version updated this week and look into adding the functionality to the .dll version. Thanks for the suggestion Smile .
Back to top
View user's profile Send private message Visit poster's website
Jaysun



Joined: 01 Nov 2004
Posts: 20

PostPosted: Tue Jun 28, 2005 4:06 am    Post subject: Is CMDret able actively interact with a cmd util? Reply with quote

Without getting too much into the why I am trying to do the following, I am trying to create a custom GUI for the Windows FORMAT command line tool. This is for use on public computers and I cannot let our users be able to access the command line, and using "Rundll32.exe shell32.dll,SHFormatDrive" to make the Windows GUI for FORMAT has been probematic, plus the Windows GUI on XP does not pop up a dialog that shows if there were any bad sectors when the format is done.

So can CMDret be used to send keystrokes and strings to FORMAT while it is running? Can it grab all text output as it is actively displayed by the FORMAT command?

I have read through all the posts in this thread and tried using each of the functions of CMDret and before I try anymore, I'd like to know if it is possbile to do what I need to do.

Thanks much,

Jason
Back to top
View user's profile Send private message
Guest






PostPosted: Tue Jun 28, 2005 11:38 pm    Post subject: Reply with quote

give users access to format isn't a good idea anyway, only floppies maybe
Back to top
corrupt



Joined: 29 Dec 2004
Posts: 2383

PostPosted: Wed Jun 29, 2005 5:23 am    Post subject: Re: Is CMDret able actively interact with a cmd util? Reply with quote

Jaysun wrote:
So can CMDret be used to send keystrokes and strings to FORMAT while it is running?
Nope. CMDret doesn't send keystrokes... but AutoHotkey does...
Jaysun wrote:
Can it grab all text output as it is actively displayed by the FORMAT command?
I haven't done any testing with the FORMAT command yet. I might be able to set up something to format in a few days to test... It wouldn't surprise me if it didn't work correctly though...
Back to top
View user's profile Send private message Visit poster's website
floh
Guest





PostPosted: Wed Jul 06, 2005 8:41 am    Post subject: Reply with quote

nice feature! but...
... i'm new to dll handling and i have a question: how to interact with a program?

The problem: i have a Linux server who provides a SSL console interface. To connect this interface i use PuTTY or its command line tool PLINK.
How can i "remote control" plink.exe from AHK to log in into the server, read the answer from server (then AHK should parse the answer strings, display messages or fill some of the data into a GUI) and then send other commands depending on the answer or user action? The ssh session has to keep open for longer time.
Back to top
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10464

PostPosted: Thu Jul 07, 2005 6:36 pm    Post subject: Reply with quote

I'm not sure if CMDret can interact with a console SSH client in this manner. If it can't, you might have better luck setting the client to maintain a log file. You could have the script watch the log file and respond to what shows up in there.

Alternatively, you could periodically copy the window text (or parts of it) to the clipboard, and then parse the clipboard to determine what responses have occurred.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Utilities & Resources All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
Page 4 of 7

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group