nick_r Posted January 6, 2021 Share Posted January 6, 2021 Hi. I was wondering if anyone could help with the following bash script? It is supposed to do the following: You copy the URL of an outlook365 email. You call the workflow in Alfred It manipulates the copied URL and pastes this in your active app The link can now be clicked to take you to the email. NB sadly this only works when conversation view is turned off. I am having trouble capturing the output of the "awk" command. This is used to identify the ID of the email (the letters after the last forward slash). I've checked this on the command line, and it works fine. But it doesn't seem to work within Alfred. I think it might be to do with the use of "echo". That seemed to be the only way to capture the output of the "awk" command. The code is below, and you can try out the following URL "https://outlook.office.com/mail/inbox/id/AAMkAGYxY2E3NTk1LTE4MWEtNGM5OS05mZkLTMzZTA3YjE1ZWIzMQBGAAAAAACvq4d8nTSiTKyFrc7qQPbCBwCPfjnaKUWETJ10gdKjawcfAF5453XCAADypvc4SG%2BZQpfh%2FKsqPMSCAUqTI5OAAA%3D" (NB it won't actually take you to the email because you need to be logged on as me!) Any pointers welcome! # Get last item in clipboard query="{clipboard:0}" # Extract email id id=$(echo $query | awk -F "\/" '{print $NF}' ) # Create URL string1="https://outlook.office.com/owa/?ItemID=" string2="&viewmodel=ReadMessageItem&path=&exvsurl=1" url="$string1$id$string2" # paste echo -n $url Link to comment
deanishe Posted January 7, 2021 Share Posted January 7, 2021 Hi @nick_r, welcome to the forum. It's likely due to the configuration of your shell environment (which Alfred doesn't use). There's a bunch of other things it could be, but of course we can't say for sure without the workflow. Link to comment
nick_r Posted January 7, 2021 Author Share Posted January 7, 2021 Thanks for the rapid response. I see that I am not able to attach workflow (presumably for security reasons?), but the it's quite simple: The first module is a "Keyword" without an argument. The second module is the bash script which takes its arguments from the clipboard. The final module is "Copy to Clipboard" module which uses plain text, has the content {var:id}, automatically pastes to the frontmost app, and makes the clipboard item transient. I've provided screenshoots of the overall workflow, and the final module. Is this information sufficient? It still seems to be the case that the line with the awk command is malfunctioning even though it works fine in the shell. I've noticed that you can change the scripting language, and I've changed it to zsh which is the scripting language for the terminal, but it still keeps making this error. I think perhaps the best approach would be to rewrite this in python, which probably has better string manipulation? (NB realise these are newbie questions - this is my first workflow) Thanks N Link to comment
deanishe Posted January 7, 2021 Share Posted January 7, 2021 11 hours ago, nick_r said: Is this information sufficient? No, sorry. Please upload the workflow somewhere (Dropbox?) and post a link. It's important that we're talking about exactly the same workflow. 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