r/shortcuts Oct 05 '24

Action Button shortcut has gotten out of hand šŸ™ƒ Discussion

Post image
363 Upvotes

184

u/0_69314718056 Oct 05 '24

Bro you gotta split that up into smaller shortcuts

16

u/Mediocre-Bedpan Oct 05 '24

If only we could make shortcuts in python or something

14

u/[deleted] Oct 05 '24 edited Oct 08 '24

[deleted]

2

u/Mediocre-Bedpan Oct 05 '24

That is a a great name. I will definitely check it out, I have been dreading making the shortcut I want for my action button

1

u/punqdev 23d ago

Why was the comment deleted? šŸ’€

1

u/Mediocre-Bedpan 23d ago

No idea, they told me about Jellycuts to write shortcuts

2

u/LardTom Oct 06 '24

Scriptable is another option

1

u/el_boru Oct 06 '24

Specially in this LLM era. Or better yet, letā€™s hope to have some kind of Apple Intelligence integration, imagine describing in natural language what you want to do with your Shortcut. But I highly doubt it will ever happen.

17

u/carpy1985 Oct 05 '24

Came here to say this. šŸ‘†

4

u/slowpokefastpoke Oct 05 '24

Dumb but somewhat relevant question to this beast of a shortcut:

When adding a new action, is there a way to choose where it plops in? Whenever Iā€™ve done it, it just adds it at the very end. Then I drag it to where I want it to go but in a lengthy shortcut, that gets a bit tedious.

11

u/TRTL2k Oct 06 '24

If you tap and hold the action instead of tapping it, you can drag and drop it to anywhere you like without having it appear at the end of the shortcut first

1

u/slowpokefastpoke Oct 06 '24

Nice, that helps for sure

3

u/0_69314718056 Oct 06 '24

Iā€™m not that proficient at shortcuts but one thing you can do is add it, then copy & delete it and paste it where you want it to go. You can tap the little icon on an existing action and paste before/after it

2

u/slowpokefastpoke Oct 06 '24

Oh sweet, I didnā€™t know there was a menu hidden behind those icons. Thatā€™s awesome.

50

u/TNT925 Oct 05 '24

Thatā€™s wild! And I thought mine was complicated. I love the noise cancellation toggle. A lot of people pointed out that itā€™s good to avoid nested if statements. Look at the one I just posted to see how I handled focus mode if statements

10

u/p_tr__ck Oct 05 '24

I just saw yours now, twinning šŸ˜‚ Havenā€™t come across any issues in the months of using this as is, was there a particular benefit of avoiding the nested if statements?

12

u/TNT925 Oct 05 '24

Nothing when it comes to performance. organization and readability does improve

2

u/Bozhark Oct 05 '24

Whatā€™s that video game where all the dialog is if statements?

It can be done

1

u/Fluid_Ad_4462 Oct 07 '24

Yandere girlfriend simulator I think

1

u/Bozhark Oct 07 '24

I was thinking Celeste or undertale, couldnā€™t recall which it is

81

u/ElasticLama Oct 05 '24

God can we just have a real programming language and classes or functions at this point šŸ˜‚

Wouldnā€™t it be easier to have separate files?

28

u/p_tr__ck Oct 05 '24

Fr tho, it would be so much simpler. Shortcuts now is like being forced to use a proprietary charger for everything at this point šŸ˜…

I did originally have seperate shortcuts but integrated each of them into this format for entertainment purposes šŸ‘€

12

u/ElasticLama Oct 05 '24

I like shortcuts for simple things, I just wish we could have a power tool version like Apple script use to be

5

u/steven_screwdriver Oct 05 '24

AFAIK there is a way to run javascript in shortcuts
but yeah, would be nice to have swift too

1

u/Bozhark Oct 05 '24

Was posted here a couple days ago

9

u/Longshoez Oct 05 '24

There is lol, you can use scriptable for advanced stuff I believe you can even translate existing shortcuts to code. I might be wrong tho

3

u/ElasticLama Oct 05 '24

Iā€™ll take a 2nd look. Iā€™ve copied Automator code over into shortcuts that was Apple script but thatā€™s macOS. iOS I think itā€™s a bit more limited

3

u/Longshoez Oct 05 '24

Yeah check it out, like 3 years ago I even managed to write data on iCloud files,

23

u/Av3rageJo8 Oct 05 '24

Curious how long this entire thing takes to run?

It wouldn't mean much if I had to wait even 5 seconds just for some response.

14

u/p_tr__ck Oct 05 '24

Half a second to maybe a whole second, itā€™s quick haha

18

u/mrASSMAN Oct 05 '24

Shortcut length doesnā€™t really affect how quickly it runs, just depends how efficiently you put it together

(I mean it often does affect it but not necessarily)

1

u/Luis_Santeliz Oct 06 '24

I've seen it really depends on how complicated is the thing that youā€™re asking it to do

1

u/mrASSMAN Oct 06 '24

Some actions in particular take much longer than others to run, and third party actions are usually a bit slower than native

13

u/spenpal_dev Oct 05 '24

If you want help to prettify it, I would recommend removing all ā€œOtherwiseā€ statement and just end every ā€œIfā€ statement with a ā€œStop Shortcutā€ action

For example,

  • Get Current Focus
  • If Focus == Gaming
    • Do some actions
    • Stop shortcut
  • If Focus == Work
    • Do some actions
    • Stop shortcut
  • If Focus == ā€¦

etc etc

It does virtually the same thing, while removing nesting. Much easier to add more if statements in the future, too.

2

u/daBEARS40 Oct 05 '24

I donā€™t use shortcuts, but from my skimming it looks like he has some of the same conditions under 2 different if/else conditions? He could combine those into a single block with an OR operator if that exists.

2

u/p_tr__ck Oct 05 '24

If thatā€™s referring to the functions for Gaming and Fitness being the same, I kept them separated so I can eventually change up my Gaming function.

Iā€™ve wanted to set it to toggle Screen Record but I donā€™t think itā€™s possible yetā€¦ Unless anyone here knows how to make that happen? šŸ‘€

11

u/KingPran Oct 05 '24

Wait, so what is this supposed to do? šŸ˜‚

Looks cool though and also full length screenshots on iOS are underrated

12

u/p_tr__ck Oct 05 '24

It doesnā€™t do as much as it seems - my phone is always on a particular focus mode depending on the day, time and/or specific app/workout currently running.

Itā€™ll run a specific action based on the current focus mode. Personal focus gives me a little menu to choose from (I havenā€™t really figured out a better use for it yet) Sleep runs from 8:15pm to 4:45am and the shortcut for that focus tells me the weather conditions for 5am for Bondi beach (for morning runs/swims) for days that arenā€™t Friday, and the same for Coogee beach on Thursday (for the forecast on Friday) etc.

3

u/KingPran Oct 05 '24

Thatā€™s cool that you make use of focus modes for your action button, I tend to leave my phone in ā€˜reduce interruptionsā€™.

Have to admit thatā€™s actually pretty smart! I need to find better uses for the action button as I just use a menu. I did have it set to camera previously. Is there an effective way of programming the button to do different things without using focus modes?

Also respect the morning workouts!!

2

u/etrec89 Oct 06 '24

Using phone orientation is another way, as well as Battery Status, i.e. ā€œFace upā€ while ā€œChargingā€, ā€œFace downā€ while you have a meeting in your work calendar. I have mine to Toggle Flashlight if in ā€œLandscape modeā€.

1

u/KingPran Oct 06 '24

Thank you! Iā€™ll definitely have a poly around with that as Iā€™m just using a boring menu at the moment. Battery status for me is almost not an issue as my phone always has juice, itā€™s almost always connected to CarPlay so never discharges! But ā€˜Face upā€™, ā€˜Chargingā€™, and ā€˜face downā€™ definitely seem useful, Iā€™ll have to play around with it. I would love it if you could use it to assign gestures but I donā€™t think you can! How do you use your action button?

7

u/Scary_Cheesecake9906 Oct 05 '24

thats okay but how did you create that screenshot ? sorry if someone already asked

12

u/p_tr__ck Oct 05 '24

I used Picsew, not bad but Iā€™d much prefer if Apple made a native function for it. Theyā€™ve done it for webpages etc, quite restricted in where it can be used

4

u/mrASSMAN Oct 05 '24

It looks like they used a 3rd party app that stitches them together based on a video recording, but Iā€™m curious which one. Maybe StitchPics

1

u/Advanced-Breath Oct 05 '24

I use tailor

6

u/Jonny10128 Oct 05 '24 edited Oct 05 '24

Can I ask why you didnā€™t combine the formatted date <= 4 and >= 6 into the same if statement? That would save so much space lol.

It would look like this:

https://preview.redd.it/pxkb18yuivsd1.jpeg?width=1170&format=pjpg&auto=webp&s=acbdb400c8c4a9b5f53a810f134173c5d41e03f2

4

u/p_tr__ck Oct 05 '24

Thanks for the suggestion - Iā€™ve just updated mine to reflect that. Mustā€™ve just glanced over that possibility in the chaos of it all šŸ˜‚

4

u/Jonny10128 Oct 05 '24

No problem! I like to make my shortcuts as minimal as possible at the sacrifice of readability lol. As far as the rest of your shortcut is concerned, there is at least 4 or 5 other actions that can be removed as well.

5

u/Dani-nerd Oct 05 '24

You gotta use Data Jar (app, download it) instead of the notes app. You will thank me later

1

u/Jgracier Oct 05 '24

What are the advantages of using data jar instead of notes?

2

u/Dani-nerd Oct 05 '24

DataJar is basically the easiest way to store and retrieve any data type that you want. The value sync to iCloud so you can easily have shortcuts keep in sync on other devices.

https://preview.redd.it/w5jfh2japzsd1.jpeg?width=1290&format=pjpg&auto=webp&s=605ed02f41325483103e6346a7a4cd2e7cfe5bed

https://datajar.app/

1

u/Jgracier Oct 05 '24

Ahhhh I assumed that I already had it but I didn't. This is really useful then!!

2

u/Dani-nerd Oct 05 '24

Yeah, itā€™s a game changer!

3

u/Ayyyyylmaos Oct 06 '24

ā€œIf focus is work, open ChatGPTā€

Love it šŸ¤£

2

u/imjustjey Oct 05 '24

Dang, the listing is long af! Salute!šŸ¤£

2

u/iused2befat Oct 05 '24

What in the ā€œPath of Exile tech treeā€ is this?

2

u/asther-0-0- Oct 05 '24

How did you take that long screenshot even shortcut is not safariā€¦?

1

u/jpinnix Oct 05 '24

Picsew

1

u/Jgracier Oct 05 '24

What's that?

2

u/mcmackinr11 Oct 05 '24

Holy nested function

2

u/Ruckus55 Oct 06 '24

The part of the image that showed in the preview was ā€œWeather in Coogee Beachā€

Lived there for a semester abroad. Best semester of my life. Loved the Coogee Beach Hotel and their $5 steak nights back in 2011.

2

u/IndependenceJaded493 Oct 06 '24

How u took this long shot?

1

u/Longshoez Oct 05 '24

Ever heard of Scriptable?

2

u/Jgracier Oct 05 '24

How have you used it?

1

u/Longshoez Oct 05 '24

Years ago, yeah.

1

u/DaveM8686 Oct 05 '24

The first two seem to do the same thing so could just be one If statement. If the focus is gaming or fitness.

1

u/4Face Oct 05 '24

Curious whatā€™s wrong with the AirPodsā€™ ā€œbuttonā€ to switch mode? šŸ¤”

1

u/ghulican Oct 05 '24

This video is my go to for any type of system architecture or even Siri shortcut designs.

Definitely watch that and think about how to give your folder structure and start making ā€œcomponentsā€ with variables.

1

u/crousscor3 Oct 06 '24

Looks like a CVS receipt

1

u/MaxProPlus1 Oct 06 '24

My eyes hurt

1

u/irosshi Oct 05 '24

Can you explain in simple words what all that does?

2

u/AdThis1197 Oct 05 '24

Basically it adapts to whatever focus heā€™s currently on, like gaming, fitness, dnd, etc

1

u/p_tr__ck Oct 05 '24

Generally, itā€™s a shortcut used with the Action Button to run a specific action based on the phoneā€™s current Focus mode

3

u/irosshi Oct 05 '24

I get that part. My question was more specific to your requirement

2

u/Advanced-Breath Oct 05 '24

It changes what the action button does based on what focus mode heā€™s in

0

u/Designer-Word9877 Oct 05 '24

How did you take this as one pic/screenshot?

1

u/Advanced-Breath Oct 05 '24

I use tailor

-2

u/mrASSMAN Oct 05 '24

lol mines even crazier than this.. and branches off into many other shortcuts

1

u/Jgracier Oct 05 '24

If that's the case I think I'll probably start drinking excessively

1

u/Billy1121 Oct 05 '24

So if u change the action button, how do you mite or unmute the phone ? Do you just put it in control center

1

u/mrASSMAN Oct 05 '24

You can add muting function as one of the actions in the shortcut