I don't know what is XUL.
(1) my late message was not for you. The addressee was Noaks whose own response was odd !
(2) Firefox is a very good program but its AppleScript support is really short.
(3) I gave you a script which uses GUIscripting and closes the windows minus the HomePage one.
Upon the tabs, the French Firefox Help states:
+Fermeture et restauration des onglets+
+Pour fermer l'onglet courant, appuyez sur Ctrl Cmd+ W, cliquez sur le bouton de fermeture d'onglet , cliquez avec le bouton central de la souris sur l'onglet ou sélectionnez Fichier > Fermer l'onglet. Pour fermer tous les autres onglets sauf l'onglet actif, cliquez sur l'onglet avec le bouton droit de la souris cliquez sur l'onglet en appuyant sur Ctrl et choisissez Fermer les autres onglets.+
I may code that but as there is no way to grab the localized name of the item "starting page" I am forced to build what I hate:
s script dedicated to a single language.
Here it is:
--=====
on run
my activateGUIscripting()
(*
your code
*)
my fermeOnglets()
my shortcut("Firefox", "q", "c") (* Quit the app *)
end run
--=====
on fermeOnglets()
repeat 20 times
set {nbItems, windowName} to my getNomOnglet()
if (nbItems > 3) and windowName is not "Page de démarrage Mozilla Firefox" then
my shortcut("Firefox", "w", "c") (* Close the active tab *)
else
exit repeat
end if
end repeat
end fermeOnglets
--=====
on getNomOnglet()
set theApp to "Firefox"
tell application theApp
activate
tell application "System Events" to tell process theApp to tell menu bar 1
tell menu bar item 9 to tell menu 1
set bb to name of every menu item
end tell -- to menu bar item mt
end tell -- application System Events & process theApp & menu bar 1
end tell -- application theApp
return {count of bb, item -1 of bb}
end getNomOnglet
--=====
on activateGUIscripting()
tell application "System Events"
if not (UI elements enabled) then set (UI elements enabled) to true (* to be sure than GUI scripting will be active *)
end tell
end activateGUIscripting
--=====
on shortcut(a, t, d)
local k
tell application a to activate
tell application "System Events" to tell process a
repeat with k in t
if d = "c" then
keystroke (k as text) using {command down}
else if d contains "c" then
if d contains "s" then
if d contains "k" then
keystroke (k as text) using {command down, shift down, control down}
else
keystroke (k as text) using {command down, shift down}
end if
else if d contains "k" then
keystroke (k as text) using {command down, control down}
end if
end if
end repeat
end tell
end shortcut
--=====
Yvan KOENIG (from FRANCE samedi 20 juin 2009 22:08:44)