AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CMDret - return output from console progs [DLL version]
Goto page Previous  1, 2, 3 ... , 9, 10, 11  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Utilities & Resources
View previous topic :: View next topic  
Author Message
RandomHeart



Joined: 24 Mar 2009
Posts: 20

PostPosted: Sun Nov 08, 2009 3:20 am    Post subject: Reply with quote

Is it possible to run multiple commands in a pipe with cmdret.dll?
Back to top
View user's profile Send private message
widow
Guest





PostPosted: Thu Nov 19, 2009 12:40 am    Post subject: Reply with quote

RandomHeart wrote:
Is it possible to run multiple commands in a pipe with cmdret.dll?


You mean like this?

Code:
cmd /k netstat -ano|find /i "connected" && IF ERRORLEVEL==1 echo a>.\log.txt
Back to top
RandomHeart



Joined: 24 Mar 2009
Posts: 20

PostPosted: Fri Nov 20, 2009 3:50 am    Post subject: Reply with quote

Yes, but without using cmd
Back to top
View user's profile Send private message
corrupt



Joined: 29 Dec 2004
Posts: 2485

PostPosted: Sat Dec 19, 2009 7:33 am    Post subject: Reply with quote

Anonymous wrote:
why this doesnt work

Code:
; CMDret DLL version 3.1 (or greater) required

Run, Notepad,,, notepid
WinWait, ahk_pid %notepid%
WinWaitActive, ahk_pid %notepid%

CMD := "dir"
ControlGet, OutputWindow, Hwnd,, Edit1, ahk_pid %notepid%
if OutputWindow <> 0
  StrOut := DllCall("cmdret.dll\RunInControl", "str", CMD, "Uint", OutputWindow, "str", "Edit", "int", "1")

It doesn't work because dir is not an executable file. You would need to load the command interpreter first.
Code:
; CMDret DLL version 3.1 (or greater) required

Run, Notepad,,, notepid
WinWait, ahk_pid %notepid%
WinWaitActive, ahk_pid %notepid%

CMD := "cmd /c dir c:"
ControlGet, OutputWindow, Hwnd,, Edit1, ahk_pid %notepid%
if OutputWindow <> 0
  StrOut := DllCall("cmdret.dll\RunInControl", "str", CMD, "Uint", OutputWindow, "str", "Edit", "int", "1")
Back to top
View user's profile Send private message Visit poster's website
luvan



Joined: 17 Mar 2007
Posts: 25

PostPosted: Sun Dec 20, 2009 5:55 pm    Post subject: I do not under stand Reply with quote

But
Code:
CMD := "cmd /c dir c: /s"

will not work
Question
Back to top
View user's profile Send private message
segalion
Guest





PostPosted: Fri Jan 15, 2010 1:56 pm    Post subject: Problems with cmdret Reply with quote

I was using CMDret (runreturn) example funtion succesfully until I have in problems with timing in some cases executing (I suppose) large commandline curl parameter.

Seems that if I use CMD direct comand, it returns in less than 2 seconds. And when I use the same CMDret function it takes more than 15 secs.

Is there any limit with size of parameter command?
Maybe a problem with directory locations? I was using allways the full path...
Back to top
segalion
Guest





PostPosted: Mon Jan 18, 2010 3:27 pm    Post subject: Reply with quote

Sorry by the previous post. Thats was an error with timers stuffs. The function work fine (as cmd.exe) as expected calling first than call the timers...
Back to top
corrupt



Joined: 29 Dec 2004
Posts: 2485

PostPosted: Sun Jan 31, 2010 5:19 am    Post subject: Re: I do not under stand Reply with quote

luvan wrote:
But
Code:
CMD := "cmd /c dir c: /s"

will not work
Question

Which operating system are you using?
Back to top
View user's profile Send private message Visit poster's website
autoh0tkey.com-user



Joined: 03 Mar 2010
Posts: 1

PostPosted: Wed Mar 03, 2010 10:58 am    Post subject: Reply with quote

Some command line programs require User Input. How can I do to insert it?

Like:


Code:
c:\prog\>server_login.exe
Enter your user name
John
Enter your password
x3343
Verifying ....



Thanks!
Back to top
View user's profile Send private message
term181170
Guest





PostPosted: Fri Dec 03, 2010 11:00 am    Post subject: Using cmdret.dll from c++ Reply with quote

I'm trying to use is at cmdret.dll RunReturn from a dll written in C + +. I'm using the load at run time and am not able to get the output of the command and the function returns 1016. I want to know the exact type of the parameters of each of the functions or if there cmdret.lib cmdret.dll to link to my project. Thank you very much.
Back to top
corrupt



Joined: 29 Dec 2004
Posts: 2485

PostPosted: Sat Dec 04, 2010 7:51 pm    Post subject: Re: Using cmdret.dll from c++ Reply with quote

term181170 wrote:
I'm trying to use is at cmdret.dll RunReturn from a dll written in C + +. I'm using the load at run time and am not able to get the output of the command and the function returns 1016. I want to know the exact type of the parameters of each of the functions or if there cmdret.lib cmdret.dll to link to my project. Thank you very much.
I'll see if I can locate the source code a bit later today (BCX, C sources. It's on a PC that I haven't started up in a couple months) and let you know and/or provide the source code for download. Note: the current version uses the stdcall calling convention.
Back to top
View user's profile Send private message Visit poster's website
corrupt



Joined: 29 Dec 2004
Posts: 2485

PostPosted: Mon Dec 06, 2010 2:46 am    Post subject: Re: Using cmdret.dll from c++ Reply with quote

corrupt wrote:
term181170 wrote:
I'm trying to use is at cmdret.dll RunReturn from a dll written in C + +. I'm using the load at run time and am not able to get the output of the command and the function returns 1016. I want to know the exact type of the parameters of each of the functions or if there cmdret.lib cmdret.dll to link to my project. Thank you very much.
I'll see if I can locate the source code a bit later today (BCX, C sources. It's on a PC that I haven't started up in a couple months) and let you know and/or provide the source code for download. Note: the current version uses the stdcall calling convention.
I haven't located the current code yet but the previous version used the following: C_EXPORT long __stdcall RunReturn (char *CMDin, char *CMDout)
The output is the number of characters returned + 1 or 0 if the process could not be created.
Back to top
View user's profile Send private message Visit poster's website
Guest






PostPosted: Wed Dec 08, 2010 12:30 pm    Post subject: Re: Using cmdret.dll from c++ Reply with quote

corrupt wrote:
corrupt wrote:
term181170 wrote:
I'm trying to use is at cmdret.dll RunReturn from a dll written in C + +. I'm using the load at run time and am not able to get the output of the command and the function returns 1016. I want to know the exact type of the parameters of each of the functions or if there cmdret.lib cmdret.dll to link to my project. Thank you very much.
I'll see if I can locate the source code a bit later today (BCX, C sources. It's on a PC that I haven't started up in a couple months) and let you know and/or provide the source code for download. Note: the current version uses the stdcall calling convention.
I haven't located the current code yet but the previous version used the following: C_EXPORT long __stdcall RunReturn (char *CMDin, char *CMDout)
The output is the number of characters returned + 1 or 0 if the process could not be created.


Thank you very much. Now work!!
Back to top
aSEioT



Joined: 31 Oct 2010
Posts: 85

PostPosted: Tue Dec 28, 2010 8:36 am    Post subject: Reply with quote

The tool is really great! But do not support ahk unicode version rightnow, what a pity! Confused
Back to top
View user's profile Send private message
corrupt



Joined: 29 Dec 2004
Posts: 2485

PostPosted: Thu Mar 03, 2011 1:53 am    Post subject: Reply with quote

aSEioT wrote:
The tool is really great! But do not support ahk unicode version rightnow, what a pity! Confused
I'm not currently using AhkL but will look into it. Thanks
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Utilities & Resources All times are GMT
Goto page Previous  1, 2, 3 ... , 9, 10, 11  Next
Page 10 of 11

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group