AutoHotkey Community

It is currently May 25th, 2012, 11:26 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 189 posts ]  Go to page Previous  1 ... 8, 9, 10, 11, 12, 13  Next
Author Message
 Post subject:
PostPosted: November 17th, 2007, 3:43 pm 
Offline

Joined: April 19th, 2005, 10:26 am
Posts: 2249
Location: switzerland
I used this DOS command to see the needed output / or show all

Code:
/*

      DOS command shows only   the searched string
      Dos command shows always all

*/

mycmd     =netstat -e -s
srch      =send                ;this search for "send"

F3        =%temp%\test53.txt      ;only searched string
F4        =%temp%\test54.txt      ;the DOS command output
Gui,1:Font,,FixedSys
Gui,1:Add,Listbox, x10  y5    h190  w680 vLB1,
Gui,1:Add,button,  x20  y200  h20   w100 gSTART,START
Gui,1:Show, x0 y0 h225 w700 , Searched string=  %srch%   for=  %mycmd%
return
;-------------------------------------------------------

START:
Gui,1:submit,nohide
GuiControl,1:,LB1,|                       ;clear listbox

runwait,%comspec% /c %mycmd% |find /I "%srch%" >%F3%,,hide     ;shows only   found string
runwait,%comspec% /c %mycmd% |find /V "XXXBBB" >%F4%,,hide     ;shows always all
;runwait,%comspec% /c %mycmd% >%F4%,,hide                      ;  not always show

Loop,read,%F3%
   GuiControl,1:,LB1,%A_LoopReadLine%     ;listbox shows only lines with found words
run,%F4%                                  ;this file shows all
return
;--------------------------------------------------------

Guiclose:
exitapp


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 18th, 2007, 12:24 am 
These are great functions. Unfortunately it is all over my head. I've been lucky to have learned how to use CMDret_Return on my own though. But I not come all the way with CMDret_Stream.

My code looks like this:
Code:
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

CMDret_Stream("vol")

CMDret_Output(CMDOut, CMDname="")
{
   global Output
   Output := Output "`n" CMDOut
   MsgBox, %output%
}
return

#Include CMDret.ahk


It doesn't work. All I want to do is display the results of "vol" as a test so I can use it for real stuff later. If anyone can help, that would be awesome. If you think that this is over my head and I should stay away from the adult playground then that is ok.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 18th, 2007, 9:59 am 
Offline

Joined: April 19th, 2005, 10:26 am
Posts: 2249
Location: switzerland
sorry , just again the DOS command
Code:
mycmd      =vol
srch       =volume
F3         =%temp%\test55.txt
Gui,1:Font,,FixedSys
Gui,1:Add,Edit,cRed x10 y0   h25  w480 vOUTPUT2,
Gui,1:Show,         x0  y0   h30  w500 ,DOS-command=%mycmd% > search for the text "%srch%"
runwait,%comspec% /c %mycmd% |find /I "%srch%" >%F3%,,hide
       FileReadLine,VAR1,%F3%,1
       stringmid,S1,VAR1,21,200   ;define the position , here german
       S1=%S1%
       GuiControl,1:,OUTPUT2,%S1%
       msgbox,DOS-command=%mycmd%`n%VAR1%
return

Guiclose:
exitapp


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 18th, 2007, 3:41 pm 
I have a small application that RunReturns a home made CMD C# application.

Code:

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

Message := ""

out := CMDret_RunReturn("cmd /c Evaluator.exe 070h 321b")
Message := Message out
Sleep, 4000
out := CMDret_RunReturn("cmd /c Evaluator.exe 070h 321b")
Message := Message out
Sleep, 4000
MsgBox, %Message%

return

#Include CMDret.ahk


There are two outputs that I want to show on the end in the variable Message. But I am having problems here. Inconsistency problems. Sometimes Message contains both outputs as I want it to do, but sometimes it only contains the first output. And sometimes it is blank. On occasions it has only contained part of the second output.

Could there be an AHK problem with this or do you think it is C#? FWIW, when I only RunReturn once it seems to work well every time.

Can you think of anything that could be the cause to this inconsistency and problem?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 9th, 2007, 6:39 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2541
SecurityAnalysis wrote:
Can you think of anything that could be the cause to this inconsistency and problem?
Possibly null characters in the output. There are a few known bugs that I hope to solve in the next version which should be available soon. Sorry for the delay...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 10th, 2007, 10:46 pm 
Hi,

is it possible to use this function on a application which is still running? Or do I have to start it with this function?
My problem is that I want to run an app in background of my script and just get some stats some times, but not all the time. I have tried the "streaming" feature, but it was doing some kind of loopcommand to my appl.
So is it possible just to get the text of a running application?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 6th, 2008, 6:19 pm 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2541
SnapPit wrote:
Hi,

is it possible to use this function on a application which is still running? Or do I have to start it with this function?
My problem is that I want to run an app in background of my script and just get some stats some times, but not all the time. I have tried the "streaming" feature, but it was doing some kind of loopcommand to my appl.
So is it possible just to get the text of a running application?
Sorry for the delayed response... The current version requires that you start the application using the function but I'll see about adding an option for an application that is already running as this has been requested a few times. Thanks for the suggestion :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 27th, 2008, 12:29 pm 
Thanks for your "late" response. Did you start adding the requested function, yet? It would be very helpful to have this function, because I cant think of another way to get this done. :)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 27th, 2008, 6:57 pm 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2541
I haven't yet but I am planning to post an updated version of cmdret later today. I'll have a look at adding the option in the process. Thanks :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 27th, 2008, 7:09 pm 
So you will add this feature in the next version? Do you think its a big deal to add this? Or can I hope to get a new version next week?


Report this post
Top
  
Reply with quote  
 Post subject: Brilliant script
PostPosted: February 1st, 2008, 2:41 pm 
Many thanks to corrupt and his collaborators for providing this script. Its a great way to capture the output and pipe it to a text editor. I had an excellent running java script on a dimensions project chosen from an autohotkey then getting the output piped back to pspad log window.
Heres the last bit of code in case anyone else is trying to do a similar thing.



Code:
   ;the following sends messages from the dmcli window to standard out/ my editors log window.
   ;cmdret is a dll call black magic kind of thing. I don't really understand it but it is well
   ;thought of on the autohotkey forum so I am trusting it but just for myself!
   Message := ""
   outStr := CMDret_RunReturn(DBaseStr)
   Message := Message outStr
   ;remove line feeds and send to pspad log window via standard out
   StringReplace, Message, Message,`r`n,`r, All
   FileAppend %Message%, *


Regards,
Ricardo111


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 16th, 2008, 8:11 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2541
Version 3.2.1 released (DLL version)

AHK version = currently discontinued...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 17th, 2008, 3:59 pm 
Does it help me with my problem?

Quote:
s it possible to use this function on a application which is still running? Or do I have to start it with this function?
My problem is that I want to run an app in background of my script and just get some stats some times, but not all the time. I have tried the "streaming" feature, but it was doing some kind of loopcommand to my appl.
So is it possible just to get the text of a running application?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 18th, 2008, 3:11 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2541
SnapPit wrote:
Does it help me with my problem?

Quote:
s it possible to use this function on a application which is still running? Or do I have to start it with this function?
My problem is that I want to run an app in background of my script and just get some stats some times, but not all the time. I have tried the "streaming" feature, but it was doing some kind of loopcommand to my appl.
So is it possible just to get the text of a running application?
Ya know... If you haven't got the time to read the release notes then I likely won't take the time to try and answer your question... ;)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 18th, 2008, 10:23 am 
I read all the release notes before, but I didnt get a thing that would help me? I just read about new parameters for the runincontrol abillity, but where can I see this parameters?


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 189 posts ]  Go to page Previous  1 ... 8, 9, 10, 11, 12, 13  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Stigg and 11 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