How can I detect an inactive (grey-ed out) menu?
Moderators: Dorian (MJT support), JRL
-
- Newbie
- Posts: 14
- Joined: Sun Feb 26, 2006 3:55 pm
- Location: Florida
- Contact:
How can I detect an inactive (grey-ed out) menu?
I have been using a particular menu in the application I am writing a macro for. I just discovered that in some instances the menu item is inactive. I need to do something to cover that situation. Is there a way to detect if the menu item is inactive (grey-ed out). I am the using keyboard to access the menu item. It is the first menu item in the list. I would prefer not to use a timeout since it slows down the entire process.
press alt
send>v
release alt
press enter
Thanks,
press alt
send>v
release alt
press enter
Thanks,
___________________________________
Writing the program is easy
finishing the program is hard
Writing the program is easy
finishing the program is hard
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Hi,
One way is to send the alt-v and then set a timeout and wait to see if the desired outcome arises. If not, you know it was greyed out. e.g. if alt-v normally causes a new window to appear you can see if it appears after sending the alt-v. If it doesn't appear within a certain time you know it must have been greyed out because alt-v has had no effect.
One way is to send the alt-v and then set a timeout and wait to see if the desired outcome arises. If not, you know it was greyed out. e.g. if alt-v normally causes a new window to appear you can see if it appears after sending the alt-v. If it doesn't appear within a certain time you know it must have been greyed out because alt-v has had no effect.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Newbie
- Posts: 14
- Joined: Sun Feb 26, 2006 3:55 pm
- Location: Florida
- Contact:
It will depend on how fast your window will usually open (I've had the same problem in the past).
Let's say your ALT+V window pops up very quickly - you would only need a timeout of one second to spot whether nothing happened; if the button was not greyed out the window will pop up and the script continues. If it was, one second is not too much to wait.
If you are _really_ fast you could have a wwx>0.5, but that might be cutting it fine
Take care, Ian
Let's say your ALT+V window pops up very quickly - you would only need a timeout of one second to spot whether nothing happened; if the button was not greyed out the window will pop up and the script continues. If it was, one second is not too much to wait.
If you are _really_ fast you could have a wwx>0.5, but that might be cutting it fine
Take care, Ian
-
- Newbie
- Posts: 14
- Joined: Sun Feb 26, 2006 3:55 pm
- Location: Florida
- Contact:
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Hi,
What type of object is this menu item? It may not even be a standard menu class - most menus these days are custom toolbar objects made to look like menus. Therefore there is not necessarily one single standard API.
Can you use Tools/View System Windows to identify the menu object and tell us what the class name is?
What type of object is this menu item? It may not even be a standard menu class - most menus these days are custom toolbar objects made to look like menus. Therefore there is not necessarily one single standard API.
Can you use Tools/View System Windows to identify the menu object and tell us what the class name is?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Newbie
- Posts: 14
- Joined: Sun Feb 26, 2006 3:55 pm
- Location: Florida
- Contact:
-
- Newbie
- Posts: 14
- Joined: Sun Feb 26, 2006 3:55 pm
- Location: Florida
- Contact:
Good Idea! However it will not work with this macro. Different people will either have it or not. You can not compare with the menu to without the menu unless you have both images. The users all have different resolutions so I can not include examples of the images from my machine because their machine can display the screens and mages differently.
There is no way for me to tell in advance if they will have a greyed-out menu.
I appreciate your input. It is a good idea and I might be able to use it on other macros.
Thanks
There is no way for me to tell in advance if they will have a greyed-out menu.
I appreciate your input. It is a good idea and I might be able to use it on other macros.
Thanks
___________________________________
Writing the program is easy
finishing the program is hard
Writing the program is easy
finishing the program is hard
the fact that some users will have it and some won't (grey menu) is the reason for using this technique. All you would need to do is capture an example from one system and use that as the baseline. As for resolution, there aren't an unlimited number of settings and it's easy to detect that with MacroScheduler....save a few images, have the script check the resolution (do a mouse move to 4000,4000...then get the mouse coordinates, there's your resolution), then check against the corresponding image.
I still think it could be possible.....
I still think it could be possible.....
-
- Newbie
- Posts: 14
- Joined: Sun Feb 26, 2006 3:55 pm
- Location: Florida
- Contact:
I will take another look at it. The image would have to be a real narrow window. The main window where the menu drops down to will have different text in it each time the application is used. I would have to be real careful not to capture any of the window where the menu drops into. Don't know if I can do that with a bunch of different resolutions. And yes there could be a good number of them. On my laptop I have six different resolution options.
Some of these new graphic cards most likely have more.
Some of these new graphic cards most likely have more.
___________________________________
Writing the program is easy
finishing the program is hard
Writing the program is easy
finishing the program is hard