AutoHotkey Community

It is currently May 25th, 2012, 9:35 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 164 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9 ... 11  Next
Author Message
 Post subject:
PostPosted: October 25th, 2005, 4:19 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 26th, 2005, 5:09 am 
Thanks Laszlo. I think you did a good job dealing with my questions.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 20th, 2006, 6:47 pm 
Offline

Joined: January 8th, 2006, 10:31 pm
Posts: 8
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 21st, 2006, 12:08 am 
Try adding this

Code:
CMDin = ""


And changing this

Code:
ProgramName = C:\php\php.exe getVPIP.php 5

Ret := RunWaitEx(ProgramName, NULL, CMDin, CMDout, CMDerr)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 23rd, 2006, 1:22 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2541
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 :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 13th, 2006, 9:04 pm 
Offline

Joined: February 6th, 2006, 3:12 am
Posts: 26
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 26th, 2006, 10:37 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 12th, 2006, 1:28 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2541
The RunReturn function is now available as a function that doesn't rely on an external dll :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 26th, 2007, 7:23 am 
Offline

Joined: November 27th, 2006, 1:44 pm
Posts: 61
Location: Heerlen Country: Netherlands
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2007, 7:22 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2541
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2007, 2:31 pm 
Offline

Joined: November 27th, 2006, 1:44 pm
Posts: 61
Location: Heerlen Country: Netherlands
ok. i'm changing my code right now :D

_________________
Before asking a question try to read the manual
Always use the code sections when you paste some code


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 1st, 2007, 7:17 pm 
Hi corrupt,

Great work!
You wrote it's freeware but did you mean "freeware" or "free software"? What License is it?

Thanks
Hogar


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 1st, 2007, 7:30 pm 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2541
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) ;) :) .


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 1st, 2007, 9:22 pm 
Thanks!

Be shure I write your name ("corrupt"?) in the Credits/About.

Hogar


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 2nd, 2007, 1:10 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2541
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... ;)


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 164 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9 ... 11  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 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