Hola.
Pretendo conseguir abrir un nuevo archivo de una aplicación ya abierta y que ese archivo se fusione como pestaña si esa aplicación lo permite.
Se consigue la apertura de un nuevo archivo, pero no la fusión como pestaña
Agradecería ayuda sobre en qué parte cometo el error
set laLista to {"Finder", "Google Chrome", "TextEdit", "Script Editor"}
--EXTRAE EL NOMBRE DE LA APLICACIÓN
tell application "System Events"
    set nombreAplic to name of the first process whose frontmost is true
end tell
--ABRE NUEVO DOCUMENTO DE LA LISTA Y LO FUSIONA COMO PESTAÑA SI FUERA POSIBLE
tell application "System Events"
    if laLista does not contain nombreAplic then
        quit
    else if nombreAplic is "Finder" then
        keystroke "t" using command down
        fusion(nombreAplic)
    else if nombreAplic is "Google Chrome" then -- Admite la creación, no la fusión
        keystroke "t" using command down
    else if nombreAplic is "TextEdit" then
        keystroke "n" using command down
        fusion(nombreAplic)
    else if nombreAplic is "Script Editor" then
        keystroke "n" using command down
        fusion(nombreAplic)
    end if
end tell
on fusion(nombreAplic)
    tell application "System Events"
        tell process nombreAplic
            click menu item "Fusionar todas las ventanas" of menu "Ventana" of menu bar 1
        end tell
    end tell
end fusion
