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 

How can i send text to the command prompt?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
paede



Joined: 10 Mar 2005
Posts: 3

PostPosted: Fri Apr 22, 2005 8:44 am    Post subject: How can i send text to the command prompt? Reply with quote

How can i send text to the command prompt if the hotkey script is started from the command line?
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Fri Apr 22, 2005 9:15 am    Post subject: Reply with quote

What d'you wanna do? FTP-Login? Enter parameters/switches??
Back to top
paede



Joined: 10 Mar 2005
Posts: 3

PostPosted: Fri Apr 22, 2005 9:18 am    Post subject: Reply with quote

no i want to start my script with parameter in the command prompt and if no parameter is given, the the script should output an error to the command line.
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Fri Apr 22, 2005 9:41 am    Post subject: Reply with quote

Peade wrote:
Quote:
i want to start my script with parameter in the command prompt

Code:
Run, %COMSPEC% MyCompiledScript.exe 1stParam 2ndParam,, Max

Quote:
; MyCompiledScript.exe
If 1 = 1stParam
MsgBox, Your first param was: %1%
If 2 = 2ndParam
MsgBox, Your second param was: %2%
MsgBox, Btw: you've used %0% params!


Are you shure that you've STFM for: parameter !?
I guess NO Rolling Eyes
Back to top
MYYM



Joined: 05 Apr 2005
Posts: 132

PostPosted: Fri Apr 22, 2005 9:55 am    Post subject: Reply with quote

Quote:
if no parameter is given, the the script should output an error to the command line.

Code:
if 1=     ; if no parameters
{
   filedelete, error.bat
   fileappend ,echo error`npause`n ,error.bat
   Run, Error.bat /k
   exitapp
}
msgbox %1% ; if parameter has been given
;
;Put your code here
;

MYYM
Back to top
View user's profile Send private message Visit poster's website
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10480

PostPosted: Fri Apr 22, 2005 11:32 am    Post subject: Reply with quote

Since there's no direct way for a script to send text to the command prompt it was started from, you might also consider showing a MsgBox in cases like these.
Back to top
View user's profile Send private message Send e-mail
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Fri Apr 22, 2005 9:26 pm    Post subject: Reply with quote

You could also look into the OutputDebug command, which provides similar functionality to stderr.
Back to top
View user's profile Send private message
Decarlo110



Joined: 15 Dec 2004
Posts: 303
Location: United States

PostPosted: Mon May 02, 2005 5:44 pm    Post subject: Reply with quote

Solution:

Example 1:

SetTitleMatchMode, 2
CoordMode, Mouse, Relative
run cmd.exe
WinWaitActive cmd.exe
clipboard=rem: The script was called (your text goes here).`r
MouseClick, R, 100, 100,,0
return

Example 2:

SetTitleMatchMode, 2
CoordMode, Mouse, Relative
ifWinExist cmd.exe
WinActivate
else run cmd.exe
WinWaitActive cmd.exe
MouseGetPos, xCmd, yCmd
clipboard=rem: The script was called.`rprompt $d$s$t$s$p$g`rcd.. & cd.. && color 1b`rtitle AutoHotkey-compatible prompt`rrem: Example 2 successful.`r
MouseClick, R, 100, 100,,0
MouseMove, xCmd, yCmd, 0
return
_________________
1) The Open Source Definition http://www.opensource.org/docs/definition_plain.php

2) Intuitive. Logical. Versatile. Adaptable. <<AutoHotkey>>
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
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