gredo Posted July 21, 2007 Share Posted July 21, 2007 I want to do this: Hold the CTRL key, then click somewhere and then release the CTRL key (or let it hold it forever I don't care). Any ideas? Thank you in advance! Link to comment Share on other sites More sharing options...
rrrm99 Posted July 21, 2007 Share Posted July 21, 2007 (edited) Send("{Ctrldown}") Mouseclick("left", x, y) Send("{Ctrlup}") was that it? Edited July 21, 2007 by rrrm99 Link to comment Share on other sites More sharing options...
MyDisplayName Posted July 21, 2007 Share Posted July 21, 2007 From the pages of the Help File (Function Reference>Keyboard Control>Send): Function Reference Send -------------------------------------------------------------------------------- Sends simulated keystrokes to the active window. Send ( "keys" [, flag] ) Parameters keys The sequence of keys to send. flag [optional] Changes how "keys" is processed: flag = 0 (default), Text contains special characters like + and ! to indicate SHIFT and ALT key-presses. flag = 1, keys are sent raw. Return Value None. Remarks See the Appendix for some tips on using Send. AutoIt can send all ASCII and Extended ASCII characters (0-255), to send UNICODE characters you must use the "ASC" option and the code of the character you wish to send (see {ASC} at the bottom of the table below). The "Send" command syntax is similar to that of ScriptIt and the Visual Basic "SendKeys" command. Characters are sent as written with the exception of the following characters: '!' This tells AutoIt to send an ALT keystroke, therefore Send("This is text!a") would send the keys "This is text" and then press "ALT+a". N.B. Some programs are very choosy about capital letters and ALT keys, i.e. "!A" is different to "!a". The first says ALT+SHIFT+A, the second is ALT+a. If in doubt, use lowercase! '+' This tells AutoIt to send a SHIFT keystroke, therefore Send("Hell+o") would send the text "HellO". Send("!+a") would send "ALT+SHIFT+a". '^' This tells AutoIt to send a CONTROL keystroke, therefore Send("^!a") would send "CTRL+ALT+a". N.B. Some programs are very choosy about capital letters and CTRL keys, i.e. "^A" is different to "^a". The first says CTRL+SHIFT+A, the second is CTRL+a. If in doubt, use lowercase! '#' The hash now sends a Windows keystroke; therefore, Send("#r") would send Win+r which launches the Run dialog box. You can set SendCapslockMode to make CAPS LOCK disabled at the start of a Send operation and restored upon completion. However, if a user is holding down the Shift key when a Send function begins, text may be sent in uppercase. One workaround is to Send("{SHIFTDOWN}{SHIFTUP}") before the other Send operations. Certain keyboard as the Czech one send different characters when using the Shift Key or being in CAPS LOCK enabled and sending a char. Due to the send AutoIt implementation the CAPS LOCKed char will be sent as Shifted one so it will not work. Certain special keys can be sent and should be enclosed in braces: N.B. Windows does not allow the simulation of the "CTRL-ALT-DEL" combination! Send Command (if zero flag) Resulting Keypress {!} ! {#} # {+} + {^} ^ {{} { {}} } {SPACE} SPACE {ENTER} ENTER key on the main keyboard {ALT} ALT {BACKSPACE} or {BS} BACKSPACE {DELETE} or {DEL} DELETE {UP} Up arrow {DOWN} Down arrow {LEFT} Left arrow {RIGHT} Right arrow {HOME} HOME {END} END {ESCAPE} or {ESC} ESCAPE {INSERT} or {INS} INS {PGUP} PageUp {PGDN} PageDown {F1} - {F12} Function keys {TAB} TAB {PRINTSCREEN} Print Screen key {LWIN} Left Windows key {RWIN} Right Windows key {NUMLOCK on} NUMLOCK (on/off/toggle) {CAPSLOCK off} CAPSLOCK (on/off/toggle) {SCROLLLOCK toggle} SCROLLLOCK (on/off/toggle) {BREAK} for Ctrl+Break processing {PAUSE} PAUSE {NUMPAD0} - {NUMPAD9} Numpad digits {NUMPADMULT} Numpad Multiply {NUMPADADD} Numpad Add {NUMPADSUB} Numpad Subtract {NUMPADDIV} Numpad Divide {NUMPADDOT} Numpad period {NUMPADENTER} Enter key on the numpad {APPSKEY} Windows App key {LALT} Left ALT key {RALT} Right ALT key {LCTRL} Left CTRL key {RCTRL} Right CTRL key {LSHIFT} Left Shift key {RSHIFT} Right Shift key {SLEEP} Computer SLEEP key {ALTDOWN} Holds the ALT key down until {ALTUP} is sent {SHIFTDOWN} Holds the SHIFT key down until {SHIFTUP} is sent {CTRLDOWN} Holds the CTRL key down until {CTRLUP} is sent {LWINDOWN} Holds the left Windows key down until {LWINUP} is sent {RWINDOWN} Holds the right Windows key down until {RWINUP} is sent Link to comment Share on other sites More sharing options...
LukeJrs Posted July 21, 2007 Share Posted July 21, 2007 you may want to view ControlSend is very useful especially foreground Link to comment Share on other sites More sharing options...
gredo Posted July 21, 2007 Author Share Posted July 21, 2007 I keep the help files open forever but I just didn't notice this CTRLDOWN thing. Thank you all for helping! Link to comment Share on other sites More sharing options...
Golbez Posted July 22, 2007 Share Posted July 22, 2007 open scite and press f1 Link to comment Share on other sites More sharing options...
oddacorn Posted August 16, 2010 Share Posted August 16, 2010 Send("{Ctrldown}") Mouseclick("left", x, y) Send("{Ctrlup}") was that it? I recently tried something similar to this to hold down the [Alt] key while clicking on a save button, which in the application in question forces certain additional options to be saved. This method was not working for me until I added "Sleep(100)" after the Mouseclick function (actually, I was using a ControlClick, but it's the same idea). After I figured this out, I realized this was necessary to ensure that the [Alt] key stayed down long enough after the click for the program I was controlling to register it. I thought I might save someone else some time by pointing this out. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now