Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Detect an object's attribute
#1
I'm trying to trigger an event based on the state of a button in a media player. The button normally says "Play", but it says "Pause" after it's pressed while a file is playing. At the end of the file the button reverts to "Play", and that's the event I want to trigger on.

---------------------------------------------------
According to WinDowse:

(in the Children tab):
#005 Class Name=Button Text=Play

(in the Window tab):
Control ID=3FF
---------------------------------------------------

My best guess is something like this:

Code:
Copy      Help
int hwnd=id(1023 w2)
if childtest(hwnd  "Pause" "Button" w2)
,mes("button says Pause")
if childtest(hwnd  "Play" "Button" w2)
,mes("button says Play")
end

But, of course, this doesn't work. I'm a noob--can someone help me with the logic on how to detect the Text attribute for this Button object?
#2
I think I've answered my own question:

Code:
Copy      Help
int hwnd=id(1023 w2)
;wait_while_play
if childtest(hwnd  "Pause" "Button" w2)
,goto wait_while_play
if childtest(hwnd  "Play" "Button" w2)
,mes("button says Play")

Is this the normal way to do something like this? Or is there a better way? I notice the goto loop is consuming a lot of CPU cycles...

I was RTFM Tongue and noticed the topic "Triggers: accessible object". I really don't understand Acc. And the Log Acc. Events function in QM seems too verbose (perhaps the reason for the filter?), making it hard to find items of interest. WinDowse seemed to be a perfect tool for exploring objects.
#3

What media player.
#4
well, it's not the PartyPoker media player :lol: (no offense..)

This is work I'm doing at Dolby Laboratories. The 'media player' is actually a new technology called Dolby Volume (check it out, it's cool!)
#5
scopey Wrote:well, it's not the PartyPoker media player :lol: (no offense..)
You lost me there.


---


And yes I've heard of it, the only reason I asked was so that I could download the program(if I didnt already have it) and see if I could help you figure your problem out.
#6
Accessible object trigger probably could be used. Your code also is OK, but insert some waiting to avoid 100% CPU usage.


Forum Jump:


Users browsing this thread: 1 Guest(s)