Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Firefox code for Chrome/IE
Hi Gintaras,

before I start an endless failure code, is it possible from your opinion to adapt FirefoxGetTabs and siblings routines to Chrome and/or IE?
Hmm, was quite sure.

As I only keep firefox for those tabs handling features in QM, it's frustrating..

Any hint to mimic those in Chrome or circumvent the limitations?
In Chrome only can get tab button texts. Cannot get page URL and Acc.
In IE maybe can get URL and Acc, but in random order, and cannot reliably know which tab button is for which page. Quite difficult. Probably need different code for different IE versions.
I've got an idea coming, but just an idea.

What do you advice for handling a string pair, to retreive one from the other.

Memory is not the problem, only speed must be considered...

I want to store Tab name - URL pair, and be able to retreive tab name from URL or URl from a string....


"Quick Macros Forum • Post a reply" ""
"Google" ""

Efficiency = speed.

Macro Macro2508
Copy      Help
str csv=
;"Quick Macros Forum • Post a reply", ""
;"Google", ""

ICsv x._create
int i=x.Find("" 0 1)
if(i>=0) out x.Cell(i 0)
OK, numerous ways to do that, wanted the faster.

The idea is to capture tab switch, and store name/url association of active tab, and then do actions depending on tab.

I've got some code quite working, but i see ACC trigger but can't make it work.

Have you got some framework code using that particular trigger with Chrome tabs Acc component?
Try trigger "Window name changed", class Chrome_WidgetWin_1.
yes that is what my current code uses, but i'd like to use ACC trigger, maybe much accurate
Macro Macro2510
Trigger $a 130 0 "" "Chrome_RenderWidgetHostHWND" "" "" "Chrome_WidgetWin_1"     Help - how to add the trigger to the macro
Copy      Help
function hwnd idObject idChild

;Runs on SHOW event of tab child window.

Acc a.FromEvent(hwnd idObject idChild)
out a.Name
;get URL
Acc aDoc.Find(a.a "DOCUMENT" "" "" 0x3000)
out aDoc.Value
yep, almost there...

Need to act on an already opened tab name change (i.e click a bookmark from it)
Can use NAMECHANGE event, but it is the same as "Window -> Name changed" trigger.
Damned, worked for a while and now doesn't anymore, grrrr
OK, the last version did work for some minutes, and then errored each time at document retreiving step. The name output was always chrome's one, not the tab text...

reverted to name change on window trigger, and works each time, but damned slow...

Hint to speed it up?
Check "reverse".

Macro Macro2514
Trigger !n"" "Chrome_WidgetWin_1" "" "Chrome_RenderWidgetHostHWND" /CHROME     Help - how to add the trigger to the macro
Copy      Help
int hwnd=TriggerWindow
out _s.getwintext(hwnd)
Acc a.Find(hwnd "TEXT" "Address and search bar" "class=Chrome_WidgetWin_1[]state=0x100000 0x20000040" 0x1085)
out a.Value
not sure it speeds the stuff, but i'll set it.

For Macro2510, here is the output

Chrome Legacy Window
Error (RT) in <open ":2852: /144">Function5: object not found.

For the CSV, i'd like to have global variable, initialized when Chrome is launched, and destroyed (epmtied) when chrome is closed

I created Function 1 -> Triggered by Chrome launch
In it, i put

ICsv+ x
ICsv x._create

Function 2 ->Triggered by Chrome destroyed
In it I put

ICsv+ x

Is it correct?
ICsv is not thread-safe. Use lock when accessing the variable.

ICsv+ g_csv18547

ICsv+ g_csv18547
Also try this.

Macro Macro2513
Copy      Help

int w=win("" "Chrome_WidgetWin_1")
Acc aPTL.Find(w "PAGETABLIST" "" "" 0x1084)
int i nTabs=aPTL.ChildCount-1
spe 10
act w
rep nTabs
,Acc aAB.Find(w "DOCUMENT" "" "" 0x3000 3)
,str name url
,out F"name='{name}'[] url='{url}'"
,key CT ;;next tab
1. use lock even when creating or putting it to 0 or when using it in code??

i.e function3

ICsv+ x
lock x

sample code
using x

lock- x


Acc a.FromMouse
out _s

always returns CLIENT whatever the mouse is pointing at.
Works normally in Firefox, and accessible windows action window finds anything in the page (text, link, picture etc etc).
Some tweaks involved?

Not so easy to move from firefox to chrome in this purpose :/
Macro2513 was my very first attempt, but inconvinient and slow..

The change name trigger is far more efficient IMHO
1. Use lock when it is possible that 2 or more threads can use the variable simultaneously. If unsure, lock everywhere.

2. Chrome starts with disabled accessible objects. Acc.Find auto-enables, as well as the Acc capture dialog. But Acc.FromMouse doesn't, it would be too slow. To start Chrome with enabled accessible objects, use command line --force-renderer-accessibility.
1. ok, but is the syntax code provided

2. yes, forgot that trick, used in the past...much better now...

more questions coming Wink
Quote:not sure it speeds the stuff, but i'll set it.
Quote:Error (RT) in <open ":2852: /144">Function5: object not found.

Macro Macro2514
Trigger !n"" "Chrome_WidgetWin_1" "" "Chrome_RenderWidgetHostHWND" /CHROME     Help - how to add the trigger to the macro
Copy      Help
int hwnd=TriggerWindow
Acc a.Find(hwnd "DOCUMENT" "" "" 0x3000 1)
out a.Name
out a.Value

Quote:1. ok, but is the syntax code provided
The code is correct. lock- usually is optional.
new macro 2514 is faster, but don't trigger on name change..will try to mix...

Function SourisMilieuChrome
Trigger F8 /CHROME     Help - how to add the trigger to the macro
Copy      Help
Acc k
POINT+ _m; xm _m
Acc aa.ObjectFromPoint(_m.x _m.y 2 &k)
out _s

works from hotkey (F8)

But i want to use it from a mouse middle click in chrome window.
In this case, alaways returns CLIENT, whatever the Role is...
The same with accessible trigger.

Macro Macro2517
Trigger $a 140 0 "" "Chrome_WidgetWin_1"     Help - how to add the trigger to the macro
Copy      Help
function hwnd idObject idChild
Acc aw.FromEvent(hwnd idObject idChild)
;out aw.Name
Acc a.Find(hwnd "DOCUMENT" "" "" 0x3000 1)
out a.Name
out a.Value

Does not trigger when two tabs have same name. Or when URL changes but name doesn't.
Works here.

Macro Macro2518
Trigger #M 0x8     Help - how to add the trigger to the macro
Copy      Help
Acc a.FromMouse
out _s

In some windows does not work in a filter function.
found the problem : function handling middle click must be called
to work..

mac "middleclick"

instead of directly


.... why???
Then with wait also should work, if not in a filter-function.

wait 1
Acc a.FromMouse
out _s
the generic middle click action function is anyway...

but works like that..

it's becoming possible to migrate my functions to chrome, even is a little tricky \o/

Another one : is there a way to monitor when page is fully loaded in chrome (my guess : no)..

Forum Jump:

Users browsing this thread: 1 Guest(s)