Solving file conflict

I have been using and modifying the nvremind script from Brent and I have been having problems with my files. Since they are being modified by the script, even when I am working on such files, there is a conflict in the files being modified.

Is keeping the files in sync a future feature or is there another way to accomplish what I am trying to do in an easier way?

Are you using TaskPaper 3 Preview?

If so can you describe the exact sequence that causes a problem? In my testing if the file open in TaskPaper has been saved, then when you edit the file in another application TaskPaper will just reload that edit. I used vi on the command line to do this test. I’m on OS X 10.11.

I am using Brett Terpstra’s nvremind script to automate my files. I modified so that it looks for certain tags, and then it creates reminders or events on that accordingly. The script is located here nvremind. I am using 10.11 and TaskPaper 3 preview #166. I open the file, create a couple of tags, save, and then run the script. Task paper never reloads those edits. Maybe it is because of how his script modifies the file? I am not sure. I can create a dropbox link to my script if you really want to. It works differently to Brett’s. Mine creates future events and reminders instead of reminding me after the date of the tag is older than the current one.

Any updates? Will this happen if I use javascript in the Script Editor instead? I cannot test that because I don’t know how to accomplish this with javascript :slight_smile:

Hi, yes can you please send me that script?

This problem wouldn’t happen if you were using the AppleScript/JavaScript API… and the docs for that are ariving pretty soon (trying to get that ready is why I’ve been so quiet here of late). But… I think it should refresh also if you just edit the file in the background as you are doing. At least it seems to when I do it. Anyway, please post that script! :smile:

Here is the file

Thanks, just tried and I see the same behavior that you do.

I’m not sure what the proper solution is. I guess some write paths don’t generate the file changed notification that’s used by NSDocument to see changes. It does work when editing the file with unix tools such as vi, so I thought it worked in all cases.

I think you can solve the problem by touch ing the file after you’ve made your changes. I’m not sure how you do that in Ruby (I think maybe FileUtils.touch), but what I mean is to issue the terminal touch command on the file that you just edited. That does seem to notify the NSDocument file changed detection system.

Solved it. I just modified the code that Brett had there. Thank you. It is now working as expected.

touch -m -t '#{mod_time.strftime('%Y%m%d%H%M')}' "#{file}"

changed to

touch -m "#{file}"

1 Like