AutoHotkey Community

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

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: October 3rd, 2009, 2:36 pm 
Offline

Joined: October 3rd, 2009, 2:23 pm
Posts: 8
I am trying to run this code:
Code:
sWindump = windump.exe -A -q -i 2 -p >>D:\bumblebee\windump.txt

Run, %comspec% /k

ControlSend,,%sWindump%`n,ahk_Class ConsoleWindowClass
sleep, 3000
ControlSend,,^c,ahk_Class ConsoleWindowClass


What is supposed to happen is the windump program starts, and i need to close it later using a CTRL-C command. If windump is not closed with CTRL-C it does not output what it's seen (packets).

If I start windump manually outside autohotkey it works fine. And I can send the CTRL-C using autohotkey controlsend and kill it clean.

If I start windump using the autohotkey comspec command, after the windump command executes the cmd window is "frozen" and won't accept anymore controlsends. I can't figure out why. Even if I manually press CTRL-C at the cmd window started by autohotkey, it is frozen. It only freezes after the windump line starts. I'm guessing something in comspec is not right. Maybe a switch I need, or quotes.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 3rd, 2009, 3:09 pm 
Code:
Run, %comspec% /k

This /k means KEEP open.Try with /C (c=close)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 3rd, 2009, 3:13 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8666
Location: Salem, MA
you might be better off using CMDRet

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 3rd, 2009, 4:03 pm 
why using comspec at all? try:
Code:
sWindump = windump.exe -A -q -i 2 -p >>D:\bumblebee\windump.txt
Run, %sWindump%


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 3rd, 2009, 9:23 pm 
Offline

Joined: October 3rd, 2009, 2:23 pm
Posts: 8
CMDret seemed like a good idea so I've implemented that. It works great but something on my command line is still breaking my command. It is in the section of the command that has the brackets. Something in that part is not executing correctly or being passed on correctly. I tried putting the command line in a batch file and it still doesn't work. Although the batch file works fine if run outside of autohotkey. Very strange still.

Code:
windump.exe -A -q -i 2 -p (udp[17:1] == 0x2b or udp[22:1] == 0x64)


Something with the brackets or maybe == sign does not translate when run through autohotkey. If I omit everything between the brackets, the code runs perfect. I've tried escaping them all. The command looks fine when I inspect the variables. The command also starts and runs and does not syntax error. I'm assuming autohotkey or CMDret does something that alters the special characters when it's passed into a dos box. I'll do some more testing but if anyone has any suggestions I'll try them out.

Thank you all for your suggestions so far. I've tried them all. I also never heard of CMDret. Nice bit of code.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 5th, 2009, 4:51 pm 
Offline

Joined: October 3rd, 2009, 2:23 pm
Posts: 8
Just a note that I never resolved this problem. I did a workaround by running the windump command manually in a batch file (ie:autohotkey does not start it, I do) and leaving the rest of the code in autohotkey. Autohotkey still communicates with the cmd window as needed, but I am unable to start it via autohotkey code.

It's good enough for what I need to do.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Leef_me, Pulover, rbrtryn, XstatyK, Yahoo [Bot] and 14 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