Thursday, July 9, 2020

#1 2020-05-19 08:43:41 am

Chrismacteam
Member
From:: France
Registered: 2010-09-27
Posts: 80

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

Applescript:

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


Infographiste Freelance Packaging

Offline

 

#2 2020-05-19 06:02:15 pm

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 6397

Re: Close Open Window via Code

Chrismacteam wrote:

Applescript:

on openMasqueWindowFromLDI:()



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


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/
latenightsw.com

Offline

 

#3 2020-05-20 12:07:55 am

Chrismacteam
Member
From:: France
Registered: 2010-09-27
Posts: 80

Re: Close Open Window via Code

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

Applescript:

current application's CPo_ToolBoxAppDelegate's openMasqueWindowFromLDI()

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


Infographiste Freelance Packaging

Offline

 

#4 2020-05-20 12:39:03 am

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 6397

Re: Close Open Window via Code

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

Applescript:

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


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/
latenightsw.com

Offline

 

#5 2020-05-20 01:03:27 am

Chrismacteam
Member
From:: France
Registered: 2010-09-27
Posts: 80

Re: Close Open Window via Code

Thanks Shane.
Works fine !! Problem resolve


Infographiste Freelance Packaging

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)