Close Open Window via Code

Hi !
here is my problem. i have multiple window. i can open and close them when i use a button (sender) but when i just call the routine “on openMasqueWindowFromLDI” from an other script ; it doesn’t work
i think, i don’t need to pass parameter
Have you an idea ?
Thanks. Chris

in main script

on openMasqueWindowFromLDI:()
		my closeActiveWindow()
		my openNewWindow(windowToOpen)
	end openPreferenceWindow:
	
    
    -- Routine -----------------------------
    
    on closeActiveWindow()
        activate me -- activate my app
        activeWindow's orderOut:me -- close normally the active window
    end closeActiveWindow
    
    on openNewWindow(newWindow)
          newWindow's orderFront:me
        set activeWindow to newWindow
        activeWindow's makeKeyAndOrderFront:me
        activeWindow's |center|()
    end openNewWindow

Don’t use a colon if you’re not passing a parameter.

HI Shane
It doesn’t work. May be it is the cal from this other script which is wrong

current application's CPo_ToolBoxAppDelegate's openMasqueWindowFromLDI()

the error i receive : +[CPo_ToolBoxAppDelegate openMasqueWindowFromLDI]: “” doesn’t understand the “orderOut_” message. (error -1708)
Regards. Chris

You’re trying to call a class method, when you need an instance method. Try this:

current application's NSApp's delegate()'s openMasqueWindowFromLDI()

Thanks Shane.
Works fine !! Problem resolve