Sign in to follow this  
Followers 0
MatthewT1

Not sure how to send Ctrl+Alt+O

6 posts in this topic

Hello,

I'm trying to write a script to log me out of our phone system when I lock my computer. However my script isn't working, when I run it the Shortell program acts like I haven't pressed alt(It opens options, which has Ctrl+O as its shortcut).

Here's my script:

;Restore window if its minimized
WinSetState("1539 - ShoreTel Call Manager", '', @SW_RESTORE)
;Activate the window
WinActivate("1539 - ShoreTel Call Manager", "")
;Send("^!o") ; Normal send
;Click on the window
ControlClick("1539 - ShoreTel Call Manager", "", "WindowsForms10.Window.8.app.0.33c0d9d1")
;Focus on the window
ControlFocus("1539 - ShoreTel Call Manager", "", "WindowsForms10.Window.8.app.0.33c0d9d1")
;Press and hold Ctrl+Alt+O
ControlSend("1539 - ShoreTel Call Manager", "", "","^!o")

Any and all help is appreciated!

Share this post


Link to post
Share on other sites




If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

It works when I lock the computer, but it doesn't press alt(It just options the Shortell options, which uses the ctrl+o command). I see the options window when I log in, but the script isn't sending the correct keypresses to the application even though "^!o" should send ctrl+alt+o

Share this post


Link to post
Share on other sites

Have you tried using the ControlID, that you use in the ControlFocus command, in the ControlSend command?


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Thank you! I added that, and the script works as it when I run it(or compile it into an executable and run that). However, when I lock the screen it doesn't seem to work even though I've added it into scheduler to run when the screen is locked even though scheduler reports that the operation was successful. Any ideas on what to try next? This is the script thus far:

;Restore window if its minimized
WinSetState("1539 - ShoreTel Call Manager", '', @SW_RESTORE)
;Activate the window
WinActivate("1539 - ShoreTel Call Manager", "")
;Send("^!o") ; Normal send
;Click on the window
ControlClick("1539 - ShoreTel Call Manager", "", "WindowsForms10.Window.8.app.0.33c0d9d1")
;Focus on the window
ControlFocus("1539 - ShoreTel Call Manager", "", "WindowsForms10.Window.8.app.0.33c0d9d1")
ControlSend("1539 - ShoreTel Call Manager", "", "WindowsForms10.Window.8.app.0.33c0d9d1","^!o")
;Press and hold Ctrl+Alt+O

Share this post


Link to post
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
Sign in to follow this  
Followers 0