Firefox code for Chrome/IE

Creating macros. Working with QM.

Firefox code for Chrome/IE

Postby ldarrambide on Tue Mar 03, 2015 10:05 am

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?
ldarrambide
Active Member
 
Posts: 770
Joined: Wed Feb 25, 2009 1:10 am

Re: Firefox code for Chrome/IE

Postby Gintaras on Tue Mar 03, 2015 10:13 am

No.
Gintaras
Site Admin
 
Posts: 10385
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania

Re: Firefox code for Chrome/IE

Postby ldarrambide on Tue Mar 03, 2015 10:15 am

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?
ldarrambide
Active Member
 
Posts: 770
Joined: Wed Feb 25, 2009 1:10 am

Re: Firefox code for Chrome/IE

Postby Gintaras on Tue Mar 03, 2015 12:24 pm

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.
Gintaras
Site Admin
 
Posts: 10385
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania

Re: Firefox code for Chrome/IE

Postby ldarrambide on Tue Mar 03, 2015 12:30 pm

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
ldarrambide
Active Member
 
Posts: 770
Joined: Wed Feb 25, 2009 1:10 am

Re: Firefox code for Chrome/IE

Postby Gintaras on Tue Mar 03, 2015 12:39 pm

Macro Macro2508     ?
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)

Gintaras
Site Admin
 
Posts: 10385
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania

Re: Firefox code for Chrome/IE

Postby ldarrambide on Tue Mar 03, 2015 12:42 pm

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?
ldarrambide
Active Member
 
Posts: 770
Joined: Wed Feb 25, 2009 1:10 am

Re: Firefox code for Chrome/IE

Postby Gintaras on Tue Mar 03, 2015 12:47 pm

Try trigger "Window name changed", class Chrome_WidgetWin_1.
Gintaras
Site Admin
 
Posts: 10385
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania

Re: Firefox code for Chrome/IE

Postby ldarrambide on Tue Mar 03, 2015 12:51 pm

yes that is what my current code uses, but i'd like to use ACC trigger, maybe much accurate
ldarrambide
Active Member
 
Posts: 770
Joined: Wed Feb 25, 2009 1:10 am

Re: Firefox code for Chrome/IE

Postby Gintaras on Tue Mar 03, 2015 1:07 pm

Macro Macro2510     ?
Trigger $a 130 0 "" "Chrome_RenderWidgetHostHWND" "" "" "Chrome_WidgetWin_1"     ?
;\
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

Gintaras
Site Admin
 
Posts: 10385
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania

Re: Firefox code for Chrome/IE

Postby ldarrambide on Tue Mar 03, 2015 1:12 pm

yep, almost there...

Need to act on an already opened tab name change (i.e click a bookmark from it)
Possible?
ldarrambide
Active Member
 
Posts: 770
Joined: Wed Feb 25, 2009 1:10 am

Re: Firefox code for Chrome/IE

Postby Gintaras on Tue Mar 03, 2015 1:23 pm

Can use NAMECHANGE event, but it is the same as "Window -> Name changed" trigger.
Gintaras
Site Admin
 
Posts: 10385
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania

Re: Firefox code for Chrome/IE

Postby ldarrambide on Tue Mar 03, 2015 1:30 pm

Damned, worked for a while and now doesn't anymore, grrrr
ldarrambide
Active Member
 
Posts: 770
Joined: Wed Feb 25, 2009 1:10 am

Re: Firefox code for Chrome/IE

Postby ldarrambide on Tue Mar 03, 2015 1:41 pm

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?
ldarrambide
Active Member
 
Posts: 770
Joined: Wed Feb 25, 2009 1:10 am

Re: Firefox code for Chrome/IE

Postby Gintaras on Tue Mar 03, 2015 1:48 pm

Check "reverse".

Macro Macro2514     ?
Trigger !n"" "Chrome_WidgetWin_1" "" "Chrome_RenderWidgetHostHWND" /CHROME     ?
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

Gintaras
Site Admin
 
Posts: 10385
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania

Re: Firefox code for Chrome/IE

Postby ldarrambide on Tue Mar 03, 2015 2:00 pm

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?
ldarrambide
Active Member
 
Posts: 770
Joined: Wed Feb 25, 2009 1:10 am

Re: Firefox code for Chrome/IE

Postby Gintaras on Tue Mar 03, 2015 2:10 pm

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
Gintaras
Site Admin
 
Posts: 10385
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania

Re: Firefox code for Chrome/IE

Postby Gintaras on Tue Mar 03, 2015 2:12 pm

Also try this.

Macro Macro2513     ?
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

Gintaras
Site Admin
 
Posts: 10385
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania

Re: Firefox code for Chrome/IE

Postby ldarrambide on Tue Mar 03, 2015 2:16 pm

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 :/
ldarrambide
Active Member
 
Posts: 770
Joined: Wed Feb 25, 2009 1:10 am

Re: Firefox code for Chrome/IE

Postby ldarrambide on Tue Mar 03, 2015 2:19 pm

Macro2513 was my very first attempt, but inconvinient and slow..

The change name trigger is far more efficient IMHO
ldarrambide
Active Member
 
Posts: 770
Joined: Wed Feb 25, 2009 1:10 am

Re: Firefox code for Chrome/IE

Postby Gintaras on Tue Mar 03, 2015 2:26 pm

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.
Gintaras
Site Admin
 
Posts: 10385
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania

Re: Firefox code for Chrome/IE

Postby ldarrambide on Tue Mar 03, 2015 2:30 pm

1. ok, but is the syntax code provided

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

more questions coming ;)
ldarrambide
Active Member
 
Posts: 770
Joined: Wed Feb 25, 2009 1:10 am

Re: Firefox code for Chrome/IE

Postby Gintaras on Tue Mar 03, 2015 2:35 pm

not sure it speeds the stuff, but i'll set it.

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


Macro Macro2514     ?
Trigger !n"" "Chrome_WidgetWin_1" "" "Chrome_RenderWidgetHostHWND" /CHROME     ?
int hwnd=TriggerWindow
Acc a.Find(hwnd "DOCUMENT" "" "" 0x3000 1)
out a.Name
out a.Value



1. ok, but is the syntax code provided

The code is correct. lock- usually is optional.
Gintaras
Site Admin
 
Posts: 10385
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania

Re: Firefox code for Chrome/IE

Postby ldarrambide on Tue Mar 03, 2015 2:40 pm

new macro 2514 is faster, but don't trigger on name change..will try to mix...
ldarrambide
Active Member
 
Posts: 770
Joined: Wed Feb 25, 2009 1:10 am

Re: Firefox code for Chrome/IE

Postby ldarrambide on Tue Mar 03, 2015 2:52 pm

Damned..

Function SourisMilieuChrome     ?
Trigger F8 /CHROME     ?
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...
ldarrambide
Active Member
 
Posts: 770
Joined: Wed Feb 25, 2009 1:10 am

Re: Firefox code for Chrome/IE

Postby Gintaras on Tue Mar 03, 2015 2:53 pm

The same with accessible trigger.

Macro Macro2517     ?
Trigger $a 140 0 "" "Chrome_WidgetWin_1"     ?
;\
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.
Gintaras
Site Admin
 
Posts: 10385
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania

Re: Firefox code for Chrome/IE

Postby Gintaras on Tue Mar 03, 2015 2:57 pm

Works here.

Macro Macro2518     ?
Trigger #M 0x8     ?
Acc a.FromMouse
a.Role(_s)
out _s



In some windows does not work in a filter function.
Gintaras
Site Admin
 
Posts: 10385
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania

Re: Firefox code for Chrome/IE

Postby ldarrambide on Tue Mar 03, 2015 3:03 pm

found the problem : function handling middle click must be called
to work..


mac "middleclick"

instead of directly

middleclick

.... why???
ldarrambide
Active Member
 
Posts: 770
Joined: Wed Feb 25, 2009 1:10 am

Re: Firefox code for Chrome/IE

Postby Gintaras on Tue Mar 03, 2015 3:10 pm

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

wait 1
Acc a.FromMouse
a.Role(_s)
out _s
Gintaras
Site Admin
 
Posts: 10385
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania

Re: Firefox code for Chrome/IE

Postby ldarrambide on Tue Mar 03, 2015 3:12 pm

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)..
ldarrambide
Active Member
 
Posts: 770
Joined: Wed Feb 25, 2009 1:10 am

Next

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron