Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Firefox tab macro
#1
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     Help - how to add the trigger to the macro
Code:
Copy      Help
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
#2
Macro Macro2442
Code:
Copy      Help
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
#3
great, thanks.

i'll use the timer idea for later, and tweaked your code to

Function Function4
Trigger !n"text - Mozilla Firefox" "MozillaWindowClass" /FIREFOX     Help - how to add the trigger to the macro
Code:
Copy      Help
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!!!!
#4
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.
#5
Ok, ill try the timer subroutine.

Is something like checking each 100ms is window under cursor is listdialog window the way to go?
#6
yes
#7
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....
#8
Click #sub, press F1.
#9
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....
#10
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.
#11
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.....
#12
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.
#13
Quote:Or remove the timeout argument and instead implement the countdown in the timer function.

Yes, thanks for the tip.


Forum Jump:


Users browsing this thread: 1 Guest(s)