 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
m^2
Joined: 28 Feb 2008 Posts: 56 Location: Krk, PL
|
Posted: Wed Jul 23, 2008 10:58 pm Post subject: |
|
|
Hello,
I wanted to use cmdret to get output from 7zip, but there's one issue.
Some archives are encrypted. In such case 7zip waits for the password.
It would be great if CmdRet could not only get the returned text, but also write to stdin. However, if it's too much, could you return pid of the spawned program? In such case I could at least kill the program and inform the user that encrypted archives are not supported.
And one more suggestion. Why output to a control? It seems overly complicated, in my case I have to create an invisible control just to get messages from CmdRet. _________________ Waiting for Windows 8... |
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2399
|
Posted: Sun Jul 27, 2008 3:41 am Post subject: |
|
|
There is an option for stdin in the RunWEx(CMD, CMDdir, CMDin, CMDout, CMDerr) function but an option to wait for output before sending something to stdin is not currently supported (possibly in the next version) .
The latest beta version (download) will currently return the handle to the process when using the RunWCB() function. The next version is planned to support stdin in a similar callback function.
The optional function RunInControl() that is designed to output to control is mainly designed as a quick way to show console output in a GUI. There is no need to use this function if you don't need the user to view the output. Is there something in this function that you need that doesn't exist in the other functions? The RunReturn() or RunRedirect() functions should allow receiving output without having to use a hidden control.
Thanks for the feedback  |
|
| Back to top |
|
 |
m^2
Joined: 28 Feb 2008 Posts: 56 Location: Krk, PL
|
Posted: Sun Jul 27, 2008 10:44 am Post subject: |
|
|
Thanks, but I implemented it already.. with callbacks too.
I've got an impression that RunInControl is the only function that doesn't return all output at once and therefore - let me react if something happens on the way. _________________ Waiting for Windows 8... |
|
| Back to top |
|
 |
DerRaphael
Joined: 23 Nov 2007 Posts: 456 Location: Heidelberg, Germany
|
Posted: Wed Jul 30, 2008 10:29 am Post subject: |
|
|
hi corrupt,
i tried using the 3.1.2 dll version and your RunInCtrl Example. It always crashed the Autohotkey Script keep it not responding.
That means ... i started the Script. Clicked thru the tabs. Selected 1st tab, hit the button waited untill ping was done (some strange Asian chars appeared where Umlauts should have been) and then ... nothing
The Ping successfully did its Job, but the script got stuck. No more switching Tabs nothing. On ContextMenu Click in Taskbar windows told me that the application crashed.
Im running win2k sp4 (german) with ahk 1.0.47.06 and your latest supplied dll.
greetings
DerRaphael
great job btw
edit i just tried the beta 4a version with same issue. while it runs everything is ok. but as soon the executed command is done, the script still thinks its runnin (so it tells me in status bar)
exiting the process manually with ProcessExplorer resulted in a crash much the way it did with prior versions. _________________
|
|
| Back to top |
|
 |
evandevon
Joined: 22 Apr 2008 Posts: 18
|
Posted: Mon Aug 04, 2008 5:20 pm Post subject: E002_ReadConsoleInput Failed invalid handle error??? |
|
|
Hi!
Im trying to use cmdret to get streaming output from serialterm (a command line serial port utility)
If I use the code below I get this error
| Quote: |
E002_ReadConsoleInput Failed...: (6) The handle is invalid
|
| Code: |
; CMDret DLL version 3.1.2 (or greater) required
; cmdstub.exe required if using command.com
ret1 := CMDret("cmdstub.exe c:\serialterm.exe com1 19200 hex newline no")
MsgBox, %ret1%
CMDret(CMD)
{
VarSetCapacity(StrOut, 100000)
RetVal := DllCall("cmdret.dll\RunReturn", "str", CMD, "str", StrOut)
Return, %StrOut%
}
|
I don't know if serialterm is 16bit - I don't think I'd get anything at all if it was though.
If I use the streaming code
| Code: | ; CMDret DLL version 3.1 (or greater) required
Gui, Add, Edit, x6 y10 w460 h360 +HScroll
Gui, Show, x398 y110 h377 w477, CMDret - DLL version - Streaming Test App
CMD = cmdstub.exe c:\serialterm.exe com1 19200 hex newline no
OutputWindow := WinExist("CMDret - DLL version - Streaming Test App")
StrOut := DllCall("cmdret.dll\RunInControl", "str", CMD, "Uint", OutputWindow, "str", "Edit", "int",
"1")
Return
GuiClose:
ExitApp
|
I just get a blank gui - with and without the cmdstub.exe bit
I must be misunderstanding something. What I need is to see the hex values sent to my com port (in a way which I can use as variables in a script).
Any help is appreciated, thanks. _________________ Inventing problems that need solutions... |
|
| Back to top |
|
 |
Serenity
Joined: 08 Nov 2004 Posts: 1017
|
Posted: Sat Aug 09, 2008 12:38 am Post subject: |
|
|
I'm experiencing the same crashing with v3.1.2 and 4a beta as DerRaphael mentioned. I'm also running 2k SP4 with AHK 1.0.47.06. _________________ "Anything worth doing is worth doing slowly." - Mae West
 |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|