Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

faaslave

macrumors newbie
Original poster
Nov 16, 2011
9
0
CA
I am trying to make a shortcut that will find and replace 2 different things in a notes file.
Here is the issue. Everytime I download a song file that I am going to use, I have to change the format to make it work.
The header sin the file look like this [Verse1] [Chorus] etc
I need them to look like this Verse1: Chorus:
So I do a find and replace to remove the left bracket, then I do another one to remove the right bracket and add a colon, followed by a return

It would be m uch easier to have a shortcut I can run to do this, but I can't get the format right.

Any help is appreciated.

Dave
 
I am trying to make a shortcut that will find and replace 2 different things in a notes file.
Here is the issue. Everytime I download a song file that I am going to use, I have to change the format to make it work.
The header sin the file look like this [Verse1] [Chorus] etc
I need them to look like this Verse1: Chorus:
So I do a find and replace to remove the left bracket, then I do another one to remove the right bracket and add a colon, followed by a return

It would be m uch easier to have a shortcut I can run to do this, but I can't get the format right.

Any help is appreciated.

Dave
Could you paste screenshots of the shortcut as it is now so we can troubleshoot the issue?
 
Could you paste screenshots of the shortcut as it is now so we can troubleshoot the issue?

I really have no idea how to set it up. All I have is this
 

Attachments

  • Screen Shot 2022-09-27 at 9.34.22 AM.png
    Screen Shot 2022-09-27 at 9.34.22 AM.png
    80.4 KB · Views: 124
There are a lot of things to convert, verse1, 2, 3, interlude, intro, outro, and people use different naming conventions sometime. What I need is all the brackets removed and a colon inserted at the end of each one. plus a carriage return after it as well. I am sure that apple shortcuts can do this easy if i knew the correct syntax to set it up
 
Searching for something ([ or ]) and replacing with nothing, removes that something :)
 
You could experiment with Settings > Keyboard > Text > Replace/With entries.

Screen Shot 2022-09-27 at 6.34.58 PM.png


Then in many Mac apps, including Notes, go to Edit > Substitutions > [make sure Text Replacement is checked] > Show Substitutions. Inside that box also make sure Text Replacement is checked, and then select Replace All. The Text Preferences button there will take you to the Keyboard > Text list you created.

Screen Shot 2022-09-27 at 6.26.35 PM.png


I tried it but there are a couple of things it won't do such as adding a return at the end of a line, and creating a Replace/With pair where the With is blank. I would think might work for most of your entries, and then you could tweak it with a couple of individual replaces for returns.

I looked at Shortcuts option for multiple replace criteria but didn't find anything that would work. I could almost swear there was an option to do batch find and replace in Word, at least at one time but I don't know if that's still true.

And maybe there's an app or two that can handle multiple find and replace functions.

 
Last edited:
Thanks for the reply. What I am trying to learn is how to do this with Apple shortcuts. I can do it with find and replace, but I really want to learn how to pull this off using apple shortcuts
 
I think it is possible using just the shortcut app. They have find and replaxce text commands built in. I am not using pages. All the files are in Notes. I thought the whole point of apple shortcuts was that you could build automation without scripting
 
^^This.

I looked at Shortcuts option for multiple replace criteria but didn't find anything that would work.

Maybe not I'm not understanding correctly, but you could just put multiple Replace Text actions together?
 

Attachments

  • replace.png
    replace.png
    70 KB · Views: 97
Same as #13, just changed Text object to "Find Notes" action: Find All Notes with Title "XYZ".

Now, that I knew would return one note. For multiples, will need the Repeat with Each to do them one at a time.
 
  • Like
Reactions: 0128672
Something that just popped into my head about this: unfortunately, there is no way to truly edit a Note. Can append to a Note, but no way to change the text in one, need to create a new Note using the changed text.

  • Get Note
  • Set Variable to Note Name
  • Pass Note text to Replace Text action(s)
  • Set Variable to new text
  • Delete old Note
  • Create new Note with saved Name, new text
 
Thanks for the help. I gave up. I have to do 10 of them tonight again.
It doesnt have to be in notes, I could use pages instead if a shortcut would work.
I copy the song sheet into notes, but lets say pages instead. It looks like the attachment.

Everywhere you see [Chorus] [Verse] etc. I need to change them to Chorus: Verse: before I import them into my software i use on stage for my song sheets. The hope was that I could open the sheet like the one I uploaded, run a shortcut and it would do what I do manually for me.

What I do is is two find and replace commands
Find [ and I replace it with nothing - that removes the left brackets
Then I find ] and replace it with :
That's it. I know how to put those commands in the shortcut app, I think. Just like NoBoMac explained, but I don't know the other steps needed to make it work.

I have given up hope at this point. Thanks for the help though.
 

Attachments

  • Werewolf.pdf
    19.9 KB · Views: 117
With ApplesScript in Pages
Code:
tell application "Pages"
    activate
    tell the front document
        tell body text
            delete (every character where it is "[")
            set every character where it is "]" to ":"
        end tell
    end tell
end tell
 
ApplesScript can be used as it is in ScriptEditor, saved as an app, integrated into a QuickAction with Automator or into a Shortcut.
If you can provide more information about the format of the files you are downloading and the format required by the software you import them into, maybe we can provide suggestions for a more efficient workflow.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.