Help With Creating Shortcut to do an Emotional Diary

Thanks it’s working now. The whole process takes 5 secs now. Gotta love Siri Shortcuts :blush:

1 Like

No problem. I usually like to have actions like that as separate shortcuts and prefix them with “Func” and give them all a grey color with the same icon. So, instead of adding the url + the open url command, I just use a Run Shortcut action and point it at my “Func GoToHomeScreen” shortcut and Show While Running turned off. I’ve found that shortcuts run smooth like that and I don’t like all the jumping around, so it saves me from having to look at that.

Granted, in the scenario you’re only saving 1 step by extracting it out, but other, longer shortcuts that can be re-used it comes it real handy.

Cheers.

1 Like

Thanks for your input. I rely on this shortcut a lot during the day - 6 times - and to have it run automatically like this is just such a joy and pleasure to see. It makes so much more fun to do :blush:

I’m still trying to perfect this workflow and the Due/Siri Shortcuts side is working flawlessly and perfectly. Thanks a lot to everyone who contributed.

However, once I put the listed emotions in Drafts into Day One at the end of the day, it becomes a little less streamlined.

I use a Drafts action to put everything into Day One which works well. But then I’m just left with a list in an otherwise blank Day One entry.

Then I use a TextExpander snippet to unfold the times during the day at which I entered the emotions using Shortcuts. But as you can see from the image that just puts the times below the emotions. The two are not in line with each other.

So ideally I’m looking for away to perfect the last stage here. I’m looking for a way to have the day’s emotions listed exactly in line with the time it was entered in Drafts. For example as below:

Kl. 07.00: Emotion X

Kl. 10.00: Emotion Y

Kl. 13.00: Emotion Z

Kl. 16.00: Emotion X

Kl. 19.00: Emotion Y

Kl. 21.00: Emotion Z

What I do then is to expand on each time and emotion in Day One by adding some details. This is why I would like to see realigned with each other.

I hope it all makes sense.

I’m thinking there is someone really clever out there who must know of some way to perfect this using Shortcuts, Drafts and TextExpander.

Thanks :blush:

If you just wanted to use Drafts, then you could count the number of rows, round down to the nearest even value and halve it to find the actual number of rows to merge. Then use half of that as an offset to merge lines.

Lets say your example is 12 lines long, half of that is 6. This would hopefully mean your draft has 6 emotions followed by 6 times; but your example formatting varies quite a bit in different parts of your post. Consistency is key, though you could also strip out blank lines first.

For line 1 + line 7 you might have something like this within a Drafts script action:

let newContent = "";
newcontent += draft.processTemplate("[[line|1]]") + " " + draft.processTemplate("[[line|7]]") + "/n"

You then repeat to build up the newContent variable across all of your lines and can replace the existing draft content or create a new draft from the newContent variable. If your number of lines varies, it would be better to construct the above as a loop.

But I don’t think this is the right approach.

Alternatively, TextExpander also supports JavaScript based snippets and you could do something similar with that. If you first copied the emotions to your clipboard, you could then iterate through and populate using your timings from TextExpander and then put that out into Day One or Drafts, or whatever app you happen to be using.

This approach tackles things a step earlier and to my mind is therefore better in that it isn’t trying to tidy up an earlier issue.

But I still don’t think this is the right approach.

When you capture your emotional state, your device is capable of capturing the time as well. This time could be rounded off to your preferred time frame identifiers if necessary (or passing it in as a parameter to Shortcuts from Due), but THAT is where I think you should be looking at making your changes. This would require no additional trigger activities from you, so it would be an easier end user solution.

If you can’t figure out how to do this yourself, perhaps consider posting a link to a copy of your actual current custom shortcut along with details of your timing/formatting scheme, and we can perhaps go further from there.

Hope that helps.

2 Likes

Thanks! I will definitely go with the final proposal. I’m sharing the shortcut with you all here. So feel free to do your magic. I can’t really do all this stuff by myself… thanks :blush:

Shortcut link: https://www.icloud.com/shortcuts/dcf3e106c65e4562bf27a09d061468e9

Update: I was able to set it up Ffrom help on the Drafts forum.

This is now nearly perfect. It would be completely perfect if it was possible to display the time entered in Drafts in bold automatically :blush:

Just put two stars before and after the time variable in your Shortcut for that.

1 Like

Final bit and nusisance on this workflow and I’m all set. Thanks again everyone for all your help and interest.

At the end of the day, after the final entry in Drafts, and having sent the draft to from Drafts to Day One, I’m left with an active populated note in Drafts (see image).

I would love it if there was a way, when sending the draft, to Day One to have the draft linked to the Siri Shortcut, automatically “empty” itself so that I the next day have a clean draft to start all over with.

I hope that all makes sense. I guess it’s something that has to be set up in the Drafts to Day One action. I just don’t know how to do that.

Thanks :blush:

If you are calling Day One from Drafts with a simple URL call…

Drafts can set custom tags - kind of like a variable. See setTemplateTag().

You could assign the content of the draft to that tag and pass that instead of the draft content as the parameter to Day One. This would allow you to also clear the ontent of the draft before calling out to Day One.

e.g. as a script step

draft.setTemplateTag("fordayone", draft.content);
draft.content = "";
draft.update();

If you are calling Day One from Drafts with an x-callback URL call…

Once you are returned to Drafts, if you have set the option to wait for a response, the Draft will continue execution of the action. Adding an action step after the x-callback to clear the content of the draft would be a simple addition.

As a script step in the action:

draft.content = "";
draft.update();

Hope that helps.

1 Like

Wow, thanks a lot. I’m too much a novice at this and barely understood a word of you wrote :anguished: :grinning:

If there’s parts that don’t currently make sense to you that you want to understand more about, and you can’t figure out on your own, just post here. I’m sure I or someone else would be able to clarify. But a bit of research on your part will go a long way in forming your own understanding.

The second section is about as straight forward as it gets, but it does need you to understand Drafts actions, and in particular the very basics of script steps.

2 Likes

Hi everyone. I updated my “Emotional diary” a little bit. And I need some help with just finishing it the right way.

There is a link to it here: https://www.icloud.com/shortcuts/93b5b3131ce749758cee271e4e79b5d8

The first prompt asks me, “how do you feel right now?”

Then there is a list where I can select a feeling.

Then a new prompt opens to ask me: what is the underlying feeling?

And then is a much longer list of feelings.

But Drafts only stores the last text input from the shortcut. I would like to have it appear like this in the Draft note, for example:

“Time stamp”: “First emotion”: “second emotion”

Can any one help me do that?

Just include the variables in a single text entry.

https://www.icloud.com/shortcuts/811741de18d141908d24116df0aeb02a

1 Like

Hi suddenly I’m getting this error when running my shortcut. Can anybody help?

I keep getting the above error. Can anyone help out with how to solve this error?

If I run the Shortcut above, with a UUID of my own, that is available in my Drafts app, it runs just fine. No error for me.

Have you put in visual messages to show where you have got to, to narrow down the action that is failing?

If you have, does that action fail if you use it in another shortcut?

1 Like

Thanks @sylumer I figured it out!

I actually want to move this task from Drafts to Bear, which means substituting Drafts for Bear in this Shortcut https://www.icloud.com/shortcuts/23edac11602d4b2cb649dfc36bd4b8e5

Bear has note links and note unique identifiers, but I’m stuck here at this step bringing the text field into the Bear notes as it is possible with the Drafts action where it says “Add text to draft”. Does anyone know if that’s possible with Bear?

Okay, switching apps is quite a key bit of information!

Have you looked at the following Shortcuts actions for Bear?

  1. Create Bear Note.
  2. Add to Bear Note.
  3. Open Bear Note.

If you are desperate to do interact with Bear using a URL scheme, the documentation is readily available on the Bear web site.

1 Like

I really can’t figure out how to do it the way it works in Drafts. The result I keep getting is this, instead of the text field that I compiled from the list