ngskicker Posted April 15, 2013 Posted April 15, 2013 (edited) Well, basically what I want is when I click on a window, I want to make it as if to bring up the context menu, which I still do not know how to do is how to make my script directly bring up the context menu when executed, i will explain what i mean.this window when clicked will open some program based on my setting,note, this picture only sample, the actual window does not created using autoit,when i click this window i want to run program that replicate context menu, and i don't want to always run autoit script to monitor my window. Edited April 15, 2013 by ngskicker
FireFox Posted April 15, 2013 Posted April 15, 2013 Hi, Take a look at the _GUICtrlMenu_TrackPopupMenu function. Br, FireFox.
ngskicker Posted April 15, 2013 Author Posted April 15, 2013 But how to get "Handle to the window that owns the shortcut menu" as i don't own the window, I think I'll explain it more clearly, first post updated
water Posted April 15, 2013 Posted April 15, 2013 Use function WinList to get the handle of the window. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
ngskicker Posted April 15, 2013 Author Posted April 15, 2013 in the autoit help it says, "Handle to the window that owns the shortcut menu" i think ordinary window handle will not work.
Solution funkey Posted April 16, 2013 Solution Posted April 16, 2013 You can use the AutoIt window #include <GuiMenu.au3> Global Enum $idOpen = 1000, $idSave, $idInfo Global $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_InsertMenuItem($hMenu, 0, "Open", $idOpen) _GUICtrlMenu_InsertMenuItem($hMenu, 1, "Save", $idSave) _GUICtrlMenu_InsertMenuItem($hMenu, 3, "", 0) _GUICtrlMenu_InsertMenuItem($hMenu, 3, "Info", $idInfo) _GUICtrlMenu_TrackPopupMenu($hMenu, WinGetHandle(AutoItWinGetTitle())) _GUICtrlMenu_DestroyMenu($hMenu) Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning.
ngskicker Posted April 16, 2013 Author Posted April 16, 2013 You can use the AutoIt window #include <GuiMenu.au3> Global Enum $idOpen = 1000, $idSave, $idInfo Global $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_InsertMenuItem($hMenu, 0, "Open", $idOpen) _GUICtrlMenu_InsertMenuItem($hMenu, 1, "Save", $idSave) _GUICtrlMenu_InsertMenuItem($hMenu, 3, "", 0) _GUICtrlMenu_InsertMenuItem($hMenu, 3, "Info", $idInfo) _GUICtrlMenu_TrackPopupMenu($hMenu, WinGetHandle(AutoItWinGetTitle())) _GUICtrlMenu_DestroyMenu($hMenu) Perfectly what i want, thanks funkey, SOLVED
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