Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SeaMonkey browser
#1
Hi Gintaras,
Could you make a similar FirefoxGetTabs function for SeaMonkey browser?
It is located at: http://www.seamonkey-project.org/
The current version is 2.32.1
This browser is pretty similar to firefox.
#2
FirefoxGetTabs works with SeaMonkey.

Macro Macro2520
Code:
Copy      Help
out
int w=win(" - SeaMonkey" "MozillaWindowClass")
ARRAY(str) an au
FirefoxGetTabs w an au
out "-----------"
out an
out au

Does not get URL if the page contains an alert bar. Replace
Function FirefoxGetTabs
Code:
Copy      Help
,Acc aa; a.Navigate("fi2" aa); err goto next2
to
Function FirefoxGetTabs
Code:
Copy      Help
,Acc aa.Find(a.a "DOCUMENT" "" "" 0x1010); err goto next2
#3
I have this macro to get all tabs then close them except the current one.
And I have 4 opened tabs on my SeaMonkey browser, but it just show the first 2 tabs only, you know what's wrong?

Macro Close SeaMonkey Tabs
Code:
Copy      Help
ARRAY(str) names urls
int selectedTab=SeaMonkeyGetTabs(0 names urls)
int w=win("SeaMonkey" "MozillaWindowClass" "" 0x804)
out "names.len = %d" names.len
for int'i 0 names.len
,out "names[%d] = %s" i names[i]
,if(i=selectedTab) continue
,Acc a.Find(w "PAGETAB" names[i] "class=MozillaWindowClass" 0x1004 0 0 "first")
,err ret ;;probably 0x800401FD, Object is not connected to server.
,a.DoDefaultAction

Function SeaMonkeyGetTabs
Code:
Copy      Help
;/
function# hwndFF ARRAY(str)&names [ARRAY(str)&urls]

names=0
if(&urls) urls=0

if(!hwndFF) hwndFF=win("SeaMonkey" "MozillaWindowClass" "" 0x804); if(!hwndFF) ret -1

int i r=-1
FFNode fn
ARRAY(str) ap

;enum tabs
Acc a.Find(hwndFF "PAGETAB" "" "class=MozillaWindowClass" 0x1004)
rep
,if(a.Role!ROLE_SYSTEM_PAGETAB) goto next ;;[ + ] button
,
,names[]=a.Name
,
,;get selected tab
,if(r<0 and a.State&STATE_SYSTEM_SELECTED) r=i
,
,if &urls
,,;get id of associated pane and store in ap. Because the order of tabs and panes may be different.
,,fn.FromAcc(a)
,,ap[]=fn.Attribute("linkedpanel")
,
,;next
,a.Navigate("n"); err break
,i+1

if(!&urls) ret r

;enum panes
urls.create(names.len)
a.Find(hwndFF "DOCUMENT" "" "" 0x3011 2 0 "pa3fi")
rep
,;get id of this pane, and find in ap
,fn.FromAcc(a); _s=fn.Attribute("id")
,for(i 0 ap.len) if(ap[i]=_s) break
,if(i=urls.len) goto next2 ;;should never happen
,;get url and store in urls[i]
,;Acc aa; a.Navigate("fi2" aa)
,Acc aa.Find(a.a "DOCUMENT" "" "" 0x1010); err goto next2
,urls[i]=aa.Value
,
,;next2
,a.Navigate("n"); err break

ret r

err+ ret -1
#4
Here gets all tabs.

Macro Macro2520-
Code:
Copy      Help
out
int w=win(" - SeaMonkey" "MozillaWindowClass")
ARRAY(str) an au
out SeaMonkeyGetTabs(w an au)
out "-----------"
out an
out au

names.len is 2? Maybe error somewhere in SeaMonkeyGetTabs. To debug, disable
err+ ret -1
#5
After some modification I've got it to show all tabs
Macro Close SeaMonkey All Tabs
Code:
Copy      Help
ARRAY(str) names urls
int selectedTab=SeaMonkeyGetTabs(0 names urls)
int w=win(" - SeaMonkey" "MozillaWindowClass" "" 0x100)
for int'i 0 names.len
,out "names[%d] = %s" i names[i]
,if(i=selectedTab) continue
,;Acc a.Find(w "PAGETAB" names[i] "class=MozillaWindowClass" 0x1004 0 0 "first")
,Acc a.Find(w "PAGETAB" names[i] "class=MozillaWindowClass" 0x1005 0 0 "next")
,err ret ;;probably 0x800401FD, Object is not connected to server.
,a.DoDefaultAction
But the problem is a.DoDefaultAction does not close its tab. You know how to make it work?
#6
Quote:Acc a.Find(w "PAGETAB" names[i] "class=MozillaWindowClass" 0x1005 0 0 "next")
Why DoDefaultAction should close a tab? I tested with SeaMonkey 2.32.1, this gets either next PAGETAB or a PUSHBUTTON.

Why don't use right-click and "Close Other Tabs"?
#7
The reason is because in Firefox when I use a.DoDefaultAction it will close the tab, so I thought it might be the same in SeaMonkey browser. But it turns out not exactly like that. Anyway the right click to close other tabs will do the trick. Thanks bro.


Forum Jump:


Users browsing this thread: 1 Guest(s)