Jump to content

Delete Keyword from Query


Recommended Posts

First off I have to say that I don't know anything about coding and have been piecing this together using different workflows and other people's scripts. 

 

I'm trying to make a workflow that takes my selection in MacOS, decodes it using Base64 and then opens a background tab using the result of said decoding as the URL. The only problem now is that someone else's script (that I obviously don't understand at all) gives more than just the URL after decoding:

 

If the final URL would be:

facebook.com

 

My Workflow currently returns: 

<?xml%20version="1.0"?>%0A<items><item%20uid="base64%20Decoded%20(Invalid%20characters%20replaced%20with%20?)"%20arg="facebook.com"%20valid="yes"%20autocomplete=""><title>https://mega.nz/#F!pvxF2bZL?</title><subtitle>base64%20Decoded%20(Invalid%20characters%20replaced%20with%20?)</subtitle><icon>icon.png</icon></item></items>

 

So, the makeshift solution I'm trying to come up with is to delete 2 "keywords" from the query. The 2 "keywords" would be: 

 

  • <?xml%20version="1.0"?>%0A<items><item%20uid="base64%20Decoded%20(Invalid%20characters%20replaced%20with%20?)"%20arg="

and

  • "%20valid="yes"%20autocomplete=""><title>https://mega.nz/#F!pvxF2bZL?</title><subtitle>base64%20Decoded%20(Invalid%20characters%20replaced%20with%20?)</subtitle><icon>icon.png</icon></item></items>

since these are the same no matter what I'm decoding. 

 

Could someone help me with the deletion of these keywords?

 

My workflow: https://dbr.ee/mxSw

The workflow that I stole the decoding part from: https://dbr.ee/rHsF

Edited by EqualsNine
Formatting
Link to comment

First of all, thanks very much for posting your workflow and being clear about your end goal (rather than only talking about your proposed solution). You may not know how to code, but you certainly know how to ask coders questions ?

 

Here's a (hopefully) fixed version of the workflow.

 

It's actually rather simpler to do that what you've cobbled together: you'd grabbed a Script Filter script, which is designed to show a list of results in Alfred, not a script designed to pass input to an Alfred action (the latter type is much simpler).

 

As best as I can tell, however, Safari chokes on domains without a URL scheme, so the above workflow adds "http://" to the start of the decoded input if it doesn't already start with "http".

 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...