Jump to content

ControlSend a colon to command window


Recommended Posts

Does anyone know how to get ControlSend to send non-alphabetic and non-numeric characters to a command prompt window? In particular, an asterisk and a colon. Every time I try, the numeral 8 is substituted for an asterisk, and a semi-colon is substituted for a colon.

There are many posts that show ControlSend code with a colon in a path but, from my perspective, I do not see how they worked. To see what I mean, try the following code. Please note that this code is only to demonstrate the ControlSend problem I am having, so please ignore other ways to get to the root directory of c-drive.

Opt("WinTitleMatchMode",4)
Run("cmd", @TempDir)
WinWait("classname=ConsoleWindowClass")
$hWnd = WinGetHandle("Classname=ConsoleWindowClass")

; With flag zero, no plus sign
ControlSend($hWnd,"","","cd c:\{Enter}", 0)
MsgBox(4096, "ControlSend test", "1. With flag = 0, is the dirctory C:\?")

; With flag zero, and plus sign.
ControlSend($hWnd,"","","cd c+:\{Enter}", 0)
MsgBox(4096, "ControlSend test", "2. With flag = 0 and used +, is the dirctory C+:\?")

; With flag 1.
ControlSend($hWnd,"","","cd c:\", 1)
ControlSend($hWnd,"","","{Enter}", 0)
MsgBox(4096, "ControlSend test", "3. With flag = 1, is the dirctory C:\?")

; Send
Send("cd c:\{Enter}", 0)
MsgBox(4096, "Send test", "4. How about now, is the directory C:\?")

Phillip

Link to comment
Share on other sites

"shift state" characters are not so "controlsend-able". there was a workaround, some time ago... search the forum for ControlSendPlus...

Lar.

<{POST_SNAPBACK}>

Thank you, that worked. It's from Pekster's AutoIt Script Index Page, http://www.autoitscript.com/fileman/users/pekster/pekster%27s%20scripting%20index.html. Thanks Pekster!

ControlSendPlus version 2.03

Originally called ShiftControlSend, this UDF is designed to be an enhancement to the ControlSend function. It will properly handle the shift state to controls by using the global shift, which the ControlSend function does not do. It will also properly send the alt and control keystrokes, as well as understand the special characters such as {ENTER} and {UP}. It's even able to handle advanced forms, such as "!^{ENTER 2}".

Phillip

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...