 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Rizzo Guest
|
Posted: Sun Jan 20, 2008 11:45 pm Post subject: I try to ControlSend " to cmd. It sends Ä |
|
|
I try to ControlSend
to cmd. It sends
Do you know what I can do to send ? |
|
| Back to top |
|
 |
BoBo¨ Guest
|
Posted: Sun Jan 20, 2008 11:53 pm Post subject: |
|
|
AFAIK, %comspec% only works with ASCII.
What string you wanna write to the shell?
| Code: | | Run, %comspec% /k /v find "BoBo" "c:\My very long path\*.txt" |
|
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2739 Location: Australia, Qld
|
Posted: Mon Jan 21, 2008 1:38 am Post subject: |
|
|
Works for me.
| Code: | | ControlSend,, ", ahk_class ConsoleWindowClass |
|
|
| Back to top |
|
 |
Trikster
Joined: 15 Jul 2007 Posts: 1224 Location: Enterprise, Alabama
|
Posted: Mon Jan 21, 2008 3:58 am Post subject: |
|
|
Perhaps make it literal? `" _________________ ScriptPad | ~dieom | dieom | izwian2k7 | Ian | God |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2739 Location: Australia, Qld
|
Posted: Mon Jan 21, 2008 5:01 am Post subject: |
|
|
- Quote marks only need to be escaped in expressions, not commands.
- Literal quote marks in expressions are written as "", not `". The reason is that escape sequences (with `back-tick) are resolved when the script loads, whereas quote marks in expressions are parsed every time the expression is evaluated.
Btw, I also tried {Asc 34}, but it uses an Alt+NNNN combination, which apparently only works for the active window. (In other words, it works with Send but not ControlSend.) |
|
| Back to top |
|
 |
ManaUser
Joined: 24 May 2007 Posts: 906
|
Posted: Mon Jan 21, 2008 5:25 am Post subject: |
|
|
| I have no reason to think this will work any better, but just for the heck of it, try +' (Shift+Single-Quote). |
|
| Back to top |
|
 |
garry
Joined: 19 Apr 2005 Posts: 1186 Location: switzerland
|
Posted: Mon Jan 21, 2008 5:30 pm Post subject: |
|
|
example with transform
| Code: | !k::
transform,S,chr,34
ControlSend,,%S%, ahk_class ConsoleWindowClass
return
|
|
|
| Back to top |
|
 |
Rizzo Guest
|
Posted: Mon Jan 21, 2008 6:47 pm Post subject: |
|
|
Awsome. Great ideas guys!
worked!
Not elegant... but works  |
|
| Back to top |
|
 |
Rizzo Guest
|
Posted: Tue Jan 22, 2008 10:09 pm Post subject: |
|
|
I though using the shift button would solve all my troubles. But ney, life is not that easy! Using shift has been hugely unreliable. More than 50% of the time 2 is sent instead of ". I don't know why.
Do you brilliant guys have any more ideas? |
|
| Back to top |
|
 |
Trikster
Joined: 15 Jul 2007 Posts: 1224 Location: Enterprise, Alabama
|
Posted: Tue Jan 22, 2008 11:03 pm Post subject: |
|
|
| Code: | | ControlSendRaw,, ", ahk_class ConsoleWindowClass |
 _________________ ScriptPad | ~dieom | dieom | izwian2k7 | Ian | God |
|
| Back to top |
|
 |
Rizzo Guest
|
Posted: Tue Jan 22, 2008 11:16 pm Post subject: |
|
|
| Code: |
ControlSend,, ", ahk_class ConsoleWindowClass
ControlSendRaw,, ", ahk_class ConsoleWindowClass
|
both send Ä. Scrath them genius brains some more!  |
|
| Back to top |
|
 |
DJAnonimo
Joined: 10 Sep 2006 Posts: 148
|
Posted: Tue Jan 22, 2008 11:24 pm Post subject: |
|
|
How to send { or } from a variable ?
| Code: | Script := TEST { TEST }
transform,bracket1,chr,123
transform,bracket2,chr,125
_bracket1 := "%bracket1%"
_bracket2 := "%bracket2%"
StringReplace, Script, Script, {, %_bracket1%, All
StringReplace, Script, Script, }, %_bracket2%, All
Loop, Parse, Script, `n, `r
ControlSend, , %A_LoopField%{Enter}, ahk_pid %PID% |
this code sends the variable name inside percent signs. |
|
| Back to top |
|
 |
Trikster
Joined: 15 Jul 2007 Posts: 1224 Location: Enterprise, Alabama
|
Posted: Tue Jan 22, 2008 11:36 pm Post subject: |
|
|
| Code: | send := "{{}"
Send, %Send% |
If that fails..
| Code: |
send := "{"
Send, %Send% |
_________________ ScriptPad | ~dieom | dieom | izwian2k7 | Ian | God |
|
| Back to top |
|
 |
Rizzo Guest
|
Posted: Tue Jan 22, 2008 11:36 pm Post subject: |
|
|
Thanks DJ! Unfortunately I haven't been able to get that to work.
I hoped using Sean's StdOutput function would work
| Code: |
Runas, Admin, Pass
sCmd = NET stop "VMWare NAT Service"
sWork =
sInput =
CreatePipe(hStdInRd , hStdInWr ) ; Create a pipe for StdIn
CreatePipe(hStdOutRd, hStdOutWr) ; Create a pipe for StdOut
SetHandleInformation(hStdInRd ) ; make the handle hStdInRd inheritable to a child process, the console app
SetHandleInformation(hStdOutWr) ; make the handle hStdOutWr inheritable to a child process, the console app
pid := CreateProcess(sCmd, sWork) ; Create the console app without creating a console window
StdInput( sInput , hStdInRd , hStdInWr ) ; complete the StdIn
StdOutput(sOutput, hStdOutRd, hStdOutWr) ; complete the StdOut
MsgBox, % sOutput
|
It almost worked! It sent " correctly. BUT... the cmd command won't work without admin rights. And I haven't been able to get Runas to work in Vista .
More ideas? All I want to do is send " to a cmd window... harder than it seemed  |
|
| Back to top |
|
 |
Rizzo Guest
|
Posted: Tue Jan 22, 2008 11:42 pm Post subject: |
|
|
| Code: |
var1 = "
var2 := """"
WinActivate, Command Prompt
Sleep, 1000
Send, "%var1%%var2%
|
Sends ÄÄÄ |
|
| 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
|