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

JoelBC

macrumors 65816
Original poster
Jun 16, 2012
1,066
104
I want to insert the following text at the start of each entry in a log that I am keeping "- YYYYMMDD; ".

I wrote - with help - an AppleScript that does this (i.e., returns "- YYYYMMDD; ")

The App that I use for logging purposes is not scriptable! :(

I was thinking of using Automator to create an Automator QuickAction which I could / would then assign to a keyboard combination to enter the text when I start a new line in the log.

I can't figure out how to do this; would greatly appreciate any and all help.

Thank you!

PS. I should add that if there is a better / easier way then I am very open to that as well! Please show me!
 
I know you can do it via AppleScript, but I have not done this myself. Shortcuts, what Apple wants people to use as an AppleScript replacement, can do it pretty easily.

  1. Create the Shortcut
  2. In the settings of the Shortcut (circle-i), enable Quick Action, Services, Provide Output. Can optionally set a keyboard shortcut here or can go Settings > Keyboard > Keyboard Shortcuts > Services > Shortcuts > shortcutname
So you now have the option to enter the value via Services, context menu (aka right mouse click), and keyboard shortcut/macro.

EDIT: can simplify the Shortcut to just be the ”Stop and Output“ action. Return “current date” and specify the custom format in that variable.
 

Attachments

  • p1.png
    p1.png
    205.2 KB · Views: 64
  • p2.png
    p2.png
    223.6 KB · Views: 58
  • p3.png
    p3.png
    137 KB · Views: 61
  • p4.png
    p4.png
    215.7 KB · Views: 62
Last edited:
I know you can do it via AppleScript, but I have not done this myself. Shortcuts, what Apple wants people to use as an AppleScript replacement, can do it pretty easily.

  1. Create the Shortcut
  2. In the settings of the Shortcut (circle-i), enable Quick Action, Services, Provide Output. Can optionally set a keyboard shortcut here or can go Settings > Keyboard > Keyboard Shortcuts > Services > Shortcuts > shortcutname
So you now have the option to enter the value via Services, context menu (aka right mouse click), and keyboard shortcut/macro.
Appreciated and will give it a go (as I have little experience with Shortcuts). That said, how do I insert the "- " before the date and the "; " after teh date?

Thank you.
 
Just enter them, it's free format. The custom format would be (minus quotes) "-yyyyMMdd;"

For example, I've got a Shortcut that returns timestamp-y value.
 

Attachments

  • tstamp.png
    tstamp.png
    41.3 KB · Views: 50
Just enter them, it's free format. The custom format would be (minus quotes) "-yyyyMMdd;"

For example, I've got a Shortcut that returns timestamp-y value.
Ahhh, way simpler than I was thinking!

Very much appreciated, t works like a charm!

The only downside was I did not get to further / test my AppleScript skills but at least I learnt a bit about Shortcuts!

MUCH THANKS!
 
@NoBoMac and Others, a little help please!

I created the Shortcut per NoBoMac's above instructions to enter the date in a prescribed format (i.e., I use it to enter the date in a log that I keep).

The Shortcut, which because of some macOS changes, now looks this:

Screenshot 2023-11-24 at 9.57.11 PM.png


The problem that I am having is the Shortcuts icon appears in the menu bar (as it should when a shortcut is run) but is persistent (i.e., does not "fade away") until the Shortcut is run a second time; that is, the first time the Shortcut is run, the menu bar looks this (notice the persistent Shortcuts icon):

Screenshot 2023-11-24 at 10.03.32 PM.png


When I run the same Shortcut a second time, the Shortcut icon in the menu bar becomes "inverted" / "translucent" (i.e., first below image) and then disappears (i.e., second below image).



Screenshot 2023-11-24 at 10.10.29 PM.png



Screenshot 2023-11-24 at 10.13.50 PM.png


This pattern repeats (i.e., every odd time I run the Shortcut a persistent icon appears in the menu bar, every even time I run the Shortcut the Shortcut menu bar icon becomes "inverted" / "translucent" and then disappears).

Worth noting, among the many Shortcuts that I have, this behaviour only occurs with this shortcut.

THE ASK: Please replicate and test this Shortcut's behaviour to see whether this behaviour is common / repeatble on other macOS computers (i.e., I am running macOS 14.1.1) or whether there is a specific problem on my MBP (16" MBP M1 Max).

Worth noting, I tried the above on a friend's MBP and note that it worked properly on their machine (i.e., they did not have the persistent icon problem)! The has me thinking that there is something wrong wth my machine / setup.

Thanks.
 

Attachments

  • Screenshot 2023-11-24 at 10.10.29 PM.png
    Screenshot 2023-11-24 at 10.10.29 PM.png
    105.2 KB · Views: 28
Sorry, can't test it as I have a TON of Shortcuts pinned to the menu bar that would need to be disabled.

But guess, normal. If I run a Shortcut that is not pinned, the Shortcuts icon lights up when running.
 
Sorry, can't test it as I have a TON of Shortcuts pinned to the menu bar that would need to be disabled.

But guess, normal. If I run a Shortcut that is not pinned, the Shortcuts icon lights up when running.
Appreciated.

The question is, when you run a Shortcut that is not pinned to the menu bar does it teh men bar icon remain persistent (i.e. solid) or does it become transparent?

Thanks.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.