Jump to content

Another WinMenuSelectItem issue.


Recommended Posts

Hey all,

1st of all i running Vista x64

secondly:

From the helpfile:

; This will select File, Page Setup in notepad
WinMenuSelectItem("[CLASS:Notepad] ", "", "&File", "Page Set&up..." )

This does not work...

either way i got my function to work but it has strange conditions and i need a solution for them.

For SketchUp 6 Pro my code is this:

$i = WinMenuSelectItem("Untitled - SketchUp Pro", "", "&File", "&Export", "3D Model...")
Exit($i)


Scenario #1.

I open SketchUp, i run the script nothing will happen..

Scenario #2.

I open SketchUp, i unfold the menu and select, File > Export and close the menu again..

From this point on my script will always work


It is as if the menu's items either change name after i open the menu or they simply do not exist till i open them menu?

Same thing with Notepad too and the Autoit example.

Is there anyway to fix this?

Link to comment
Share on other sites

typical, to find the answer right after i made a topic ;)

They do indeed change, this fixed it though

#include <GuiMenu.au3>
$hWnd = WinGetHandle("Untitled - SketchUp Pro")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)
$hExport = _GUICtrlMenu_GetItemID($hFile, 10)

$file = _GUICtrlMenu_GetItemText($hMain, 0)
$export = _GUICtrlMenu_GetItemText($hFile, 10)
$Model = _GUICtrlMenu_GetItemText($hExport, 0)
WinMenuSelectItem($hWnd, "", $file, $export, $Model)

Writing it to console showed it changed.

WinMenuSelectItem("Untitled - SketchUp Pro", "", "&File", "&Export", "&3D Model...")
WinMenuSelectItem("Untitled - SketchUp Pro", "", "&File", "&Export", "3D Model...")
Edited by Djarlo
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...