• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Detect when I start to work...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Detect when I start to work...


  • Subject: Re: Detect when I start to work...
  • From: 2551phil <email@hidden>
  • Date: Fri, 24 Mar 2017 16:41:49 +0700


On 24 Mar 2017, at 16:34, 2551phil <email@hidden> wrote:

You should be able to do this through ASObjC without needing KM.


Let me try that again….


//register for an observer
NSNotificationCenter* center = [[NSWorkspace sharedWorkspace] notificationCenter];

NSDistributedNotificationCenter* distcenter =[NSDistributedNotificationCenter defaultCenter];

[center addObserver:observer selector:@selector(systemDidWake) name:NSWorkspaceDidWakeNotification object:nil];

[distcenter addObserver:observer selector:@selector(systemDidWake)       name:@"com.apple.screensaver.didstop" object:nil];

[distcenter addObserver:observer selector:@selector(systemDidWake) name:@"com.apple.screenIsUnlocked" object:nil];

//do something on wake
-(void) systemDidWake 
{
NSLog(@“I just woke up!");
}



Best

Phil
@sqwarq



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Detect when I start to work... (From: Jean-Christophe Helary <email@hidden>)
 >Re: Detect when I start to work... (From: Christopher Stone <email@hidden>)
 >Re: Detect when I start to work... (From: Jean-Christophe Helary <email@hidden>)
 >Re: Detect when I start to work... (From: Jim Underwood <email@hidden>)
 >Re: Detect when I start to work... (From: Jean-Christophe Helary <email@hidden>)
 >Re: Detect when I start to work... (From: 2551phil <email@hidden>)

  • Prev by Date: Re: Detect when I start to work...
  • Next by Date: Re: Lists to XML ?
  • Previous by thread: Re: Detect when I start to work...
  • Next by thread: Re: Detect when I start to work...
  • Index(es):
    • Date
    • Thread