                 self.currentScriptName = script.descriptor.name
                 try script.run { [weak self] in
                     self?.currentScriptName = nil
-                
                 }
             }
             

    }
    
    
    /// open script file in an editor
    ///
    /// - Throws: `ScriptFileError`
    private func editScript(at url: URL) throws {

    /// script folder did change
    func presentedSubitemDidChange(at url: URL) {
        
        if NSApp.isActive {
            self.menuBuildingTask.schedule()
            
        } else {
            weak var observer: NSObjectProtocol?
            observer = NotificationCenter.default.addObserver(forName: NSApplication.didBecomeActiveNotification, object: NSApp, queue: .main) { [weak self] _ in
                if let observer = observer {
                   NotificationCenter.default.removeObserver(observer)
                }
                self?.menuBuildingTask.perform()
            }
        }
    }
    
