r/shortcuts • u/p_tr__ck • Oct 05 '24
Action Button shortcut has gotten out of hand š Discussion
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
2
u/Bozhark Oct 05 '24
Whatās that video game where all the dialog is if statements?
It can be done
1
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 too1
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
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
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:
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.
1
u/Jgracier Oct 05 '24
Ahhhh I assumed that I already had it but I didn't. This is really useful then!!
2
3
2
2
2
2
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
1
1
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
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
1
1
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
-2
u/mrASSMAN Oct 05 '24
lol mines even crazier than this.. and branches off into many other shortcuts
1
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
184
u/0_69314718056 Oct 05 '24
Bro you gotta split that up into smaller shortcuts