Kaine Posted April 18, 2006 Share Posted April 18, 2006 I have been trying to create scripts accessing various menus/functions in Microsoft OneNote 2003. Shortcuts with only one special key (e.g. ALT+O, SHIFT+F) work flawlessly with Send(). But I have difficulty using Send() shortcuts with two special keys such as CTRL+SHIFT+G: ;Run OneNote 2003 Run ("C:\Program Files\Microsoft Office\OFFICE11\ONENOTE.EXE") ;Wait for OneNote to become active Opt("WinTitleMatchMode", 2) WinWaitActive("OneNote 2003") ;Navigate the list of folders in "My Notebook" folder ;by using the keyboard shortcut CTRL+SHIFT+G - "Open a menu of folders and sections in your notebook." send("^+g") ;send("^+G") ;send("{CTRLDOWN}{SHIFTDOWN}{g down}") ;send("{SHIFTUP}{CTRLUP}{g up}") As you can see, I have tried different keyboard combinations without success. Is it because I have not gained the control of the right window frame or because I have used the wrong parameters for Send()? Thanks very mcuh for the help!! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 18, 2006 Moderators Share Posted April 18, 2006 I have been trying to create scripts accessing various menus/functions in Microsoft OneNote 2003. Shortcuts with only one special key (e.g. ALT+O, SHIFT+F) work flawlessly with Send(). But I have difficulty using Send() shortcuts with two special keys such as CTRL+SHIFT+G: ;Run OneNote 2003 Run ("C:\Program Files\Microsoft Office\OFFICE11\ONENOTE.EXE") ;Wait for OneNote to become active Opt("WinTitleMatchMode", 2) WinWaitActive("OneNote 2003") ;Navigate the list of folders in "My Notebook" folder ;by using the keyboard shortcut CTRL+SHIFT+G - "Open a menu of folders and sections in your notebook." send("^+g") ;send("^+G") ;send("{CTRLDOWN}{SHIFTDOWN}{g down}") ;send("{SHIFTUP}{CTRLUP}{g up}") As you can see, I have tried different keyboard combinations without success. Is it because I have not gained the control of the right window frame or because I have used the wrong parameters for Send()? Thanks very mcuh for the help!!If your doing it to a specific window, I suggest ControlSend()ControlSend('Window Name', 'Control ID text If known', 'Control ID If necessary', '^+g')See if that works. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Kaine Posted April 18, 2006 Author Share Posted April 18, 2006 If your doing it to a specific window, I suggest ControlSend()ControlSend('Window Name', 'Control ID text If known', 'Control ID If necessary', '^+g')See if that works.Thanks for the reply. I just discovered that by adding Sleep(300) before Send("^+g"), I made it work. I guess sometimes the script is faster than the response time of the program it intends to control. BTW, I have been experiencing problems using any function involving Control ID because I don't know how to get that information. The following is a snapshot from AutoIt v3 Active Window Info: >>>>>>>>>>>> Window Details <<<<<<<<<<<<< Title: Untitled page - Microsoft Office OneNote 2003 Class: Framework::CFrame Size: X: 0 Y: 0 W: 824 H: 734 >>>>>>>>>>> Mouse Details <<<<<<<<<<< Screen: X: 118 Y: 264 Cursor ID: 5 >>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<< RGB: Hex: 0xFFFFFF Dec: 16777215 >>>>>>>>>>> Control Under Mouse <<<<<<<<<<< Size: X: 4 Y: 193 W: 781 H: 503 Control ID: ClassNameNN: OneNote::CJotSurfaceWnd1 Text: >>>>>>>>>>> Status Bar Text <<<<<<<<<<< >>>>>>>>>>> Visible Window Text <<<<<<<<<<< MsoDockTop Formatting 16 Verdana Standard Menu Bar Type a question for help Type text to find >>>>>>>>>>> Hidden Window Text <<<<<<<<<<< MsoDockLeft MsoDockRight MsoDockBottom I tried AutoItSetOption("WinTitleMatchMode", 4) ControlSend("classname=OneNote::CJotSurfaceWnd1", "", "", "^+g") but it did not work. Any suggestion on how to obtain Control ID for the window. Thanks very much. 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