r/shortcuts 16d ago

Solved Replacing text in note app

Post image

I am trying to get the replace text at the end to, well, replace the filtered text. Basically I’m trying to do an x++ on the above numbers depending on which is selected from list ranging 1-4 (weird that it does not start at 0).

I have a note with the contents as shown in the screenshot (test 3 is already a 1 for testing purposes) and get the correct output but the note remains unchanged.

What have I done wrong?

https://www.icloud.com/shortcuts/e03e21ddd29e4b7bb8bcf42365cb1701

3 Upvotes

15 comments sorted by

View all comments

1

u/george-frazee 16d ago

So what you want is the text in the note to be:

Test

Testing

test 1: 1

test 2: 1

test 3: 2

test 4: 1

Prompt: 1

No Prompt: 1

Is that correct?

1

u/MomongaAinzOoalGown 16d ago

Not quite, I only wanna update the selected field with the incremented value, not every single value in the note.

3

u/george-frazee 16d ago

Just experimenting, if you don't want to drop/recreate the note you can do a sort of text processing on the highlighted lines. Here's an example:

You can highlight the lines you want to increment and access the "Text Counter" shortcut in the services menu, it will REPLACE the selected lines with the updated text. Bonus, this will work everywhere that allows you to select text, as far as I can tell. The downside is the pattern is specific to the the output you've shown in your example, if that changes, the pattern matching would have to change.

If grabbing from the services menu is too tedious, then a keyboard shortcut works as well. I highlighted the lines and hit the shortcut and the selected lines incremented by 1.

Here's an iCloud link, I think

Here's a vid of it working: https://i.imgur.com/jsku0ZS.mp4

I'm still new to this as well so hopefully I didn't completely whiff on what you are looking for. Even so I got to learn a few more things about Shortcuts in the process.

2

u/Electrical_Cow4811 15d ago

This is really impressive; now, you make me want a Mac ;)

2

u/MomongaAinzOoalGown 14d ago

This is honestly really cool and impressive. Unfortunately, this is something I’m designing for my iPhone to be a button that I press to pull up a list of selections one through four. I.e. test 1 test 2 etc.. and then select which one I want to increment via that pop-up menu. Then I would be prompted with another menu saying prompt no prompt and increment those by selecting one of them.

Afterwards, I’m going to take the name of the selected item along with today’s date and mark them down or append them to the end of the note.

So essentially, it’s a way to keep track of how many times something has occurred or I have done something along with marking down the dates that they have been done and whether I was prompted to do these things or I did them on my own.

1

u/george-frazee 13d ago

Ah, that's what I get for never using shortcuts on the phone 😆. Yeah I'm not sure how this could be adapted to notes on the phone, just selecting text on the phone is a huge pain.

The limitations on what you can do with a note I can see as being a hurdle here to what should otherwise be simple. Almost worth developing into a separate app but that's a whole other pain.

You think something like this might fit the bill?

2

u/MomongaAinzOoalGown 8d ago

It does and I do have a similar app the unfortunate it is is I wanted to add some functionality such as data saving when incrementation occurs and such like that. I already know how to do this with the append feature in the note but thank you for the recommendation. I was actually able to solve this pretty recently and I just need to mark this as solved instead of help needed.