 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Laszlo
Joined: 14 Feb 2005 Posts: 3877 Location: Pittsburgh
|
Posted: Tue Oct 25, 2005 4:19 pm Post subject: |
|
|
| AHKnow* wrote: | | temporarily block user input just before the console program terminates | We normally don't know when it would terminate.
| AHKnow* wrote: | | pass the original clipboard data into a variable too, like say variable "X". Then your script uses the clipboard. You then copy the contents of variable "X", back to the clipboard. | This is exactly what I meant. It is the standard practice, omitted from the original post for clarity | Code: | !c::
Settimer GetIt, 30 ; the GetIt thread will get the buffer
RunWait %comspec% /k dir c:\,,,PID ; will be closed from GetIt
; at this point: console buffer -> ClipBoard
StringReplace Text,ClipBoard,`r`n%A_WorkingDir%>,,R ; remove last command prompt
ClipBoard = %ClipBoard0% ; <- Restore original
MsgBox %Text% ; put here the code to process Text
Return
GetIt:
WinGetTitle Title, ahk_pid %PID% ; get the changing window title
If Title <> %comspec% ; program name affixed while busy
Return ; keep trying until idle
Settimer GetIt, Off ; need not run any more
WinActivate ahk_pid %PID% ; go to our console window
ClipBoard0= %ClipBoardAll% ; <- save original
ClipBoard = ; empty ClibBoard to see data comming
Send !{Space}es{Enter} ; select all = used buffer, copy to clipboard
ClipWait 2 ; wait until clipboard is available, < 2s
WinClose ahk_pid %PID% ; close console window
Return | With this version the two applications involved jump to the foreground, and the user's work get interrupted. There is no need to block user input. |
|
| Back to top |
|
 |
AHKnow* Guest
|
Posted: Wed Oct 26, 2005 5:09 am Post subject: |
|
|
| Thanks Laszlo. I think you did a good job dealing with my questions. |
|
| Back to top |
|
 |
fooz
Joined: 08 Jan 2006 Posts: 8
|
Posted: Fri Jan 20, 2006 6:47 pm Post subject: |
|
|
Hi,
Crossposting the following from this post:
http://www.autohotkey.com/forum/viewtopic.php?t=7490
Regarding CMDret, and the following code:
| Code: |
CMDout=
CMDerr=
ProgramName := "C:\php\php.exe getVPIP.php 5"
Ret := RunWaitEx(ProgramName, NULL, TextIn, CMDout, CMDerr)
MsgBox, Return Value: %Ret% `r`n`r`nStdError: `r`n%CMDerr%`r`nStdOutput: `r`n%CMDout%
RunWaitEx(CMD, CMDdir, CMDin, ByRef CMDout, ByRef CMDerr)
{
VarSetCapacity(CMDOut, 100000)
VarSetCapacity(CMDerr, 100000)
RetVal := DllCall("cmdret.dll\RunWEx", "str", CMD, "str", CMDdir, "str", CMDin, "str", CMDout, "str", CMDerr)
Return, %RetVal%
}
|
I am using it to call a PHP program that outputs values/data to standard out. Is this what is captured in "CMDout"? Or do I need to somehow access that variable by reference within the called PHP program? |
|
| Back to top |
|
 |
not-logged-in-daonlyfreez Guest
|
Posted: Sat Jan 21, 2006 12:08 am Post subject: |
|
|
Try adding this
And changing this
| Code: | ProgramName = C:\php\php.exe getVPIP.php 5
Ret := RunWaitEx(ProgramName, NULL, CMDin, CMDout, CMDerr) |
|
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2328
|
Posted: Mon Jan 23, 2006 1:22 am Post subject: |
|
|
Work on version 4 of CMDret is now in progress. The main goal of this release is to streamline the syntax/functionality of CMDret to hopefully make the addition of CMDret functionality to AHK a bit easier (as a possible built-in command and/or function).
Any comments and/or suggestions for syntax and/or functionality of CMDret for the next release would be greatly appreciated .
Thanks  |
|
| Back to top |
|
 |
jroad
Joined: 06 Feb 2006 Posts: 26
|
Posted: Mon Feb 13, 2006 9:04 pm Post subject: |
|
|
Hi corrupt,
First off thanks for taking the time working on this tool. My question would be to ask if it was possible to have your tool return the process id? If not, then could the exe version be updated to send output to a variable?
Also, I just downloaded the CMDRET1.1 exe zipfile, looking for examples but did not find any within.
Regards |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10450
|
Posted: Sun Feb 26, 2006 10:37 pm Post subject: |
|
|
| Due to a suggestion from PhiLho, I put a link to this topic in the FAQ under "how to retrieve command line output". This should help increase awareness of CmdRet. |
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2328
|
Posted: Sun Mar 12, 2006 1:28 am Post subject: |
|
|
The RunReturn function is now available as a function that doesn't rely on an external dll  |
|
| Back to top |
|
 |
eagle00789
Joined: 27 Nov 2006 Posts: 48 Location: Heerlen Country: Netherlands
|
Posted: Tue Jun 26, 2007 7:23 am Post subject: |
|
|
is any of the CMDRet functions in the dll compatible with a hidden cmd window, or can i use the pure ahk-function to get the output of a hidden cmd window (started with | Code: | | RunWait, c:\winamppid.vbs,,hide | ) or can you make a suggestion of how to do this on a hidden cmd window _________________ Before asking a question try to read the manual
Always use the code sections when you paste some code |
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2328
|
Posted: Wed Jun 27, 2007 7:22 am Post subject: |
|
|
| eagle00789 wrote: | is any of the CMDRet functions in the dll compatible with a hidden cmd window, or can i use the pure ahk-function to get the output of a hidden cmd window (started with | Code: | | RunWait, c:\winamppid.vbs,,hide | ) or can you make a suggestion of how to do this on a hidden cmd window | Instead of using RunWait to start the vbs script, try using CMDret instead. CMDret does not currently have an option to connect to a process that is already running. The window should end up being hidden if run using CMDret. |
|
| Back to top |
|
 |
eagle00789
Joined: 27 Nov 2006 Posts: 48 Location: Heerlen Country: Netherlands
|
Posted: Wed Jun 27, 2007 2:31 pm Post subject: |
|
|
ok. i'm changing my code right now  _________________ Before asking a question try to read the manual
Always use the code sections when you paste some code |
|
| Back to top |
|
 |
Hogar Guest
|
Posted: Wed Aug 01, 2007 7:17 pm Post subject: |
|
|
Hi corrupt,
Great work!
You wrote it's freeware but did you mean "freeware" or "free software"? What License is it?
Thanks
Hogar |
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2328
|
Posted: Wed Aug 01, 2007 7:30 pm Post subject: |
|
|
| Hogar wrote: | Hi corrupt,
Great work!
You wrote it's freeware but did you mean "freeware" or "free software"? What License is it?
Thanks
Hogar | Thanks
For non-commercial use, non-critical environments (eg. not for medical equipment, nuclear reactor, etc...) - no restrictions
For commercial use - a credit somewhere would be nice but not required, depends on usage...
If you would like something a lot more specific then please suggest a specific license and I'll let you know... Either way, I wouldn't be looking for compensation, I'd just want to cover possible liability issues... (USE AT YOUR OWN RISK) . |
|
| Back to top |
|
 |
Hogar Guest
|
Posted: Wed Aug 01, 2007 9:22 pm Post subject: |
|
|
Thanks!
Be shure I write your name ("corrupt"?) in the Credits/About.
Hogar |
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2328
|
Posted: Thu Aug 02, 2007 1:10 am Post subject: |
|
|
| Hogar wrote: | Thanks!
Be shure I write your name ("corrupt"?) in the Credits/About.
Hogar | Greg Fenty (aka "corrupt")
apps4apps@gmail.com
http://www.apps4apps.filetap.com
This message will self-destruct in 48 hours...  |
|
| 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
|