 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
garry
Joined: 19 Apr 2005 Posts: 1028 Location: switzerland
|
Posted: Sat Nov 17, 2007 3:43 pm Post subject: |
|
|
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
|
|
|
| Back to top |
|
 |
SecurityAnalysis Guest
|
Posted: Sun Nov 18, 2007 12:24 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
garry
Joined: 19 Apr 2005 Posts: 1028 Location: switzerland
|
Posted: Sun Nov 18, 2007 9:59 am Post subject: |
|
|
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
|
|
|
| Back to top |
|
 |
SecurityAnalysis Guest
|
Posted: Sun Nov 18, 2007 3:41 pm Post subject: |
|
|
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? |
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2393
|
Posted: Sun Dec 09, 2007 6:39 am Post subject: |
|
|
| 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... |
|
| Back to top |
|
 |
SnapPit Guest
|
Posted: Mon Dec 10, 2007 10:46 pm Post subject: |
|
|
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? |
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2393
|
Posted: Sun Jan 06, 2008 6:19 pm Post subject: |
|
|
| 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  |
|
| Back to top |
|
 |
SnapPit Guest
|
Posted: Sun Jan 27, 2008 12:29 pm Post subject: |
|
|
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.  |
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2393
|
Posted: Sun Jan 27, 2008 6:57 pm Post subject: |
|
|
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  |
|
| Back to top |
|
 |
SnapPit Guest
|
Posted: Sun Jan 27, 2008 7:09 pm Post subject: |
|
|
| 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? |
|
| Back to top |
|
 |
Ricardo111 Guest
|
Posted: Fri Feb 01, 2008 2:41 pm Post subject: Brilliant script |
|
|
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 |
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2393
|
|
| Back to top |
|
 |
SnapPit Guest
|
Posted: Mon Mar 17, 2008 3:59 pm Post subject: |
|
|
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? |
|
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2393
|
Posted: Tue Mar 18, 2008 3:11 am Post subject: |
|
|
| 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...  |
|
| Back to top |
|
 |
SnapPit Guest
|
Posted: Tue Mar 18, 2008 10:23 am Post subject: |
|
|
| 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? |
|
| 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
|