Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

[MBS] NSNotificationObserverMBS and NSWorkspaceMBS.NSWorkspaceWillPowerOffNotification (MBS Xojo Plugin Mailinglist archive)

Back to the thread list
Next thread: [MBS] Omegabundle for Xojo 2014 ends 31st January 2015


Re: [MBS] AuthorizationMBS   -   Garth Hjelte
  [MBS] NSNotificationObserverMBS and NSWorkspaceMBS.NSWorkspaceWillPowerOffNotification   -   Marnaud
   Re: [MBS] NSNotificationObserverMBS and NSWorkspaceMBS.NSWorkspaceWillPowerOffNotification   -   Marnaud
   Re: [MBS] NSNotificationObserverMBS and NSWorkspaceMBS.NSWorkspaceWillPowerOffNotification   -   Christian Schmitz
   Re: [MBS] NSNotificationObserverMBS and NSWorkspaceMBS.NSWorkspaceWillPowerOffNotification   -   Marnaud
   Re: [MBS] NSNotificationObserverMBS and NSWorkspaceMBS.NSWorkspaceWillPowerOffNotification   -   Marnaud
   Re: [MBS] NSNotificationObserverMBS and NSWorkspaceMBS.NSWorkspaceWillPowerOffNotification   -   Christian Schmitz
   Re: [MBS] NSNotificationObserverMBS and NSWorkspaceMBS.NSWorkspaceWillPowerOffNotification   -   scott
   Re: [MBS] NSNotificationObserverMBS and NSWorkspaceMBS.NSWorkspaceWillPowerOffNotification   -   Marnaud

[MBS] NSNotificationObserverMBS and NSWorkspaceMBS.NSWorkspaceWillPowerOffNotification
Date: 31.01.15 15:00 (Sat, 31 Jan 2015 15:00:56 +0100)
From: Marnaud
Greetings,

I need to know when the computer is going to shut down. I tried the NSNotificationObserverMBS class, like in the example (with the center class also), and I have this in the GotNotification event:
if notification.name=NSWorkspaceMBS.NSWorkspaceWillPowerOffNotification then
app.IsGoingToShutDown=True
NSLogMBS "Detected that the computer will shut down!"
Else
NSLogMBS notification.name
end if
(I do NSLog with the other notifications for debugging purposes; debugging at shut down isn't convenient!)

However, I'm getting a lot of notifications, but not the NSWorkspaceWillPowerOffNotification one. I need it in order for my app to stop launching other applications (which then prevent the shut down).
If the notification was “misspelled”, I'd still get it with the “NSLogMBS notification.name” line, but it looks like it's never even received, regardless of its name.

Should I do something special to get that notification?
(Mac OS 10.7 or 10.8, tested under 10.7 currently).
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
<email address removed>
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Re: [MBS] NSNotificationObserverMBS and NSWorkspaceMBS.NSWorkspaceWillPowerOffNotification
Date: 05.02.15 23:30 (Thu, 05 Feb 2015 23:30:03 +0100)
From: Marnaud
Le 5 févr. 2015 à 23:26, Christian Schmitz <<email address removed>> a écrit:

> It seems to be the only way Apple documented, but it's not working.

Well, I must handle things differently when the computer will shut down/restart vs when it's “idle”, else it breaks the shut down process (a rather annoying issue, right?). What would you do in my case? I can't just think it's not possible and let my app defeat the shut down process.
Is there something (an environment variable? a gestalt?) that changes when the computer shuts down (rather than an event)?

>> Did you miss my reply also?
>
> Sorry.

No problem; I just wonder what's happening.
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
<email address removed>
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Re: [MBS] NSNotificationObserverMBS and NSWorkspaceMBS.NSWorkspaceWillPowerOffNotification
Date: 05.02.15 23:26 (Thu, 5 Feb 2015 23:26:29 +0100)
From: Christian Schmitz

>>> Anyway, I don't get that notification in my tests, too.
>>
>> Thanks for testing. So what is the proper way to detect a shut down?
>> Currently, my application breaks the shut down process and the only way to prevent that is to know that the system is shutting down/logging out.

It seems to be the only way Apple documented, but it's not working.

> Did you miss my reply also?

Sorry.

Sincerely
Christian

Re: [MBS] NSNotificationObserverMBS and NSWorkspaceMBS.NSWorkspaceWillPowerOffNotification
Date: 05.02.15 23:10 (Thu, 05 Feb 2015 23:10:57 +0100)
From: Marnaud
Le 1 févr. 2015 à 11:38, Marnaud <<email address removed>> a écrit:

> Le 1 févr. 2015 à 11:26, Christian Schmitz <<email address removed>> a écrit:
>
>> Sorry. Missed it.
>
> Ok, no problem.
>
>> Anyway, I don't get that notification in my tests, too.
>
> Thanks for testing. So what is the proper way to detect a shut down?
> Currently, my application breaks the shut down process and the only way to prevent that is to know that the system is shutting down/logging out.

Hello Christian,

Did you miss my reply also?
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
<email address removed>
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Re: [MBS] NSNotificationObserverMBS and NSWorkspaceMBS.NSWorkspaceWillPowerOffNotification
Date: 01.02.15 11:38 (Sun, 01 Feb 2015 11:38:25 +0100)
From: Marnaud
Le 1 févr. 2015 à 11:26, Christian Schmitz <<email address removed>> a écrit:

> Sorry. Missed it.

Ok, no problem.

> Anyway, I don't get that notification in my tests, too.

Thanks for testing. So what is the proper way to detect a shut down?
Currently, my application breaks the shut down process and the only way to prevent that is to know that the system is shutting down/logging out.
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
<email address removed>
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Re: [MBS] NSNotificationObserverMBS and NSWorkspaceMBS.NSWorkspaceWillPowerOffNotification
Date: 01.02.15 11:26 (Sun, 1 Feb 2015 11:26:30 +0100)
From: Christian Schmitz

> I saw you were responding to other threads; is it safe to assume you don't know the answer for mine?
> (if so, why did you not tell me?)

Sorry. Missed it.

Anyway, I don't get that notification in my tests, too.


Sincerely
Christian

Re: [MBS] NSNotificationObserverMBS and NSWorkspaceMBS.NSWorkspaceWillPowerOffNotification
Date: 01.02.15 10:34 (Sun, 1 Feb 2015 04:34:44 -0500)
From: scott
Marnaud,

What is your question?  I never saw it.

sb

From: Marnaud <<email address removed>>
Reply: MBS Real Studio Plugin List <<email address removed>>>
Date: February 1, 2015 at 4:12:40 AM
To: MBS Real Studio Plugin List <<email address removed>>>
Subject:  Re: [MBS] NSNotificationObserverMBS and NSWorkspaceMBS.NSWorkspaceWillPowerOffNotification

Le 31 janv. 2015 à 15:00, Marnaud <<email address removed>> a écrit:

> Should I do something special to get that notification?

Hello Christian,

I saw you were responding to other threads; is it safe to assume you don't know the answer for mine?
(if so, why did you not tell me?)

Regards
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
<email address removed>
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info
-- 
scott
Sent with Airmail
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
<email address removed>
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Re: [MBS] NSNotificationObserverMBS and NSWorkspaceMBS.NSWorkspaceWillPowerOffNotification
Date: 01.02.15 10:12 (Sun, 01 Feb 2015 10:12:26 +0100)
From: Marnaud
Le 31 janv. 2015 à 15:00, Marnaud <<email address removed>> a écrit:

> Should I do something special to get that notification?

Hello Christian,

I saw you were responding to other threads; is it safe to assume you don't know the answer for mine?
(if so, why did you not tell me?)

Regards
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
<email address removed>
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info