bjornelvar Posted October 20, 2022 Share Posted October 20, 2022 Hi! I want to make my objects open up web pages with Python, is there any way to do this? I would have to create urls with each iteration and inserting into the object/dictionary so every game is assigned a url. The first object in the image would for example open the game's boxscore with the user's default browser. There is no query in my script. def get_alfred_items(): results = [] url = "https://www.alfredapp.com/workflows/" for i, j in zip(scores_list, player_leaders): results.append({ "title": f"{i[0]} {i[1]} - {i[2]} {i[3]} ({gametime_list[scores_list.index(i)]})", # [home] [pts] - [pts] [away] "subtitle": f"{j[0]}: {j[1]}pts/{j[2]}reb/{j[3]}ast - {j[4]}: {j[5]}pts/{j[6]}reb/{j[7]}ast", "url": url + i[0], # I WANT TO DO THIS }) return results if __name__ == "__main__": alfred_json = json.dumps({ "items": get_alfred_items() }) sys.stdout.write(alfred_json) Link to comment
giovanni Posted October 20, 2022 Share Posted October 20, 2022 welcome @bjornelvar! assuming that you want to open the site upon actioning the result (ie pressing enter), you can pass the URL as an argument (basically replacing "url" with "arg" in your script below), and then connecting the script filter to a 'Open URL' object. This should also work as Quick Look url (tapping shift or ⌘Y, to see a preview without actioning). Link to comment
bjornelvar Posted October 20, 2022 Author Share Posted October 20, 2022 AH! Thank you!! It really was that easy. It worked. Didn't know I needed an Open URL object in my workflow. Thanks again! 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