AutoHotkey Community

It is currently May 27th, 2012, 11:16 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 189 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8 ... 13  Next
Author Message
 Post subject:
PostPosted: March 17th, 2006, 10:34 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
Still works OK. What were the bugs? Could you explain in a bit more details?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 18th, 2006, 12:34 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2545
Laszlo wrote:
Still works OK. What were the bugs? Could you explain in a bit more details?
The main issue seems to be with calling PeekNamedPipe too frequently. On my system the errors seemed to appear when the CPU load hit 99-100% when calling PeekNamedPipe. More often than not when/if there was a sudden increase. Increasing the sleep value reduced the frequency of calls to PeekNamedPipe and seemed a bit more stable but the sleep times seemed to vary a bit and CPU load still ended up reaching at or near 100% and causing an error.

To try and avoid the variable sleep time issue I added a time comparison to enforce a minimum time between calls to PeekNamedPipe. If enough time hasn't elapsed between calls, the function continues to sleep until enough time has passed to give pipe operations a bit more time to complete. The time between calls I added seemed like a comfortable setting on my system but I haven't tested with slower machines yet... To test I did multiple runs with a few applications running and 3 test scripts running at the same time with loops of 400 each. Everything seemed to run ok. The CPU usage showed 100% but the system still seemed quite responsive and didn't give any output errors.

toralf wrote:
Could you please explain, why you use DllCall("Sleep", Int, 10)?
Is it different then "Sleep, 10"?
It seemed a bit more accurate with the testing I had done but it may not have really been the case...

toralf wrote:
I guess you set "CMcpy = a" as a temporary content, right? So that the var isn't empty. It will be overwritten anyway, right?
Yes. The functions wouldn't work when initialized with 0 and having no content.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 30th, 2006, 3:02 am 
Offline

Joined: August 24th, 2005, 5:17 pm
Posts: 1237
I am trying to use this function with cmdline.exe from here:
http://www.autohotkey.com/forum/viewtopic.php?t=1814

(to get command line parameters that were used to launch a process)

...but the returned text is incomplete: It starts off ok, then the text jumps to a bit about half way down the proper output and ends there. Any ideas?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 31st, 2006, 3:06 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2545
evl wrote:
I am trying to use this function with cmdline.exe from here:
http://www.autohotkey.com/forum/viewtopic.php?t=1814

(to get command line parameters that were used to launch a process)

...but the returned text is incomplete: It starts off ok, then the text jumps to a bit about half way down the proper output and ends there. Any ideas?

Hi evl,

Thanks for the feedback :) . Could you please post a small script that shows the issue that I can use to test with and try and duplicate your results?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 31st, 2006, 3:32 am 
Offline

Joined: August 24th, 2005, 5:17 pm
Posts: 1237
I tried with the script in the first post and Laszlo's script on the 3rd page, calling the function like:

Code:
MsgBox, % CMDret_RunReturn("cmd /c cmdline.exe")


Laszlo's script actually returns a line or two more text, but still very incomplete.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 31st, 2006, 4:07 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2545
Thanks. I've been experimenting with it a bit here too. The .dll version of CMDret doesn't work well with this application either. The results seem to be inconsistent. Running multiple times will display anything from a couple items only to the full list. I also tried creating a batch file with a few other commands to see if the process was finishing before the output could be read. Output from commands executed before cmdline.exe seem to display ok but anything after cmdline.exe in the batch file is not displayed. I'll have to do a bit more testing to try and determine the cause. Maybe cmdline.exe kills the pipe while generating its results ?...


Last edited by corrupt on March 31st, 2006, 5:20 am, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 31st, 2006, 5:17 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2545
From doing a bit more testing it appears that the output has likely been added to the CMDout variable ok using the code in the first post but it is possible that the output contains a character or characters that AHK does not handle properly that may be causing the output to appear truncated. In other words, for example , if the 50th character is a NULL character (maybe...), then nothing after that character would be displayed as AHK may assume that it has reached the end of the variable's contents (unless I'm misunderstanding...). The last version posted by Laszlo doesn't handle the way the output is added to the output variable the same way and might cut off the results at a different point in the output.

A patch for this is possible but might not be very efficient. Thanks for pointing this out evl :) .

Does anyone have any suggestions on an efficient way to test for and remove characters that cause the output to get truncated?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 31st, 2006, 10:16 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2545
Updated the code and download in the first post.

Version 1.08 beta
- Fixed truncated output when output contained null characters (Thanks evl)

Please let me know if this version fixes the issue :) .
Code:
MsgBox, % CMDret_RunReturn("cmdline.exe")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 31st, 2006, 1:54 pm 
Offline

Joined: August 24th, 2005, 5:17 pm
Posts: 1237
It seems to have fixed it :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 11th, 2006, 3:25 am 
Offline

Joined: February 13th, 2006, 10:40 pm
Posts: 389
Location: Utah
Edit *deleted*

(I had some problems with it working, but i found out it was becuase I had a wireless card and an ethernet cable plugged in See this post for more info.)

_________________
Image
"Power can be given overnight, but responsibility must be taught. Long years go into its making."


Report this post
Top
 Profile  
Reply with quote  
 Post subject: CMDret-AHK status ?
PostPosted: June 1st, 2006, 5:01 pm 
Offline

Joined: August 22nd, 2005, 8:51 pm
Posts: 19
Does anyone know when CMDret-AHK function will be directly included in AutoHotkey? Thanks.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 2nd, 2006, 3:10 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
It's still on the to-do list but I don't know when. Certainly Corrupt's DllCall implementation will help a lot when the time comes -- not to mention everyone's testing, comments, and refinements.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 4th, 2006, 4:32 pm 
Offline

Joined: December 16th, 2005, 3:29 am
Posts: 148
Location: Australia
just a minor addition to allow dir to start in:

Code:
CMDret_RunReturn(CMDin,szDir)
..
..
IF (DllCall("CreateProcess", Int,0, str,CMDin, Int,0, Int,0, Int,1, "UInt",0, Int,0, str,szDir, UInt,&sui, UInt,&pi) != 0)


bw.. great work guyz :lol:

_________________
Image
546F206C69766520
6973204368726973742C0D746F2064696520
6973206761696E2E0D285068696C20313A323129


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 4th, 2006, 5:42 pm 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2545
ParanoidX wrote:
just a minor addition to allow dir to start in:

Thanks for the reminder :) .

There are a few other additions currently planned:
- Optional StdIn
- Optionally split StdOut & StdErr output
- Stream output to control

If you (or anyone else) has any other ideas, comments, suggestions, etc... please don't hesitate to join the discussions. The amount of time spent on this project is usually determined by the amount of interest in it... ;)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 4th, 2006, 5:50 pm 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2545
ParanoidX wrote:
bw.. great work guyz :lol:
Thanks :) . and thanks to everyone that has contributed to this project :)


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 189 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8 ... 13  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: nomissenrojb, Rajat and 56 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