| View previous topic :: View next topic |
| Author |
Message |
rocknrollgolfer
Joined: 03 Oct 2009 Posts: 8
|
Posted: Sat Oct 03, 2009 1:36 pm Post subject: cmd window freezes after running a command |
|
|
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. |
|
| Back to top |
|
 |
!Guest Guest
|
Posted: Sat Oct 03, 2009 2:09 pm Post subject: |
|
|
This /k means KEEP open.Try with /C (c=close) |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 8255 Location: Maywood, IL
|
Posted: Sat Oct 03, 2009 2:13 pm Post subject: |
|
|
you might be better off using CMDRet _________________
(Common Answers) |
|
| Back to top |
|
 |
Z_Gecko Guest
|
Posted: Sat Oct 03, 2009 3:03 pm Post subject: |
|
|
why using comspec at all? try: | Code: | sWindump = windump.exe -A -q -i 2 -p >>D:\bumblebee\windump.txt
Run, %sWindump% |
|
|
| Back to top |
|
 |
rocknrollgolfer
Joined: 03 Oct 2009 Posts: 8
|
Posted: Sat Oct 03, 2009 8:23 pm Post subject: |
|
|
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. |
|
| Back to top |
|
 |
rocknrollgolfer
Joined: 03 Oct 2009 Posts: 8
|
Posted: Mon Oct 05, 2009 3:51 pm Post subject: |
|
|
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. |
|
| Back to top |
|
 |
|