Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SeaMonkey browser
#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


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)