AutoHotkey Community

It is currently May 27th, 2012, 12:41 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 189 posts ]  Go to page Previous  1 ... 9, 10, 11, 12, 13  Next
Author Message
 Post subject:
PostPosted: March 19th, 2008, 10:15 pm 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2545
SnapPit wrote:
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?
The new params are listed in a readme file in the zip file available for download.

Short answer: No. There is nothing new in this release that will help with your request. It may be possible to add to the next release but will require a lot more testing and experimentation. Either way it will likely require the application to be started with CMDret or some form of tsr utility. There might be a workaround but the main issue that I can think of is that basically the application sends its output into a pipe and CMDret reads the data from the pipe and allows you to manipulate that data in AHK. The question is, what to do with the data in the pipe and how to connect/disconnect from the application if CMDret needs to disconnect/reconnect before the application has finished. One option might be to create a tsr utility that starts the application that would allow CMDret to connect/disconnect to view/manipulate the data through the tsr instead of through the application directly. The tsr utility could be transparent to the user if necessary by just changing the shortcut to the application.

This release mainly contains bug fixes and uses a few different methods internally that seem (in the testing that I have done so far...) to produce less errors and be more reliable and efficient than in previous versions of CMDret.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 21st, 2008, 5:57 pm 
Offline

Joined: July 14th, 2006, 12:31 am
Posts: 290
Location: Berlin
is there a possibility to get errorlevel to work with cmdret_runreturn function so that i get the same value as if i run a cmd line with runwait?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 22nd, 2008, 4:17 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2545
ladiko wrote:
is there a possibility to get errorlevel to work with cmdret_runreturn function so that i get the same value as if i run a cmd line with runwait?
Yes ;) (A_LastError). I might eventually update this version to fix a few known issues and add a bit more functionality but at the moment updates to CMDret are only applied to the DLL version.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 22nd, 2008, 10:22 am 
Offline

Joined: July 14th, 2006, 12:31 am
Posts: 290
Location: Berlin
ok thank you, but ahk help tells me that runwait also uses a_lasterror. so both ways should have the same result for A_LastError?! If i run the following script
Code:
Out_File = %A_ScriptDir%\Out.txt
FileDelete , %Out_File%

CMD_in = "C:\Program Files\AutoHotkey\Compiler\Ahk2exe.exe" /in "%A_ScriptFullPath%" /out "%A_ScriptDir%\_Out1.exe"
RunWait , %CMD_in% , UseErrorLevel
FileAppend , ### RunWait ###`nErrorLevel = "%ErrorLevel%"`nA_LastError = "%A_LastError%"`n`n , %Out_File%

CMD_in = "C:\Program Files\AutoHotkey\Compiler\Ahk2exe.exe" /in "%A_ScriptFullPath%" /out "%A_ScriptDir%\_Out2.exe"
FileAppend , ### RunWait >> Out ###`nReturn =%A_Space% , %Out_File%
RunWait , %comspec% /c "%CMD_in% >> "%Out_File%"" , Hide UseErrorLevel
FileAppend , ErrorLevel = "%ErrorLevel%"`nA_LastError = "%A_LastError%"`n`n , %Out_File%

CMD_in = "C:\Program Files\AutoHotkey\Compiler\Ahk2exe.exe" /in "%A_ScriptFullPath%" /out "%A_ScriptDir%\_Out3.exe"
CMD_out := CMDret_RunReturn(CMD_in)
FileAppend , ### RunReturn ###`nReturn = %CMD_out%ErrorLevel = "%ErrorLevel%"`nA_LastError = "%A_LastError%"`n`n , %Out_File%

the Out.txt looks like this:
Code:
### RunWait ###
ErrorLevel = "0"
A_LastError = "0"

### RunWait >> Out ###
Return = Successfully compiled: D:\AHK\Compile_AHK\_Out2.exe
ErrorLevel = "0"
A_LastError = "0"

### RunReturn ###
Return = Successfully compiled: D:\AHK\Compile_AHK\_Out3.exe
ErrorLevel = "0"
A_LastError = "1813"


System Error Code 1813
0x715
ERROR_RESOURCE_TYPE_NOT_FOUND
The specified resource type cannot be found in the image file.

so i cannot use A_LastError ... can you evaluate how long it will take until you update the ahk functions? some month, half a year, a year, longer?


Report this post
Top
 Profile  
Reply with quote  
 Post subject: MicroOLAP TCPDUMP
PostPosted: April 21st, 2009, 9:22 pm 
Offline

Joined: February 7th, 2009, 5:37 am
Posts: 43
Help me please with MicroOLAP TCPDUMP (command-line sniffer/analyzer).
At the command prompt I've got output like this:
Code:
>tcpdump -i 2 -f igmp and src net 10.0.0.0/8 and dst net 233.7.70.0/24

tcpdump: listening on \Device\{C6C0A54D-260B-4232-BDE3-858F1F5CC96D}
02:11:01.328125 IP 10.16.28.140 > 233.7.70.1: igmp v2 report 233.7.70.1
02:11:05.296875 IP 10.16.28.140 > 233.7.70.1: igmp v2 report 233.7.70.1
02:11:08.843750 IP 10.16.28.140 > 233.7.70.2: igmp v2 report 233.7.70.2
02:11:11.265625 IP 10.16.28.140 > 233.7.70.2: igmp v2 report 233.7.70.2
02:11:12.140625 IP 10.16.28.140 > 233.7.70.2: igmp v2 report 233.7.70.2
02:11:12.765625 IP 10.16.28.140 > 233.7.70.3: igmp v2 report 233.7.70.3
02:11:14.281250 IP 10.16.28.140 > 233.7.70.3: igmp v2 report 233.7.70.3
02:11:20.203125 IP 10.16.28.140 > 233.7.70.4: igmp v2 report 233.7.70.4
02:11:21.453125 IP 10.16.28.140 > 233.7.70.4: igmp v2 report 233.7.70.4
02:11:27.312500 IP 10.16.28.140 > 233.7.70.34: igmp v2 report 233.7.70.34
02:11:32.218750 IP 10.16.28.140 > 233.7.70.34: igmp v2 report 233.7.70.34
02:11:33.250000 IP 10.16.28.140 > 233.7.70.34: igmp v2 report 233.7.70.34
02:11:37.375000 IP 10.16.28.140 > 233.7.70.34: igmp v2 report 233.7.70.34
02:11:39.218750 IP 10.16.28.140 > 233.7.70.69: igmp v2 report 233.7.70.69
02:11:47.125000 IP 10.16.28.140 > 233.7.70.69: igmp v2 report 233.7.70.69
02:11:51.515625 IP 10.16.28.140 > 233.7.70.69: igmp v2 report 233.7.70.69

New lines appear from time to time, and when switching channels on my STB.
But the script does not output any new lines after tcpdump: listening on \Device\{C6C0A54D-260B-4232-BDE3-858F1F5CC96D}
How can I fix that?
Code:
#NoEnv
#SingleInstance, Force
#Include CMDret_Stream.ahk

Gui, Font, s10, Courier New
Gui, Add, Text, , Output:
Gui, Add, Edit, vOutput w800 r20
Gui, Show, , Tcpdump

CMDret_Stream("tcpdump -i 2 -f igmp and src net 10.0.0.0/8 and dst net 233.7.70.0/24")
Return

GuiClose:
ExitApp

CMDret_Output(CMDout, CMDname="")
{
   global Result
   FormatTime, CurrentTime, , HH:mm:ss
   Result .= "[" . CurrentTime . "] " . CMDout . "`r`n"
   GuiControl, , Output, %Result%
   Return
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 22nd, 2009, 1:06 pm 
Offline

Joined: February 7th, 2009, 5:37 am
Posts: 43
Hmm... Lines appearing after huge delay
Can someone help me please?
Code:
[17:26:10] tcpdump: listening on \Device\{C6C0A54D-260B-4232-BDE3-858F1F5CC96D}
[18:10:08] 17:26:10.546875 IP 10.16.28.140 > 233.7.70.1: igmp v2 report 233.7.70.1
[18:10:08] 17:26:16.171875 IP 10.16.28.140 > 233.7.70.2: igmp v2 report 233.7.70.2
[18:10:08] 17:26:18.390625 IP 10.16.28.140 > 233.7.70.2: igmp v2 report 233.7.70.2
[18:10:08] 17:26:18.937500 IP 10.16.28.140 > 233.7.70.3: igmp v2 report 233.7.70.3
[18:10:08] 17:26:22.546875 IP 10.16.28.140 > 233.7.70.4: igmp v2 report 233.7.70.4
[18:10:08] 17:26:25.328125 IP 10.16.28.140 > 233.7.70.4: igmp v2 report 233.7.70.4
[18:10:08] 17:26:27.578125 IP 10.16.28.140 > 233.7.70.34: igmp v2 report 233.7.70.34
[18:10:08] 17:26:35.343750 IP 10.16.28.140 > 233.7.70.34: igmp v2 report 233.7.70.34
[18:10:08] 17:26:38.656250 IP 10.16.28.140 > 233.7.70.34: igmp v2 report 233.7.70.34


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 27th, 2009, 2:00 am 
Offline

Joined: February 7th, 2009, 11:28 pm
Posts: 384
I'm thinking of using RegCmd 0.91b, or another command line reg editor, to check registry values because I'm having format issues with AHK's built-in RegRead.

Would one of these CMDRet functions be suitable for looping registry values into a command line window and retrieving the output display (key value, and/or type).

Here's an AHK command without the loop or CMDRet included:

Code:
SetBatchLines, -1
SetTitleMatchMode, 2
mystr:= "\HKCU\Control Panel\Appearance"
vname:= "Current"
Run, regcmd.exe
Sleep, 500 ; wait for it to load
ControlSend,,cd{Space}%mystr%{Enter}, regcmd.exe
Sleep, 10
ControlSend,,type{Space}%vname%{Enter}, regcmd.exe
Return


The output is currently restricted to the console window:
Image

Which version of CMDret would be best for this? (Of course, this is just an idea - might turn out to be disastrously slow... but it would still help for future reference)

p.s. RegCmd consists of a 72KB standalone exe file, plus an optional ini-file and a readme.txt for usage - no frills, free. From same guy who did RegShot.

_________________
Hardware: 1.8 GHz laptop with 4 GB ram, Windows XP/SP3
Software: Prevx, Privatefirewall, KeyScrambler.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 19th, 2009, 11:05 am 
Is it possible to get the output of the command "telnet [website.com] [port]
printed using cmdret_stream function..?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 12th, 2009, 4:05 pm 
Offline

Joined: October 3rd, 2009, 2:23 pm
Posts: 8
Maybe it's an issue with the program I'm using, or just an issue overall, but using the streaming function does not really stream very well with a program that never stops running. As mentioned previous there is a large delay when running it with some console commands. I use windump (aka tcpdump) to parse incoming packets and it is delayed.

Further reading indicates that the delay in the stream is caused by buffering on the pipe as described in the solution I am using here:

http://www.codeproject.com/KB/threads/RTconsole.aspx

Here is an example of the solution I used. I hacked up the parsing in the CMDret_Stream function since it did not seem to work properly with my RTconsole solution. The changed CMDret_Stream code is included in the example.

Code:
;CMDret_Stream starts the command running. You only need these 3 lines to start the program.a
;Put all your main loop code in CMDret_Output which is the real main loop for this type of program.
sCmd = RTconsole.exe ping www.google.com
CMDret_Stream(sCmd)
Return

;All the processing on the returned text is done in the CMDret_Output section. CMDout is the lines returned.
;Use this as your "main" loop.
CMDret_Output(CMDout, CMDname="")
{
   FileAppend, %CMDout%, *
   Return
}

;CMDret_Stream function. Don't change unless you need to parse the returned information differently.
;Currently I parse it on every carriage return found. So each new line, roughly.
CMDret_Stream(CMDin, CMDname="", WorkingDir=0)
{
   Global cmdretPID
   tcWrk := WorkingDir=0 ? "Int" : "Str"
   idltm := A_TickCount + 20
   LivePos = 1
   VarSetCapacity(CMDout, 1, 32)
   VarSetCapacity(sui,68, 0)
   VarSetCapacity(pi, 16, 0)
   VarSetCapacity(pa, 12, 0)
   Loop, 4 {
      DllCall("RtlFillMemory", UInt,&pa+A_Index-1, UInt,1, UChar,12 >> 8*A_Index-8)
      DllCall("RtlFillMemory", UInt,&pa+8+A_Index-1, UInt,1, UChar,1 >> 8*A_Index-8)
   }
   IF (DllCall("CreatePipe", "UInt*",hRead, "UInt*",hWrite, "UInt",&pa, "Int",0) <> 0) {
      Loop, 4
         DllCall("RtlFillMemory", UInt,&sui+A_Index-1, UInt,1, UChar,68 >> 8*A_Index-8)
      DllCall("GetStartupInfo", "UInt", &sui)
      Loop, 4 {
         DllCall("RtlFillMemory", UInt,&sui+44+A_Index-1, UInt,1, UChar,257 >> 8*A_Index-8)
         DllCall("RtlFillMemory", UInt,&sui+60+A_Index-1, UInt,1, UChar,hWrite >> 8*A_Index-8)
         DllCall("RtlFillMemory", UInt,&sui+64+A_Index-1, UInt,1, UChar,hWrite >> 8*A_Index-8)
         DllCall("RtlFillMemory", UInt,&sui+48+A_Index-1, UInt,1, UChar,0 >> 8*A_Index-8)
      }
      IF (DllCall("CreateProcess", Int,0, Str,CMDin, Int,0, Int,0, Int,1, "UInt",0, Int,0, tcWrk, WorkingDir, UInt,&sui, UInt,&pi) <> 0) {
         Loop, 4
         cmdretPID += *(&pi+8+A_Index-1) << 8*A_Index-8
         Loop {
            idltm2 := A_TickCount - idltm
            If (idltm2 < 15) {
               DllCall("Sleep", Int, 15)
               Continue
            }
            IF (DllCall("PeekNamedPipe", "uint", hRead, "uint", 0, "uint", 0, "uint", 0, "uint*", bSize, "uint", 0 ) <> 0 ) {
               Process, Exist, %cmdretPID%
               IF (ErrorLevel OR bSize > 0) {
                  IF (bSize > 0) {
                     VarSetCapacity(lpBuffer, bSize+1, 0)
                     IF (DllCall("ReadFile", "UInt",hRead, "Str", lpBuffer, "Int",bSize, "UInt*",bRead, "Int",0) > 0) {
                        IF (bRead > 0) {
                           IF (StrLen(lpBuffer) < bRead) {
                           VarSetCapacity(CMcpy, bRead, 32)
                           bRead2 = %bRead%
                              Loop {
                                 DllCall("RtlZeroMemory", "UInt", &CMcpy, Int, bRead)
                                 NULLptr := StrLen(lpBuffer)
                                 cpsize := bread - NULLptr
                                 DllCall("RtlMoveMemory", "UInt", &CMcpy, "UInt", (&lpBuffer + NULLptr + 2), "Int", (cpsize - 1))
                                 DllCall("RtlZeroMemory", "UInt", (&lpBuffer + NULLptr), Int, cpsize)
                                 DllCall("RtlMoveMemory", "UInt", (&lpBuffer + NULLptr), "UInt", &CMcpy, "Int", cpsize)
                                 bRead2 --
                                 IF (StrLen(lpBuffer) > bRead2)
                                    break
                              }
                           }
                           VarSetCapacity(lpBuffer, -1)
                           CMDout .= lpBuffer
                           ;Uncomment the next line to look at the chunks of info read each time. They are fairly small.
                           ;FileAppend, %lpbuffer%`n, *
                           bRead = 0
                        }
                     }
                  }
               }
               ELSE
                  break
            }
            ELSE
               break
            idltm := A_TickCount
            ;This is the part I changed. I just wait for a carriage return to be present...
            ;And then parse out each new line.
            ifinstring, CMDout, `r
            {
               Loop, Parse, CMDout, `n
               {
                 FileLine = %A_LoopField%
                 CMDret_Output(FileLine, CMDname)
               }
               CMDout =
            }
         }
         cmdretPID=
         DllCall("CloseHandle", UInt, hWrite)
         DllCall("CloseHandle", UInt, hRead)
      }
   }
   Loop, Parse, CMDout, `n
   {
      FileLine = %A_LoopField%
      CMDret_Output(FileLine, CMDname)
   }
   cmdretPID = 0
   Return, CMDout
}


From what I read, this type of reading from the console is not 100% reliable. Chances are you will be missing characters, etc. Chances are my new parsing section is also unreliable compounding the issue. Anyway, it works pretty reliably for me for what I need it to do. Maybe it will be of some use to someone in the future.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 10th, 2009, 12:30 pm 
Hi

When I log into the telnet session is spews out a constant stream of data.

Normally this just wizz's past in the open telnet window.

I'm trying to find a way to monitor the output and then run a specific action if a keyword is outputted.

Can anyone offer any advice ??

Thanks


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 18th, 2009, 8:30 pm 
Offline

Joined: October 3rd, 2009, 2:23 pm
Posts: 8
One more note about my post above. RTConsole.exe seems to perform the same function as the cmdstub.exe program this is already included with the cmdret.dll version of these functions. RTConsole.exe crashes frequently but cmdstub.exe seems to be working well.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 19th, 2009, 5:49 pm 
Offline

Joined: March 24th, 2009, 2:25 pm
Posts: 22
Can we use piping? If yes, how? Without using cmd.exe plz


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 19th, 2009, 8:03 pm 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2545
RandomHeart wrote:
Can we use piping? If yes, how? Without using cmd.exe plz
Could you please give an example of what you would like to do? Thanks :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 19th, 2009, 8:10 pm 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2545
rocknrollgolfer wrote:
One more note about my post above. RTConsole.exe seems to perform the same function as the cmdstub.exe program this is already included with the cmdret.dll version of these functions. RTConsole.exe crashes frequently but cmdstub.exe seems to be working well.
It's good to hear that cmdstub.exe is still holding up ok since I misplaced the source code for it a long time ago :oops: :D .


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 19th, 2009, 8:15 pm 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2545
rocknrollgolfer wrote:
From what I read, this type of reading from the console is not 100% reliable. Chances are you will be missing characters, etc. Chances are my new parsing section is also unreliable compounding the issue. Anyway, it works pretty reliably for me for what I need it to do. Maybe it will be of some use to someone in the future.
Out of curiosity, have you tried and/or had any better results with the dll version? http://www.autohotkey.com/forum/viewtopic.php?t=3687


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 ... 9, 10, 11, 12, 13  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Cristi®, Exabot [Bot], Google Feedfetcher, Stigg and 30 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