Posts: 795
Threads: 136
Joined: Feb 2009
Hi Gintaras, hi all
i ended this small code to act when a certain tab (determined as trigger by titlebar text) is active
Function
Function4
Trigger
!n"text - Mozilla Firefox" "MozillaWindowClass" /FIREFOX
int hwnd=TriggerWindow
_s.getfile("txt")
_i=ListDialog(_s)
str s.getl(_s _i-1)
s.setclip
I'd like to:
1. make it not permanent, as at the time now, it stays when another tab is focused; i'd like it to be tab dependant.
2. i'd like it to disappear automatically after 5 sec if nothing is pressed in it.
I tried some code, but failed everytime.
Help welcome!!!
Thanks
Posts: 12,058
Threads: 140
Joined: Dec 2002
Macro
Macro2442
int hwnd=TriggerWindow
;hwnd=_hwndqm ;;to test without FF
str st1.getwintext(hwnd)
SetTimer(0 1 500 &sub.Timer)
_s="1[]2"
_i=ListDialog(_s "" "QM - FF select" 0 0 0 0 5)
str s.getl(_s _i-1)
s.setclip
#sub Timer v
function hwnd0 uMsg idEvent dwTime
str st2.getwintext(hwnd)
;out st2
if st2!=st1
,clo win("QM - FF select" "#32770" GetCurrentProcessId)
err+ end
Posts: 795
Threads: 136
Joined: Feb 2009
great, thanks.
i'll use the timer idea for later, and tweaked your code to
Function
Function4
Trigger
!n"text - Mozilla Firefox" "MozillaWindowClass" /FIREFOX
int hwnd=TriggerWindow
int w=win("text" "#32770" "qm" 0x200)
if(w) end
_s.getfile("file")
_i=ListDialog(_s "" "text" 0 hwnd 0 0 5)
str s.getl(_s _i-1)
s.setclip
Any flaw to mention?
i'd like to add some stupid behavior, but only if it is easy to implement.
For instance, reset timeout to 0 if i pass the mouse over the ListDialog window.
Possible?
Thanks again for QM and help!!!!
Posts: 12,058
Threads: 140
Joined: Dec 2002
Probably no flaws if works.
Quote:reset timeout to 0 if i pass the mouse
Click dialog to stop.
Or, it is easy implement in the timer function.
Posts: 795
Threads: 136
Joined: Feb 2009
Ok, ill try the timer subroutine.
Is something like checking each 100ms is window under cursor is listdialog window the way to go?
Posts: 12,058
Threads: 140
Joined: Dec 2002
Posts: 795
Threads: 136
Joined: Feb 2009
ok, what the v parameter of the sub timer procedure stands for (or be used for?)
No such thing in the code after declarating it....
Posts: 12,058
Threads: 140
Joined: Dec 2002
Posts: 795
Threads: 136
Joined: Feb 2009
ooops, i'm totally stupid on this one....
I wanted to talk about the
function hwnd0 uMsg idEvent dwTime
parameters of course, sorry for having a brain bug....
Posts: 12,058
Threads: 140
Joined: Dec 2002
It is a timer callback function used with SetTimer, documented in MSDN Library. But in this case the parameters are not useful. The function just must have 4 int param,eters.
Posts: 795
Threads: 136
Joined: Feb 2009
1. ok so only for matching MSDN criterias or are they usable, i.e contain data?
2. I don't see the way to reset the current timer to 0 from its own callback function without restarting the entire function4.....
Posts: 12,058
Threads: 140
Joined: Dec 2002
Cannot reset to 0, but can stop the countdown. Try to post a keyboard or mouse message to the dialog.
Or remove the timeout argument and instead implement the countdown in the timer function.
Posts: 795
Threads: 136
Joined: Feb 2009
Quote:Or remove the timeout argument and instead implement the countdown in the timer function.
Yes, thanks for the tip.