dejhost Posted May 19, 2020 Share Posted May 19, 2020 I want to run an application in Windows 10 by using it's shortcut key. More precisely: In the Properties of a shortcut ("Anaconda Prompt (anaconda3).lnk"), I inserted "CTRL + ALT + P" as Shortcut key. Now, I would like to run this shortcut by my autoit script. #RequireAdmin Send("{{LCTRL down}") Send("{{ALT down}") Send("{{P}") Send("{{LCTRL up}") Send("{{ALT up}") This key combination works fine using the according keys on my keyboard, but nothing happens when I run my script. Could somebody please tell me the correct way to do this? Additional Info: Name of : Anaconda Prompt (anaconda3) Shortcut Location: C:\Users\username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Anaconda3 (64-bit) Target: %windir%\System32\cmd.exe "/K" C:\Users\username\anaconda3\Scripts\activate.bat C:\Users\username\anaconda3 Start in: %HOMEPATH% It's supposed to run as administrator. Link to comment Share on other sites More sharing options...
seadoggie01 Posted May 19, 2020 Share Posted May 19, 2020 (edited) You've doubled up all the leading opening brackets braces. Also, if you know where the shortcut is, why don't you just ShellExecute it? Edited May 19, 2020 by seadoggie01 TheXman 1 All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types Link to comment Share on other sites More sharing options...
dejhost Posted May 19, 2020 Author Share Posted May 19, 2020 1 hour ago, seadoggie01 said: You've doubled up all the leading opening brackets braces. Also, if you know where the shortcut is, why don't you just ShellExecute it? This is embarissing... thanks for the hint. Will test tomorrow. seadoggie01 1 Link to comment Share on other sites More sharing options...
dejhost Posted May 20, 2020 Author Share Posted May 20, 2020 (edited) Removing one of the opening braces does the trick: the application opens. But it also leads to the next problem: the Alt- and/or the the LCTRL-key get stuck. I can monitor this using the windows On Screen Keyboard. Following this link CTRL key get stuck after using Send I tried ControlSend("", "", "", "text", 0) without any luck. I manage to unstuck one of the two keys within the script, but only manual pressing the second locked key on the keyboard resolves the problem. Using Shellexecute was my first attempt. But the application calls the C:\Windows\System32\cmd.exe with a set of parameters (see my original post: "Additional Info"). These would have to be set as the Parameters of the ShellExecute command. But I do not manage to get the syntax right. This is why I went for the "CTRL + ALT +P" in the first place. Once I have successfully opened the shell, I use ControlSend to send commands. Edited May 20, 2020 by dejhost grammar correction 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