Mafraja Posted October 7, 2017 Share Posted October 7, 2017 Hi everyone, I am a brand new Alfred user and I love it! However, it's my first time customising a workflow and tailoring it to my needs, and I'm a little perplexed. Now I found a perfect script for my use (on this forum btw, thank you!) that allows me to put together and then open an URL by defining a set of argument: query="{query}" arg1=$(echo $query | cut -d " " -f 1) arg2=$(echo $query | cut -d " " -f 2) arg3=$(echo $query | cut -d " " -f 3) arg4=$(echo $query | cut -d " " -f 4) url="https://www.domain.com/$arg1/$arg2/$arg3/$arg4/" open "$url" Now in my particular case, I would like that if the value of $arg4 is, for example, "vws", it be automatically replaced with "video-with-sound", and then url would open with that full value. The goal is for me to be able to use shortcuts when the values would be very intricate to type out. Is that something that would be doable? I would greatly appreciate some help and/or guidance. Thank you very much in advance! Link to comment
vitor Posted October 7, 2017 Share Posted October 7, 2017 (edited) Welcome @Mafraja. This should work. arg1="$(cut -d ' ' -f 1 <<< "${query}")" arg2="$(cut -d ' ' -f 2 <<< "${query}")" arg3="$(cut -d ' ' -f 3 <<< "${query}")" arg4="$(cut -d ' ' -f 4 <<< "${query}")" [[ "${arg4}" == 'vws' ]] && arg4='video-with-sound' open "https://www.domain.com/${arg1}/${arg2}/${arg3}/${arg4}/" But next time, please post the actual Workflow you’re working on. We can’t properly help you without access to it. Read the Reporting Problems with Workflows topic, as it gives a nice overview on how to build an effective report. Edited October 7, 2017 by vitor Link to comment
Mafraja Posted October 8, 2017 Author Share Posted October 8, 2017 Thank you @vitor, this worked perfectly! Noted on the need to post the actual workflow, I read the topic you linked and will know better next time. vitor 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now