Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Try this to get an understanding of what I'm saying. Note: you may need to change the value of n to get this to work on your machine: n = 2;Dynamic[# -> ControllerState[n, #] & /@ControllerState[n, "Controls"]]
Related: In 12.0, there is a "New Document" button in the Touch Bar. In addition, it is possible to make your own functions that utilize the Touch Bar. For example: n = 1;controls = Select[ControllerState[n, "Controls"], StringStartsQ["X"]];GetStates[] :=Clip[Sort@Rescale[DeleteCases[ControllerState[n, controls], -1.], {-0.75,0.32}, {0, 1}], {0, 1}] Dynamic[Plot[Evaluate[Sin[(1 + GetStates[]) \[Pi] x]], {x, -Pi/2, Pi/2}]] Credit to SGHuisman from Twitch. A more general example for the uses of this, just type: Dynamic[ControllerState[]]
Related: In 12.0, there is a "New Document" button in the Touch Bar. In addition, it is possible to make your own functions that utilize the Touch Bar. For example: n = 1;controls = Select[ControllerState[n, "Controls"], StringStartsQ["X"]];GetStates[] :=Clip[Sort@Rescale[DeleteCases[ControllerState[n, controls], -1.], {-0.75,0.32}, {0, 1}], {0, 1}] Dynamic[Plot[Evaluate[Sin[(1 + GetStates[]) \[Pi] x]], {x, -Pi/2, Pi/2}]] Credit to SGHuisman from Twitch. A more general example for the uses of this, just type: Dynamic[ControllerState[]]
@MarcoB, it's not quite what I want, because I want to be able to extend it to when the user doesn't input the exactly correct name; that's why I want to use interpreter. Note that Interpreter["Quantity"]["meter"] fails. I don't mind what the FullForm output is. I just want `Interpreter["Quantity"]["Unit"] to return unit. However, it fails
Keep an eye out for Around, a new function coming in the next* release that will do exactly what you want, and with unit compatibility. See this video with this documentation for details on the solution to your question for the future. •based on Stephen Wolfram's design livestreams