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 

I try to ControlSend " to cmd. It sends Ä
Goto page 1, 2  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Rizzo
Guest





PostPosted: Sun Jan 20, 2008 11:45 pm    Post subject: I try to ControlSend " to cmd. It sends Ä Reply with quote

I try to ControlSend
Code:
"
to cmd. It sends
Code:
Ä


Do you know what I can do to send
Code:
"
?
Back to top
BoBo¨
Guest





PostPosted: Sun Jan 20, 2008 11:53 pm    Post subject: Reply with quote

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

PostPosted: Mon Jan 21, 2008 1:38 am    Post subject: Reply with quote

Works for me.
Code:
ControlSend,, ", ahk_class ConsoleWindowClass
Back to top
View user's profile Send private message
Trikster



Joined: 15 Jul 2007
Posts: 1224
Location: Enterprise, Alabama

PostPosted: Mon Jan 21, 2008 3:58 am    Post subject: Reply with quote

Perhaps make it literal? `"
_________________
ScriptPad | ~dieom | dieom | izwian2k7 | Ian | God
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 2739
Location: Australia, Qld

PostPosted: Mon Jan 21, 2008 5:01 am    Post subject: Reply with quote

  1. Quote marks only need to be escaped in expressions, not commands.
  2. 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
View user's profile Send private message
ManaUser



Joined: 24 May 2007
Posts: 906

PostPosted: Mon Jan 21, 2008 5:25 am    Post subject: Reply with quote

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
View user's profile Send private message
garry



Joined: 19 Apr 2005
Posts: 1186
Location: switzerland

PostPosted: Mon Jan 21, 2008 5:30 pm    Post subject: Reply with quote

example with transform
Code:
!k::
transform,S,chr,34
ControlSend,,%S%, ahk_class ConsoleWindowClass
return
Back to top
View user's profile Send private message
Rizzo
Guest





PostPosted: Mon Jan 21, 2008 6:47 pm    Post subject: Reply with quote

Awsome. Great ideas guys!
Code:

+2 ;(=shift 2)

worked!

Not elegant... but works Wink
Back to top
Rizzo
Guest





PostPosted: Tue Jan 22, 2008 10:09 pm    Post subject: Reply with quote

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

PostPosted: Tue Jan 22, 2008 11:03 pm    Post subject: Reply with quote

Code:
ControlSendRaw,, ", ahk_class ConsoleWindowClass


Question Question
_________________
ScriptPad | ~dieom | dieom | izwian2k7 | Ian | God
Back to top
View user's profile Send private message
Rizzo
Guest





PostPosted: Tue Jan 22, 2008 11:16 pm    Post subject: Reply with quote

Code:

ControlSend,, ", ahk_class ConsoleWindowClass
ControlSendRaw,, ", ahk_class ConsoleWindowClass

both send Ä. Scrath them genius brains some more! Wink
Back to top
DJAnonimo



Joined: 10 Sep 2006
Posts: 148

PostPosted: Tue Jan 22, 2008 11:24 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
Trikster



Joined: 15 Jul 2007
Posts: 1224
Location: Enterprise, Alabama

PostPosted: Tue Jan 22, 2008 11:36 pm    Post subject: Reply with quote

Code:
send := "{{}"
Send, %Send%


If that fails..

Code:

send := "{"
Send, %Send%

_________________
ScriptPad | ~dieom | dieom | izwian2k7 | Ian | God
Back to top
View user's profile Send private message
Rizzo
Guest





PostPosted: Tue Jan 22, 2008 11:36 pm    Post subject: Reply with quote

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 Shocked
Back to top
Rizzo
Guest





PostPosted: Tue Jan 22, 2008 11:42 pm    Post subject: Reply with quote

Code:

var1 = "
var2 := """"

WinActivate, Command Prompt
Sleep, 1000
Send, "%var1%%var2%


Sends ÄÄÄ
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
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