Navigation
Recherche
|
Got an iPhone with an Action button? Here’s how to make it smarter
mercredi 25 septembre 2024, 13:48 , par Mac 911
Macworld
Last year, Apple introduced the Action Button to the iPhone 15 Pro and leaned hard into its use as a button to take pictures. This year, though, the iPhone 16 and 16 Pro both have a new dedicated Camera Control button. So what’s an Action button–also now on the iPhone 16–to do? While the Action button can be assigned numerous tasks (including setting a Focus mode and toggling the flashlight on and off) I can see Apple struggling with ways of making the Action button seem less than an afterthought, overshadowed by the new Camera Control. For example, Apple has suggested on a few occasions that the Action Button is a bit of a chameleon. It can turn on the flashlight at night, but toggle Do Not Disturb during the day, for example. Or it can turn on the flashlight when your iPhone is held horizontally, but launch an app when held vertically! This all sounds clever, but unfortunately, Apple hasn’t actually added any functionality that lets users easily assign different tasks based on time or orientation. If you want to know how to do that sort of thing, you’ll need to use Apple’s Shortcuts app to get it done. I know Shortcuts is intimidating to a lot of people, so here’s a very simple guide to creating a basic Action Button shortcut with behavior that varies based on some specific parameters. (For more, much more on this concept, check out Federico Viticci’s MultiButton project.) Limitless potential Shortcuts lets you create sequences of events that trigger from top to bottom when you run them. It’s like a computer program, but every event or command is a rectangular block that you can drag up and down to rearrange them. For the purposes of this example, we’re going to create a shortcut that detects the orientation of your phone and performs a different action depending on if you’re in portrait (vertical) mode or not. To begin, open Shortcuts (which is installed on every iPhone) and tap the “+” icon in the upper right corner to create your first shortcut. On the iPhone, the Shortcuts window has two panes: at the top, you’ll see the series of Actions in the workflow (currently none) while at the bottom you’ll see a library of all the Actions available on your device. A bunch are baked into iOS, and individual apps can add their own Actions too. For this example, we need to check for device orientation. In the Actions pane, you can use the Search box to search for Orientation or you can tap the category filter marked Device just below the search box, to limit the list of actions to just those intended to control or report back about your device. The action you want to tap is called Get Orientation. When you tap it, it’ll be added to the list of Actions in your workflow. Now that we’ve added Get Orientation, we need to do something with it–or really, we need to do two things with it. We need to perform one task if the phone is in Portrait orientation, and a different task if it isn’t. To do this, we need to add the If action. Tap in the Search Actions box and search for If, and then tap to add it to your workflow. It’ll automatically be added–along with two other actions, Otherwise and End If–at the bottom of the workflow. If you’ve never done any programming before, this is the bare bones of an If-Then statement. Below the If statement will go actions that happen if the If statement turns out to be true, and below Otherwise will go actions that happen if the If statement isn’t true. Everything below the End If action happens regardless of the results of the rest of the If statement. Now we need to define what the If statement is going to measure. Since If was added immediately following our addition of Get Orientation, it’s been placed right below that action–and has automatically been assigned the result of Get Orientation as the item that it’s going to test. This is reflected in how the If block is displayed, as “If Get Orientation is [Choose].” We could tap on that Get Orientation to change the If action to evaluate something else, and we could tap on the is statement to change it to something like “is not”, but for now, let’s leave it as is. Now tap on Choose, to choose what we’re evaluating about the device orientation. In this case, we’ll be prompted with a list of seven different possible iPhone orientations. Since the Flashlight only really makes sense when it’s in portrait mode, tap Portrait. Now the If action reads, “If Get Orientation is Portrait”. (If we wanted to add some other orientations, such as “face up,” we could tap the plus icon to the right of Portrait and convert the If action into a more complex series of logical questions–but let’s not. This is your first Shortcut.) Now we need to add a new action that does what we want when the iPhone is in Portrait mode, namely using the flashlight. To do this, tap in Search Actions at the bottom of the screen and type Flashlight, then tap on the Set Flashlight action. It will be added at the bottom of the stack of actions, below End If. This is too far down! If we leave it there, it’ll turn the flashlight on every single time we run the shortcut. Instead, tap and hold on Turn Flashlight On (being sure not to tap right on the blue tappable parts of the action) and drag it up until it nestles right under the If block. This tells Shortcuts that if Get Orientation is Portrait, then turn the Flashlight on. But is that what we really want? Sometimes you want to turn the Flashlight off. So let’s tap that word Turn and instead set it to Toggle. Now when the Shortcut is run and the device is in Portrait orientation, the flashlight will toggle to the opposite of its current state. Now to add the other action, which runs if the orientation is not Portrait. It can be anything we want, but for this example let’s have it toggle the Do Not Disturb focus mode. Tap on Search Actions, type Focus, and tap on Set Focus. This will add a Focus action–it’ll be marked as “Turn Do Not Disturb Off” by default–at the very bottom of the stack. Tap on Turn to change it to Toggle, which is better. Then tap and drag the entire action up to below Otherwise in the list. That indicates that this action should occur if the If statement (that the orientation is Portrait) fails. At this point, you should have a functional shortcut. Try it out by holding your phone up and tapping the play button in the lower right corner. If you’ve done it correctly, your flashlight will turn on. Do it again to turn it off. Before we assign this Shortcuts action to the Action Button, let’s give it a name. Tap on the carat icon just below the Dynamic Island, then tap Rename, and call it something like Action Toggle. Then tap Done. To assign your Shortcut to the Action Button, open Settings, tap Action Button, and then swipe to Shortcut. Tap Choose a Shortcut and choose the item you just created. That’s it! Try it out and see how it works. Once you’ve done this, you can create other shortcuts that use different information–like the time of day, for example–to run different actions at different times. And of course, you can combine If statements, so that the flashlight only fires when you’re in Portrait orientation at night. The sky’s the limit. If you’re curious about Shortcuts, Apple provides lots of examples in the Gallery tab of the app. The great thing about Shortcuts workflows is that they’re all viewable and editable in the Shortcuts app itself, so if you’re curious about how a particular workflow does what it does, you can open it and scroll through its actions. Now, should Apple add some of this basic if-then functionality to the Action Button settings app itself? Oh, probably. But it didn’t get around to it this fall–and it turns out it didn’t have to, since Shortcuts is always there to make our lives a little bit easier, as long as we know how to use it. Learn more about iOS 18 and the iPhone 16.
https://www.macworld.com/article/2468165/got-an-iphone-with-an-action-button-heres-how-to-make-it-sm...
Voir aussi |
59 sources (15 en français)
Date Actuelle
dim. 22 déc. - 13:40 CET
|