Triplex79 Posted March 14, 2019 Share Posted March 14, 2019 (edited) Hello together, 1. i am totally new to workflows. I think what i want achieve, i could do with workflows. But i don't know how to accomplish that. I want to open with one {query} -> already what i use -> for instance Google Maps search -> open multiple pages. How is that possible? 2. How is it possible in addition top copy (to the clipboard) the opened URL's -> we opened through the workflow? All three at once, in case there are three URLs that should be opened. Thank you very much for your help! EDIT/Solution: If somebody face the same problem, Vitor had for me the solution created Thank you very much again Vitor! Edited March 15, 2019 by Triplex79 Solution Added Link to comment
vitor Posted March 14, 2019 Share Posted March 14, 2019 Welcome @Triplex79, Can you better explain what you want to accomplish and what are the steps? Typically one uses arrows to describe the next step in a sequence, but yours seems to be describing the same thing. I didn’t understand at all what you want. What is your native tongue? Link to comment
Triplex79 Posted March 14, 2019 Author Share Posted March 14, 2019 native tongue is German. But English is not a problem usually. I contacted the support already, he did understood me Party i was already some steps closer. But still something is missing. O.K. requirements are: I open with a keyword and a {query} and the same query will open three pages like in the standard workflow to see What now is missing for me, i need Alfred copy the final URL that is stated in the browser URL bar for all websites (after possible redirects) Do you know a script how i may accomplish that? Thank you in advance! Link to comment
deanishe Posted March 14, 2019 Share Posted March 14, 2019 2 hours ago, Triplex79 said: i need Alfred copy the final URL that is stated in the browser URL bar Why? What are you trying to achieve? It’s easier to resolve URLs redirects in code than trying to get them from browser tabs that may or may not have finished loading yet. Link to comment
Triplex79 Posted March 14, 2019 Author Share Posted March 14, 2019 1 hour ago, deanishe said: Why? What are you trying to achieve? It’s easier to resolve URLs redirects in code than trying to get them from browser tabs that may or may not have finished loading yet. I want to get copied all URLS after the redirect to my clipbloard like: http://www.domain1.com/ http://www.domain2.com/ http://www.domain3.com/ But exactly like they are after the redirect (if any apply) And then i have the URLS in my clipboard. Link to comment
deanishe Posted March 14, 2019 Share Posted March 14, 2019 (edited) 16 minutes ago, Triplex79 said: And then i have the URLS in my clipboard So you don't actually want to open them in a browser? You just want to resolve any redirects and copy the canonical URLs to the clipboard? You can resolve redirects with the following Python code: from urllib2 import urlopen # URL to resolve url = 'http://www.google.com' r = urlopen(url) # URL after any redirects newurl = r.geturl() Edited March 14, 2019 by deanishe Link to comment
Triplex79 Posted March 14, 2019 Author Share Posted March 14, 2019 (edited) 4 minutes ago, deanishe said: So you don't actually want to open them in a browser? You just want to resolve any redirects and copy the canonical URLs to the clipboard? You can resolve redirects with the following Python code: from urllib2 import urlopen # URL to resolve url = 'http://www.google.com' r = urlopen(url) # URL after any redirects newurl = r.geturl() Of course i open them like in the screenshot above in the browser. 1. I use a keyword that replace the query variable {query} execute a search 2. 3 tabs will open with different URLS all the same query in it - same like the movie search template in workflows Alfred already offer 3. Now i want that Alfred copy all URL's to my clipboard like i wrote above Edited March 14, 2019 by Triplex79 Link to comment
deanishe Posted March 14, 2019 Share Posted March 14, 2019 2 minutes ago, Triplex79 said: Of course i open them like in the screenshot above in the browser. I didn't ask if you are opening them: I can see that. I asked if you want to open them. Or do you just want to have the URLs on the clipboard, and the browser tabs are a side-effect of the way you've tried to build the workflow? Link to comment
Triplex79 Posted March 14, 2019 Author Share Posted March 14, 2019 Just now, deanishe said: I didn't ask if you are opening them: I can see that. I asked if you want to open them. Or do you just want to have the URLs on the clipboard, and the browser tabs are a side-effect of the way you've tried to build the workflow? Oh, ok sorry! Yes i want them to opened and afterwards the clipboard copy 🙂 Link to comment
deanishe Posted March 14, 2019 Share Posted March 14, 2019 This is pretty easy to do in code, but not via browser automation they way you have it set up. It looks like you have three URLs opening in two different browsers. Link to comment
Triplex79 Posted March 14, 2019 Author Share Posted March 14, 2019 2 minutes ago, deanishe said: This is pretty easy to do in code, but not via browser automation they way you have it set up. It looks like you have three URLs opening in two different browsers. Three URLS in 3 browser tabs -> one browser Link to comment
deanishe Posted March 14, 2019 Share Posted March 14, 2019 Have you tried Vítor's snippets for getting browser tab URLs? Of course, you'd have to get the active tab and use its index to find the two tabs before it, too. Link to comment
Triplex79 Posted March 14, 2019 Author Share Posted March 14, 2019 No, i even don't understand what i should try. I am a bloody beginner with this kind of automation! Link to comment
deanishe Posted March 14, 2019 Share Posted March 14, 2019 Which browser are you using? Chrome? Link to comment
vitor Posted March 14, 2019 Share Posted March 14, 2019 I feel like there’s some information we’re not getting. As in, why would the URLs redirect? Why can’t you just include the URLs in their final form to begin with? Either way, try this Workflow. It should do what you want. It works by first making a web request and getting the final redirect, and only then opening them in the browser (makes double the web requests, but is way easier to build than the other way around). It will copy all URLs to the clipboard separated by newlines. If you want to change the URLs, open the Run Script and change the starting lines in quotes (lines 2–4). Keep the same pattern: in double quotes, and use ${1} for the place where your query will be substituted. Triplex79 1 Link to comment
Triplex79 Posted March 15, 2019 Author Share Posted March 15, 2019 16 hours ago, deanishe said: Which browser are you using? Chrome? I use chrome Link to comment
Triplex79 Posted March 15, 2019 Author Share Posted March 15, 2019 15 hours ago, vitor said: I feel like there’s some information we’re not getting. As in, why would the URLs redirect? Why can’t you just include the URLs in their final form to begin with? Either way, try this Workflow. It should do what you want. It works by first making a web request and getting the final redirect, and only then opening them in the browser (makes double the web requests, but is way easier to build than the other way around). It will copy all URLs to the clipboard separated by newlines. If you want to change the URLs, open the Run Script and change the starting lines in quotes (lines 2–4). Keep the same pattern: in double quotes, and use ${1} for the place where your query will be substituted. Exactly what i wanted! Really cool 🙂 It works perfectly, thank you very much! 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