Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Firefox action by trigerring actions.
#1
hI Gintaras

i still fight with firefox, but the macros get shaping.

1) I wonder if i can access firefox's internal commands by simulating menu actions in directly in a macro,
for instance a right menu item that i can get by doing a right click on a link in a firefox web page ?

open, open in new tab etc...

2)
i have a folder containing all menus, macros, related to firefox stuff.
If i want a shareable variable among all of them, which way is the best? a global one?
How to create it to be that group only accessible (str+ myfirefoxvariable??)
If then isn't it global to all QM macros i have?

3) i want the url of the tab right after the active one.
Any code?
Acc a.Find(w "TEXT" "Se rendre sur un site Web" "class=MozillaWindowClass[]a:placeholder=Se rendre sur un site Web" 0x1005 "previous") is the farest i went to...


Thanks
#2
1. Can't. Maybe with a firefox addition, eg mozrepl, I didn't test.
2. Global variable. It will be accessible in all macros, not only in that folder.
3. Acc.Find delay
#3
Gintaras Wrote:1. Can't. Maybe with a firefox addition, eg mozrepl, I didn't test.

the aim is to lighten firefox, too much extensions for me make it
heavy and buggy.

2. Global variable. It will be accessible in all macros, not only in that folder.

OK, so they live as long as QM is opened? Not too much memory impact?

3. Acc.Find delay[/quote]

Some reading for long winter nights, seeking url bar function
to return it Sad
#4
1. Yes, better with mouse and keyboard.

2. Yes, as long as QM is running, or current QM file is open. Memory usage depends on you. If variable contents is large, clear it when don't need.

3. Why reading? It is a function. Create new function, copy/paste, and use.
#5
1. cant't always do things via keyboard and mouse Big Grin

2. how to free variable memory, like _s.all for any type?

3. give them fish today, and they'll eat that day. Teach them how to fish, and they'll eat all days.
#6
Some types that can allocate much memory have a function like str.all. To free ARRAY, call redim or assign 0.
To easily free a variable of a user defined type (any type) without explicitly freeing each member: assign an empty variable of same type.

TYPE var
...
;free var
TYPE _empty; var=_empty
#7
OK, beginning to explore, but where pa3fi and fi2 arguments come from???

pa=parent, but can't find "fi" in reference
#8
It is a path to other object relative to the initially found object.
You can create the string in "Find accessible object" dialog, Navigate field.
Documentation in QM Help, acc topic.
#9
up, down, left, right Spatial navigation. Most objects don't support it.
next, previous Next or previous sibling.
parent Parent.
first, last First or last child.
child Child x. To specify child object, append 1-based child index.

pa3fi => parentx3, ok
fi2 ???
No reference to "fi", sorry if did not understand well.
#10
pa is for parent, fi is for first. Can be f, but probably I didn't remember the minimum of required characters.
#11
i'm totally lost
if i understand correctly:

macro finds a tab, then returns its order in tab row.

can you explain what is retreived exactly by those:

a.Find(hwndFF "DOCUMENT" "" "" 0x3011 2 0 "pa3fi") <================ what is third parent then first child from document accessible object
Acc aa; a.Navigate("fi2" aa) <======== what is two children away from current tab

I can't use them in custom macro.

here is the image from my firefox.


Attached Files Image(s)
   
#12
Don't remember, but the function works somehow Smile
Probably it finds DOCUMENT, and then gets first tab button or tab bar object. Don't remember, maybe it is faster or more reliable than to find the object directly.
Why do you need that info?

Now I tested it with this code, using latest Firefox, and it displays index of selected tab and name/url of all tabs.
Macro Macro1688
Code:
Copy      Help
ARRAY(str) names urls
int selectedTab=Firefox4GetTabs(0 names urls)
out selectedTab
int i
for i 0 names.len
,out "--------[]%s[]%s" names[i] urls[i]
#13
No problem with the function Gintaras, i works flawlessly
but i need to understand what is under the hood to adapt it to fit my needs.

I want to be able to find any accessible object from the one i choose, and in your function
i don't understand how you found pa3fi and fi2 values to access url bar text from
acc document object.
#14
No, it finds DOCUMENT of current tab (it is fast) and then gets first tab.
#15
Capture an object with "Find accessible object" dialog. Then look in the object tree, and enter path to other object in the Navigate field. Test. If does not work, correct...
#16
The function does not use address bar. Gets URL from DOCUMENT object. Otherwise could not get URLs of invisible tabs.
#17
ok let's ask differently

code: a.Find(hwndFF "DOCUMENT" "" "" 0x3011 2 0 "pa3fi")
means in plain english : find DOCUMENT object of current tab, then navigate
to third parent, then to first child.

code: Acc aa; a.Navigate("fi2" aa)
out aa.Value

from that pa3fi object , get two level child object
and return it's value (url).

Question: looking at the image enclosed in previous post, where are pa3fi and fi2
located (text in image for object)????????
How did you used pa3fi and fi2????
#18
Yes,
code: a.Find(hwndFF "DOCUMENT" "" "" 0x3011 2 0 "pa3fi")

finds PROPERTYPAGE of the first tab. Note that DOCUMENT is of current tab, it is often not of the first tab. We need first tab to start enumerating tabs. Then we enumerate PROPERTYPAGE for each tab. a.Navigate("fi2" gets DOCUMENT of that tab. We need it to get URL.
#19
OK, got it now. Was messing in propertypage, was not looking the good one.

Last question for the moment : is it possible to get a window handle for any tab to close it via clo command?
#20
No, Firefox tabs are not windows and not controls.
#21
Macro Macro1687
Code:
Copy      Help
int w=win(" - Mozilla Firefox" "Mozilla*WindowClass" "" 0x804)
Acc a.Find(w "PAGETAB" "Quick Macros Forum" "class=MozillaWindowClass" 0x1004 0 0 "first")
err ret ;;probably the last tab
a.DoDefaultAction

finds tab button, gets its first child which is X button
#22
OK then,
applying recent knowledge acquisition, i can create a new tab with that code

int w=win("Mozilla Firefox" "Mozilla*WindowClass" "" 0x804); if(!w) ret -1
Acc a.Find(w "MENUITEM" "New tab (after this tab)**" "class=MozillaWindowClass" 0x1005)
a.DoDefaultAction

but i can't close one with that code, similar

int w=win("Mozilla Firefox" "Mozilla*WindowClass" "" 0x804); if(!w) ret -1
Acc a.Find(w "MENUITEM" "close tab**" "class=MozillaWindowClass[]a:id=context_closeTab" 0x1005)
a.DoDefaultAction
why?

NB: ** translated from french to english, your mileage may vary
#23
In my Firefox even does not find MENUITEMs, they don't exist.
#24
snapshot


Attached Files Image(s)
   
#25
Firefox fills a menu only after using the menu first time.
Many applications change a menu just before opening it, not at startup.
DoDefaultAction works not with all object. Depends on the application. QM just tells the application "please do default action, whatever it is", and the applications does what it wants, maybe nothing.
#26
OK, so

1. what is the best way to close a specific tab from QM then (either selected or not tab)?
2. i want to do something with selected tab only.
must I tune the macro Firefox4GetTabs with both
enum routines anyway, or can I use it directly on selected tab?
#27
1. I posted the code.
2. All Acc functions work with the selected tab. For example WebPageProp gets URL, name, text, HTML. Find DOCUMENT object and call the function with the variable.
#28
Ok, i managed to do what iwant by tuning the function.

but where did you post the code for closing a tab?
#29
Several posts before.
Macro1687
#30
refresh problem, missed it.
Thanks G, nice support, as usual.
Thread close.


Forum Jump:


Users browsing this thread: 1 Guest(s)