I think I’ve asked this question here before… but I didn’t get an answer and I can’t find the thread, so I’m trying again.
I’m a basic user of both Workflow and the Terminal. I run a CLI application called Google Admin Manager to, um, manage my Google Admin tasks and I’d like to create some Workflows which will, upon launch, ask for some input and then use that input to issue commands to GAM in the Terminal.
This doesn’t seem like it should be that tricky, but I can’t get it to work.
Could someone show me how to build a simple “Hello World” Workflow that will do the following?
Ask the user for their name
Store the input into a variable called UserName
Pass a command to the Terminal (echo hello UserName) so that the Terminal outputs a hello message to the user
Given that, I think I can puzzle out how to do what I need to do.
When you mention Workflow, are you referring to Shortcuts? Workflow was an app that Apple bought several years back and then rebranded as Shortcuts. It’s now available on the Mac as well.
Regarding integration with the GAM CLI tool, what you can do with Shortcuts or Scripting will largely depend on how the GAM tool works. I haven’t worked with it, but if it’s an interactive only utility, it’s doubtful that you’ll be able to integrate it with Shortcuts or shell scripting. If there’s a way for it to accept arguments to run specific tasks, then something could be put together.
Thanks… yes: I meant Shortcuts. Sorry, I’ve been noodling around with it since it was called Workflow and I confused the names.
GAM is not interactive: all I want to do is use Shortcuts to build a command then run it in the Terminal. An example: If I have to create a new user, I’d like to launch the New User Shortcut, and be prompted for “First Name”, “Last Name”, and “Personal Email.” I would then parse those inputs to produce a single command to run in the terminal as follows:
I’m not sure what you are looking for then, as the commands are passed from Shortcuts to the Shell, the Shell runs them and then passes the results back to Shortcuts.
But it is the Shell that executes the commands.
And it turns out you had asked this question on the Automators forum:
This is the key answer from that thread (from Sylumer): “The terminal app is running an interactive shell where you could provide input, whereas the shell action in Shortcuts will run a non-interactive shell, executing a sequence of one or more preset commands. Since you are doing all the interaction in Shortcuts and just need the command executed, that should be just fine for your needs.”