Siri shortcuts do not disturb bug? - sirishortcuts

I have been trying to write a shortcut to work as a pomodoro timer. Basically, I would like it to set a timer for 25 minutes, then put my phone on DND for 25 minutes. I have been trying to do this second part with a DND “until” and a magic variable holding a date +25 minutes, but the DND is never turning off.
I have tried turning off my DND schedule on my phone, but that has not helped. I’ve attached the (simple) shortcut below.
https://www.icloud.com/shortcuts/856239d511ca4e5fb0d204fbf6bcd78f

Related

Using Applescript or Automator to edit a calendar to move "bump" all events forward one day

I want to be able to move all events within my mac calendar up one day, ideally with the ability to exclude weekends.
Use Case: A training program had 10 weeks of daily sessions. The calendar is uploaded via csv edited for start days and skipped days. If one were to miss a day they were able to simple push all the events forward one day.
I have looked at Automator and there doesn't appear to be a simple way to set this up with the exception of possibly a folder action option.
Anyone ever do something like this?
I'd be careful about AppleScripting Calendar.app in Catalina onwards, as it's now extremely buggy and very easy to incur data loss when something goes wrong.
However, a non-scripting solution would be to cut and paste the events whilst viewing them in Month view:
Select all the events that you wish to bring forward, which is best done starting with the last, so you end up at the first;
If you deselect all other calendars so that the only events visible are the ones in your training programme (I presume these are stored in their own calendar, right...?!), then you can ⌘A to Select All, being careful to deselect the ones that overlap from the previous month or into the next month. Individual events are selected/deselected by holding down ⌘ and clicking the event.
Hit ⌘X to Cut them to the clipboard;
Use the mouse to single-click the day previous to one that contained the first event;
Hit ⌘V to Paste the events, the first of which will be pasted into the day that you clicked in step ⓷, with the remaining events repositioned by the same relative amount as was the first.

System notification window stuck causes the program to get stuck[Cocoa][Mac OSX]?

I am trying to show a notification window in a Mac application.Something that would come up in the trial version of the application.The window would be unmovable for 30 seconds(and it would have a counter counting down to 0).After 30 seconds it would continue execution.
Here is the code.
_systemNotificationWindow = [[SystemNotificationWindow alloc]initWithWindowNibName:#"SystemNotificationWindow"];
NSLog(#"1111");
[self.systemNotificationWindow setActionDelegate:self];
[self.systemNotificationWindow startTimer:30];
NSLog(#"2222");
[self.systemNotificationWindow showWindow:self];
NSLog(#"3333");
NSLog(#"4444");
The code is stuck at this line
[self.systemNotificationWindow showWindow:self];
It shows the window but neither the timer is working nor the window is going away after 30 seconds.Alsoo 3333 and 4444 are not being printed.
It sounds like you're missing an event loop to control the timer, so I'm guessing that you're displaying the window before an event loop has been created.
You can read more about events here and run loops here.

Is there a notification for when the calendar changes via System Preferences?

My app draws a calendar. I have an ivar, _cal, set to -[NSCalendar autoupdatingCurrentCalendar] because I'd like to redraw the calendar if the user makes a change in System Preferences. For example, they could change the first day of week from Sunday to something else.
Currently, I'm using an NSTimer that fires every second. I check [_cal firstWeekday] against a cached copy to see if it has changed. If so, I redraw.
I'm wondering if instead there is a way for me to be notified if the System Preferences affecting the calendar have changed. Then, I could get rid of my NSTimer.
It looks like you can observer NSCurrentLocaleDidChangeNotification.
See https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSLocale_Class/Reference/Reference.html#//apple_ref/doc/uid/TP30001224-DontLinkElementID_1

Get notification on Ctrl+Alt+Del

I know there is no way to block or ignore ctrl+Alt+Del within a program. But thats not what I want. Is there a way to only be notified if it WAS pressed? No interaction required, only notification.
Thank you!
I'm not sure why you'd want to do this, and I have a suspicion there's probably a better and cleaner way to accomplish your ultimate goal, but...
Off the top of my head, I would run a timer in the background of your application, and each time the timer fires, check to see if the Ctrl , Alt , and Delete keys were pressed. To do that, you'll have to use GetAsyncKeyState from user32.dll. I'd give you a code sample, but I'm not sure what language you're using. Play around with the interval for the timer to see what it needs to be to balance performance, yet still work.
Doesn't seem that there is an easy way to get a SAS notification, all articles I've found dealt with replacing GINA.
You might want to take a look at these:
Customizing GINA, Part 1
Customizing GINA, Part 2
C++ Q&A Typename, Disabling Keys in Windows XP with TrapKeys
If you only want to find out whether the user has locked his workstation, you should take a look at WTSRegisterSessionNotification in conjunction with WM_WTSESSION_CHANGE.

MFC Dynamic Text Control?

What MFC control should I use and how should I use it to display constantly changing text (like progress text) on a dialog?
For example, should I use the static text control? But can you change it programmatically?
Yes, you can change the contents of a static control programmatically. Change the ID to something other than IDC_STATIC, then you can assign a member variable to it. You can set the text with your_var.SetWindowText().
Edit: how many changes are you making, and how fast? I did a quick test program with a timer (set to a duration of 0) that formats and writes a new string to the control when the time fires, so it's updating constantly. Here's what it looks like after running for a while:
And here's what Task Manager shows:
The spike a the right is (at least mostly) from taking the screen shot of the test program saving it, and so on. As soon as I quit doing things like that, CPU usage went back to do noise level (with the occasional blip). I left the program running -- a half hour or so later, it's still doing fine, with no noticeable CPU usage (in fast according to Task Manager, it hasn't used even one second of CPU time yet).

Resources