Sunday, February 23, 2020

#1 2020-02-10 04:52:46 pm

robleach72
Member
Registered: 2013-01-01
Posts: 31

Reminder location/geofence getting messed up - is this script doing it

I have a script I use to automatically "un-complete" a set of reminders in a list in the reminders app.  Unfortunately, the geofence is getting screwed up.  I want the geofence to remain unmolested so that the next time I cross the geofence boundary, the reminder goes off again.  The reminder is getting marked as incomplete, but when I go to look why I didn't get the expected reminder when I arrive at work, I notice that the geofence is set to my "work" location, but on the map, the pin is off the coast of Africa.

Here's the relevant portion of the script:

Applescript:


   tell application "Reminders"
       try
           repeat with theRem in (reminders in list myList whose completed is true)
               tell theRem
                   delete remind me date
                   set completed to false
               end tell
           end repeat
       on error errmsg
           display dialog errmsg buttons {"Cancel", "Continue"} default button 2 giving up after 5
       end try
   end tell

I have the "delete remind me date" in there because any past remind me dates are no longer relevant.  Would taking that out fix the issue?  I can't very easily test if it would without taking a long walk.

Offline

 

#2 2020-02-10 05:45:29 pm

maro
Member
From:: Nerima, Tokyo, Japan
Registered: 2004-05-30
Posts: 61
Website

Re: Reminder location/geofence getting messed up - is this script doing it

I wrote this Reminder with geofence script five years ago.

http://piyocast.com/as/archives/3253

Last edited by maro (2020-02-10 05:46:28 pm)


I wrote thousands of AppleScript to realize my idea. Natural language interface, voice recognition commander and so on. Though my mother toungue is strange language, Japanese, my most frequently write language is AppleScript. I believe it is for making things easy and powerful.


Filed under: reminder, geofence

Offline

 

#3 2020-02-11 02:36:38 pm

robleach72
Member
Registered: 2013-01-01
Posts: 31

Re: Reminder location/geofence getting messed up - is this script doing it

OK.  I see you have a script that sets a geofence trigger using static hardcoded long. & lat. coordinates.  That may be useful to try and reverse engineer what's going on here.  Hopefully I can retrieve the geofence settings from the reminder before the script corrupts them, so that I can reset them after marking them as incomplete, but I'm still not sure why the geofence settings are getting corrupted in the first place.  Any idea why that would be?

Offline

 

#4 2020-02-11 03:08:10 pm

robleach72
Member
Registered: 2013-01-01
Posts: 31

Re: Reminder location/geofence getting messed up - is this script doing it

I wrapped the "delete remind me date" in a conditional for "if remind me date is not missing value".  I'll see if that works.

Although, I could not (for whatever reason) precisely reproduce the issue through testing (i.e. create a test reminder with a geofence, complete it, run the script, & check the geofence settings).  In my testing, I had the following outcomes on repeated attempts:

1. Geofence was completely deleted (once)
2. Geofence was not deleted (every other time)

Perhaps there's a difference when the geofence trigger has been tripped.  It's difficult to test that in a timely fashion.  And I can't explain why the geofence was deleted the first time and not any other time... roll

Offline

 

#5 2020-02-11 03:50:57 pm

robleach72
Member
Registered: 2013-01-01
Posts: 31

Re: Reminder location/geofence getting messed up - is this script doing it

Ho boy.  OK.  I tested on the computer that usually runs the script and I reproduced the issue exactly.  I think that the easiest solution would be to upgrade the OS on that computer.  I'm guessing that the reason I couldn't reproduce the issue on this computer is because it's running Mojave and the one that causes the issue is running Sierra.

Offline

 

#6 2020-02-14 02:41:51 pm

robleach72
Member
Registered: 2013-01-01
Posts: 31

Re: Reminder location/geofence getting messed up - is this script doing it

OMG.  So I upgraded the computer yesterday to Mojave.  The script still manages to screw up the geofence settings.  I don't know what the missing component is here...  First of all, the script takes a long time to run.  It takes like a minute or so.  Second, it seems to strip out the geofence entirely in Reminders on the computer, but my phone still shows a geofence reminder is set (for when I arrive at work), but when you go to look at the work address, the map is centered on a point off the coast of Africa roughly on the equator.  Maybe that's 0,0 lon,lat coordinates?

I was resetting the address on my phone and the issue would recur.  I tried once however setting the geofence in the reminders app on the computer in question and re-ran the script and that time, it didn't get messed up.  So... perhaps this is a 1-time issue with old left-over reminders?  I have yet to try this on a new reminder.

However, it would be nice to have a foolproof solution.  How do I grab the geofence settings from an existing reminder so I can restore them after making a change that wipes them out?

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)