Sign in to follow this  
Followers 0
KingE

Xp task bar app and menu selection

18 posts in this topic

Hi,

I am trying to write a script to select a minimised application from the windows task bar.

I want to right click on its icon and select one of the items from its menu.

Cant seem to get this right.

What should be the correct set of functions I should be looking at?

ie. I am trying to select a icon in this window:

Press CTRL-ALT-F to pause the display.

>>>>>>>>>>>> Window Details <<<<<<<<<<<<<

Title:

Class: Shell_TrayWnd

Size: X: -2 Y: 738 W: 1028 H: 32

>>>>>>>>>>> Mouse Details <<<<<<<<<<<

Screen: X: 691 Y: 759

Cursor ID: 2

>>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<

RGB: Hex: 0xABA99D Dec: 11250077

>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<

Size: X: 679 Y: 3 W: 270 H: 18

Control ID:

ClassNameNN: ToolbarWindow321

Text: Notification Area

>>>>>>>>>>> Status Bar Text <<<<<<<<<<<

>>>>>>>>>>> Visible Window Text <<<<<<<<<<<

Start

07:43 AM

Notification Area

Running Applications

-----

Anyone done this before?

Share this post


Link to post
Share on other sites



Does one of these commands achieve what you want? --

  • WinSetState("Title of Window", "", @SW_RESTORE)
  • WinSetState("Title of Window", "", @SW_MINIMIZE)
  • WinSetState("Title of Window", "", @SW_MAXIMIZE)
  • WinClose("Title of Window")

Share this post


Link to post
Share on other sites

Hi,

I am trying to write a script to select a minimised application from the windows task bar.

I want to right click on its icon and select one of the items from its menu.

Cant seem to get this right.

What should be the correct set of functions I should be looking at?

ie. I am trying to select a icon in this window:

-----

Anyone done this before?

<{POST_SNAPBACK}>

Take a look at Systray_UDF. You can use it to find and click icons.

Share this post


Link to post
Share on other sites

Not really, I am trying to right mouse click on an icon in the windows taskbar. The application is already in a minised state. I just dont know how to select th app in the task bar, and then do a right mouse click?

Does one of these commands achieve what you want? --

  • WinSetState("Title of Window", "", @SW_RESTORE)

  • WinSetState("Title of Window", "", @SW_MINIMIZE)

  • WinSetState("Title of Window", "", @SW_MAXIMIZE)

  • WinClose("Title of Window")

<{POST_SNAPBACK}>

Share this post


Link to post
Share on other sites

Could you please share more detail about what you want to achieve? What do you want to do after you select this minimised application from the taskbar?

Share this post


Link to post
Share on other sites

Could you please share more detail about what you want to achieve? What do you want to do after you select this minimised application from the taskbar?

<{POST_SNAPBACK}>

Hi Alex

I am trying to do the following in a script.

1.) I want to right click an icon in the taskbar.

2.) This will bring up a popup menu.

3.) then I want to select on of the items in the menu.

Have attached an image.

Share this post


Link to post
Share on other sites

Hi Alex

I am trying to do the following in a script.

1.) I want to right click an icon in the taskbar.

2.) This will bring up a popup menu.

3.) then I want to select on of the items in the menu.

Have attached an image.

<{POST_SNAPBACK}>

As said before, take a look at SysTray_UDF. It can do exactly what you want. Link is in my first reply.

Share this post


Link to post
Share on other sites

As said before, take a look at SysTray_UDF. It can do exactly what you want. Link is in my first reply.

<{POST_SNAPBACK}>

Had a look at your link, and tried out one of the examples:

_SysTrayIconVisible()

When I try and run the autoit script, I get an unknown function error.

I dont find this function in the autoit help. Is this an internal autoit function?

Share this post


Link to post
Share on other sites

I believe that the SysTray set of functions requires a beta version of AutoIt, which you can find here.

Share this post


Link to post
Share on other sites

Had a look at your link, and tried out one of the examples:

_SysTrayIconVisible()

When I try and run the autoit script, I get an unknown function error.

I dont find this function in the autoit help. Is this an internal autoit function?

<{POST_SNAPBACK}>

OK. My fault I forgot the include file. Now I am getting a different error.

$TBBUTTON = DllStructCreate($str)

Unknown Function

Share this post


Link to post
Share on other sites

OK. My fault I forgot the include file. Now I am getting a different error.

$TBBUTTON  = DllStructCreate($str)

Unknown Function

<{POST_SNAPBACK}>

You still need the beta. Go get it from HERE

Share this post


Link to post
Share on other sites

You still need the beta. Go get it from HERE

<{POST_SNAPBACK}>

OK I downloaded the Beta and installed. Seems a bit better.

Have tried example 3 with _SysTrayIconVisible() and example 2 with _SysTrayIconRemove(). And nothing happens.

Tried example 5 , "Left-click App's icon on system tray", except I changed the left to a right click. Still doesnt work properly, and this is what looks like happens:

1.) Mouse pointer moves to system tray above icon.

2.) System tray now opens leftwards to reveal hidden icons.

3.) Opened System tray moves the position of the icons to the left.

4.) mouse pointer is now above incorrect icon.

5.) no menu is opened on mouse click.

Share this post


Link to post
Share on other sites

OK I downloaded the Beta and installed. Seems a bit better.

Have tried example 3 with _SysTrayIconVisible() and example 2 with _SysTrayIconRemove(). And nothing happens.

Tried example 5 , "Left-click App's icon on system tray", except I changed the left to a right click. Still doesnt work properly, and this is what looks like happens:

1.) Mouse pointer moves to system tray above icon.

2.) System tray now opens leftwards to reveal hidden icons.

3.) Opened System tray moves the position of the icons to the left.

4.) mouse pointer is now above incorrect icon.

5.) no menu is opened on mouse click.

<{POST_SNAPBACK}>

Put some sleeptime after step 2. What program are you trying to click?

Share this post


Link to post
Share on other sites

Put some sleeptime after step 2.  What program are you trying to click?

<{POST_SNAPBACK}>

Ok, I just checked it with the latest beta and SysTrayIconTitles() seems to be broken!! When I get home I'll check what's wrong, maybe something has changed in the latest beta.. :whistle:

Share this post


Link to post
Share on other sites

Ok, it seems that new hWnd handling functions broke this --> hWnd(), isHwnd().

I hope I managed to correct the problem, please download new SysTray_UDF version and let me know how it goes.

Share this post


Link to post
Share on other sites

What specifically is broke? Do you have a simple example of what you think has been broken?

Share this post


Link to post
Share on other sites

Not anymore. I just had to change Dec() to hwnd(), that's all. On previous versions I did compare hwnd's with Dec()

Share this post


Link to post
Share on other sites

Not anymore. I just had to change Dec() to hwnd(), that's all. On previous versions I did compare hwnd's with Dec()

<{POST_SNAPBACK}>

Here's the "final" analysis.

Your code broke because I intentionally broke it, sort of. The change I made to HWND's when converted to strings was to add a leading "0x" to denote hex notation (For internal purposes). Your code broke because Dec() does not handle strings with a leading "0x" as being valid hex strings. This is a bug or lack of feature, either way I hope to see it fixed in the future so that hex strings with or without the leading "0x" are properly converted by 0x. So in short, the fact that your script broke was not really a bug relating to the HWND change because that was meant to happen. It's rather a by-product of Dec() not accepting all valid forms of hex notation.

Now, in the process of discovering the above, I found a bug in my HWND code where an HWND could not be concatenated as a string. I've submitted a patch for that (as well as an idea for a fix to Dec). So somehow I managed to find a fix an unrelated bug out of all this which is why I kept pestering you to give me an example so I could satisfy myself that my code wasn't bugged, which it was.

Anyway, in the future your old code will probably work again, though it's superfluous now that we have the HWND cast which is the proper way to do things.

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