Help Me Brainstorm How to Automate Changing a Project Name in Data Jar, OmniFocus, Timing, and Obsidian

So, I currently have a Shortcut which helps me create a new Project in Data Jar, OF, Timing, and Obsidian. The format typically looks like “TBD - Project Name” because a file number gets created by someone else later on. I then have to go back and manually replace “TBD” with the new file number. What I’d like to do now is automate the replacing of the “TBD” with a file number so that I don’t have to manually edit it in each app.

So, I’m looking for ideas on how to do this. It can be on the Mac or iOS.

I appreciate any ideas you may have.

Here’s a few thoughts.

Data Jar can only be accessed by Shortcuts, so it would seem logical to start with that as the foundation of the automation and see if all the other parts can be easily linked in.

Obsidian would be a file rename. I think that still has to be a copy to new and delete the old, so I would be tempted to run the Shortcut on Mac and use shell script for this for simplicity’s sake.

OmniFocus support in Shortcuts supports OmniAutomation, so I suspect that is going to be the best way to find and rename the appropriate content in OmniFocus.

Timing I’ve never touched, so I’ve no insight on that one.

Thank you for the suggestions. I’m going to try attacking these items one step at a time.

Currently, in Data Jar, I have a Dictionary called Matters. In Matters, each project is a dictionary containing values for Client, File Number, Area of Law, and File Name. The name of each project dictionary is typically “TBD - Project Name”. For the life of me, though, I can’t figure out how to change the name of a project dictionary in Data Jar using Shortcuts.

I can get a list of all keys in the dictionary Matter. I can then select a key (i.e., a project) using Choose from Keys. I can even replace “TBD” with a file number in Shortcuts, but I can’t get that revised name back into Data Jar. Perhaps I’m just going about it the wrong way. Any advice would be welcome.

Okay, let’s do a worked example. Here’s the result of grabbing a slightly simplified version of your dictionary that I set up in Data Jar.

2022-01-19-18.35.44

Here you can hopefully see that matters contains two projects - “Project 1” and “Project 2”. Each with a couple of items of data that are different in each project.

Now let’s say I wanted to rename “Project 1” to “Case A”. We can think of changing the value of the key. Now, as shown in the output above, the JSON that represents the dictionary can be expressed in a plain text format. Therefore we could modify that and write it back to the matters entry in Data Jar.

A bit of regular expression substiution should suffice...

You would add this to a Replace Text action and set it as a regular expression.

But, we can make this a bit easier by looking at this from the other computing perspective. Rather than rename it, we can produce the equivalent by duplicating it to a new name and removing the one with the original name. If we look at it that way, it is actually easy to do, and hopefully understand, with the actions that Data Jar provides.

2022-01-19-18.56.31

Ref: Download this Matters Example Shortcut.


Step 1 - get the value stored in the dictionary Project 1 which is nested in dictionary matters, in Data Jar.

Step 2 - create a new nested dictionary in matters in Data Jar called Case A, which has the content retrieved in the previous step.

Step 3 - delete the Project 1 dictionary nested in matters in Data Jar.


Now if I run the original check again, “Project 1” has gone, but “Case A” exists and has the same content that “Project 1” originally had - in effect, a rename.

2022-01-19-19.07.55

Hopefully, that sets you on the right track.

1 Like

That works perfectly - thank you!

In addition to what @sylumer provided above, I cobbled together some Run in Applescript actions to update Timing and OmniFocus (I think I’ll leave Obsidian alone for now). For anyone curious, the Data Jar actions run first, and I use the information from Data Jar to create a List containing two items: the old project name is item 1 of the List and the new project name is item 2 of the List. Then I run the following Applescripts with the List as the input:

on run {input, parameters}
	tell application "OmniFocus"
		tell front document
			set searchResults to every flattened project where name is (item 1 of input)
			set oldProject to (item 1 of searchResults)
			set name of oldProject to (item 2 of input)
		end tell
	end tell
	return input
end run

and

on run {input, parameters}
	tell application "TimingHelper"
		set oldProject to project (item 1 of input)
		update project oldProject name (item 2 of input)
	end tell
	return input
end run

I don’t know if that’s the best way to do this, but it all seems to work for now and will allow me to update those three apps a little faster. Thanks again @sylumer for your help.