| View previous topic :: View next topic |
| Author |
Message |
paede
Joined: 10 Mar 2005 Posts: 3
|
Posted: Fri Apr 22, 2005 8:44 am Post subject: How can i send text to the command prompt? |
|
|
| How can i send text to the command prompt if the hotkey script is started from the command line? |
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Fri Apr 22, 2005 9:15 am Post subject: |
|
|
| What d'you wanna do? FTP-Login? Enter parameters/switches?? |
|
| Back to top |
|
 |
paede
Joined: 10 Mar 2005 Posts: 3
|
Posted: Fri Apr 22, 2005 9:18 am Post subject: |
|
|
| 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 |
|
 |
BoBo Guest
|
Posted: Fri Apr 22, 2005 9:41 am Post subject: |
|
|
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  |
|
| Back to top |
|
 |
MYYM
Joined: 05 Apr 2005 Posts: 132
|
Posted: Fri Apr 22, 2005 9:55 am Post subject: |
|
|
| 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 |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10480
|
Posted: Fri Apr 22, 2005 11:32 am Post subject: |
|
|
| 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 |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Fri Apr 22, 2005 9:26 pm Post subject: |
|
|
| You could also look into the OutputDebug command, which provides similar functionality to stderr. |
|
| Back to top |
|
 |
Decarlo110
Joined: 15 Dec 2004 Posts: 303 Location: United States
|
Posted: Mon May 02, 2005 5:44 pm Post subject: |
|
|
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 |
|
 |
|