Allow variables or shell output in Text command
I finally found a working text expansion tool that works with Citrix. I often need to input the current date and would love to have the ability to insert a variable or shell script output as "Text" (typing).
Hey @uwe-schwarz, there is already support for some "magic" variables that depend on your context but it would be awesome to pick up on variable assignment coming from the output of a shell script and use that later in the workflow. I really like this idea! 👍
Is there some documentation for these magic variables?
Sadly no, I have yet to add them to the wiki.
But here they are:
"CURRENT_WORKING_DIRECTORY"
"DIRECTORY"
"FILE"
"FILEPATH"
"FILENAME"
"EXTENSION"
"SELECTED_TEXT"
"PASTEBOARD"
Not that some of them only work for document application windows. (I mainly use it for resolving from Xcode)
At least I have a workaround now, it's not perfect, but working.
First step "shell": date +%F | tr -d '\n' | pbcopy
Second step "text": $PASTEBOARD
Thanks for sharing the variables, this helped me a lot.
@uwe-schwarz no worries, glad you figure out a workaround.
Good news, started to investigate how hard this would be to pull off and I already have a POC working with output assignment.
Can share some more details later 😎
@uwe-schwarz Here is another update, this is what it looks like right now.
So what we are seeing here is a workflow that runs ls in the current directory.
The current directory is resolved based on the current file (extracted from Xcode).
$DIRECTORY is one of the magic variables that you mentioned earlier.
I also added support for shebang inside both file and inline scripts.
The output of the ls command is stored inside the variable HELLO and can then be reused in other commands following that one. So if you run a series of commands and assign them to different variables, the final command will have access to all the variables that you have provided, which is pretty neat.
Note that assigning variables is only allowed in the workflow is configured with serial execution. Concurrent will just run all of them at the same time, which will result in variables not being set depending on the execution order. You can easily switch between them using the Concurrent/Serial menu in the workflow detail view.
I think this next update is gonna pack a real punch 🥊 when it comes to how much flexibility it gives to the user.
Hope this is what you were thinking @uwe-schwarz, and thanks for bringing this to my attention, I got really excited when I got it working and the potential for creating just insanely great workflows is from here to infinity 😎
@zenangst Wow! That’s exactly the flexibility I wanted, maybe even more. So far I only thought of simple output scripts, like date, but with this we can build multiple stuff within one workflow. I haven’t fully grasped what this means finally, but it sounds really astonishing.
Could you maybe add the current window/application to the list of magic variables? I can’t think of a good example, but probably someone will come up with a workflow which inserts different text depending on the window it’s in.
Maybe like a signature in mail and it differs if you are writing the mail in Outlook vs. Mail, but with the same hotkey.
I’m really glad you got so excited about that and you got me too :)
@uwe-schwarz What information about the current window or application would you like to add?
We already support having the same keyboard shortcut mean different things depending on the app. You can configure that on a Group. So a group can be constrained to one or more application.
You can read about groups in the wiki - https://github.com/zenangst/KeyboardCowboy/wiki/Groups
@zenangst Thanks, I did know about groups, but I was just mumbling around and thinking of possibilities. I'm not sure what I (or someone else) could build with that. Remember, that I wanted basically only the current date on a shortcut :)
No worries mate 😎 Was just curious ❤️
Hey @uwe-schwarz, 3.24.0 just dropped with support for variable assignment :) https://github.com/zenangst/KeyboardCowboy/releases/tag/3.24.0
Thank you so much, I will update as soon as possible and can't wait to try all this new stuff out :)