Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Firefox code for Chrome/IE
#1
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?
Reply
#2
No.
Reply
#3
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?
Reply
#4
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.
Reply
#5
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....

EX

"Quick Macros Forum • Post a reply" "http://www.quickmacros.com/forum/posting.php?mode=reply&f=1&t=6254"
"Google" "www.google.fr"

Efficiency = speed.

Thanks
Reply
#6
Macro Macro2508
Code:
Select All      Help
str csv=
;"Quick Macros Forum • Post a reply", "http://www.quickmacros.com/forum/posting.php?mode=reply&f=1&t=6254"
;"Google", "www.google.fr"

ICsv x._create
x.FromString(csv)
int i=x.Find("www.google.fr" 0 1)
if(i>=0) out x.Cell(i 0)
Reply
#7
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?
Reply
#8
Try trigger "Window name changed", class Chrome_WidgetWin_1.
Reply
#9
yes that is what my current code uses, but i'd like to use ACC trigger, maybe much accurate
Reply
#10
Macro Macro2510
Trigger $a 130 0 "" "Chrome_RenderWidgetHostHWND" "" "" "Chrome_WidgetWin_1"     Help - how to add the trigger to the macro
Code:
Select All      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
Reply
#11
yep, almost there...

Need to act on an already opened tab name change (i.e click a bookmark from it)
Possible?
Reply
#12
Can use NAMECHANGE event, but it is the same as "Window -> Name changed" trigger.
Reply
#13
Damned, worked for a while and now doesn't anymore, grrrr
Reply
#14
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?
Reply
#15
Check "reverse".

Macro Macro2514
Trigger !n"" "Chrome_WidgetWin_1" "" "Chrome_RenderWidgetHostHWND" /CHROME     Help - how to add the trigger to the macro
Code:
Select All      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
Reply
#16
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
x.Clear

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

Func1:
ICsv+ g_csv18547
g_csv18547._create

Func2:
ICsv+ g_csv18547
g_csv18547=0
Reply
#18
Also try this.

Macro Macro2513
Code:
Select All      Help
out

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
,name=aAB.Name
,url=aAB.Value
,out F"name='{name}'[] url='{url}'"
,
,key CT ;;next tab
Reply
#19
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
here

lock- x

2.

Acc a.FromMouse
a.Role(_s)
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 :/
Reply
#20
Macro2513 was my very first attempt, but inconvinient and slow..

The change name trigger is far more efficient IMHO
Reply
#21
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.
Reply
#22
1. ok, but is the syntax code provided

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

more questions coming Wink
Reply
#23
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
Code:
Select All      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.
Reply
#24
new macro 2514 is faster, but don't trigger on name change..will try to mix...
Reply
#25
Damned..

Function SourisMilieuChrome
Trigger F8 /CHROME     Help - how to add the trigger to the macro
Code:
Select All      Help
Acc k
POINT+ _m; xm _m
Acc aa.ObjectFromPoint(_m.x _m.y 2 &k)
k.Role(_s)
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...
Reply
#26
The same with accessible trigger.

Macro Macro2517
Trigger $a 140 0 "" "Chrome_WidgetWin_1"     Help - how to add the trigger to the macro
Code:
Select All      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.
Reply
#27
Works here.

Macro Macro2518
Trigger #M 0x8     Help - how to add the trigger to the macro
Code:
Select All      Help
Acc a.FromMouse
a.Role(_s)
out _s

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


mac "middleclick"

instead of directly

middleclick

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

wait 1
Acc a.FromMouse
a.Role(_s)
out _s
Reply
#30
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)..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)