AutoHotkey Community

It is currently May 26th, 2012, 9:26 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 164 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9, 10, 11  Next
Author Message
 Post subject:
PostPosted: July 23rd, 2008, 10:58 pm 
Offline

Joined: February 28th, 2008, 8:02 pm
Posts: 100
Location: Krk, PL
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.

_________________
Benjamin Franklin wrote:
Anyone who trades liberty for security deserves neither liberty nor security.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 27th, 2008, 3:41 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2542
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 :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 27th, 2008, 10:44 am 
Offline

Joined: February 28th, 2008, 8:02 pm
Posts: 100
Location: Krk, PL
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.

_________________
Benjamin Franklin wrote:
Anyone who trades liberty for security deserves neither liberty nor security.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 30th, 2008, 10:29 am 
Offline

Joined: November 23rd, 2007, 10:23 am
Posts: 841
Location: ~/.
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 :D

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.

_________________
Image
    All scripts, unless otherwise noted, are hereby released under CC-BY


Report this post
Top
 Profile  
Reply with quote  
PostPosted: August 4th, 2008, 5:20 pm 
Offline

Joined: April 22nd, 2008, 7:13 pm
Posts: 82
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...

Open Communicator
MouseTrainer


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 9th, 2008, 12:38 am 
Offline

Joined: November 8th, 2004, 12:46 am
Posts: 1271
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
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 23rd, 2008, 4:29 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2542
Thanks for the reports. I don't have Win2k running on a machine at the moment but I'll try and set something up and give it a try soon. I'll have a look at serialterm also.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 25th, 2008, 3:00 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2542
Serenity wrote:
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.
Out of curiousity, does this happen with version 3.2.1 (latest stable release) ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 25th, 2008, 3:03 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2542
DerRaphael wrote:
great job btw :D

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.
Thanks :) Do you have a sample script available that I can use for testing?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 25th, 2008, 3:14 am 
Offline

Joined: November 8th, 2004, 12:46 am
Posts: 1271
corrupt wrote:
Serenity wrote:
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.
Out of curiousity, does this happen with version 3.2.1 (latest stable release) ?


Yes it does, with 1.0.47.06 and the new beta.

_________________
"Anything worth doing is worth doing slowly." - Mae West
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 25th, 2008, 3:43 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2542
Serenity wrote:
Yes it does, with 1.0.47.06 and the new beta.
Out of curiousity, was there a previous release of the dll version that didn't hang for you? Which function are you currently using and which application are you running? Is the application 32 bit? Could you please provide an example that I can use for troubleshooting? Thanks :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 25th, 2008, 3:47 am 
Offline

Joined: November 8th, 2004, 12:46 am
Posts: 1271
I was just using the scripts that came with the dll. I don't think I tried any of the earlier versions.

_________________
"Anything worth doing is worth doing slowly." - Mae West
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 25th, 2008, 7:33 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2542
Serenity wrote:
I was just using the scripts that came with the dll. I don't think I tried any of the earlier versions.
Hmm... well that's not good... Sounds like I'll have to revive my test machine. Out of curiosity, does holding the <ESC> button when running the test script for the beta version (4a) kill the process?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 25th, 2008, 9:06 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2542
Beta version 4b - Download (dll & demo scripts)

- different method used for callback in RunWCB() function
- changed order of callback params (please see demo scripts)
- added the previous functions from version 3.2.1 to the dll

Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 25th, 2008, 3:05 pm 
Offline

Joined: November 8th, 2004, 12:46 am
Posts: 1271
corrupt wrote:
Serenity wrote:
I was just using the scripts that came with the dll. I don't think I tried any of the earlier versions.
Hmm... well that's not good... Sounds like I'll have to revive my test machine. Out of curiosity, does holding the <ESC> button when running the test script for the beta version (4a) kill the process?


It doesn't. I get a << Process Terminated by Esc Key >> message and then it freezes/crashes.

_________________
"Anything worth doing is worth doing slowly." - Mae West
Image


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 164 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9, 10, 11  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 4 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group