Jump to content

pixelgeek

Member
  • Posts

    110
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by pixelgeek

  1. How likely is it that someone would have an app set to open HTML files that wasn’t a browser? Maybe add the frontmost app as a fallback instead?
  2. New version posted https://github.com/lolbat/Alfred-Workflow-Create-Obsidian-Link Fixed the issue with duplicated MD files Added ability to get URL from default browser and not just Safari Added config keywords
  3. So I built a series of actions that I am going to add to my Create Obsidian Bookmark action. I will be using it as a prefab in that action. Currently it has a keyword trigger but that was just for testing. It runs a shell script to get the default browser's bundle ID. duti -x .html | sed -n '3p' | tr -d '\n' This uses duti to get the default app for .html files. That returns three lines of data Safari /System/Volumes/Preboot/Cryptexes/App/System/Applications/Safari.app com.apple.Safari I only need the last one so I use `sed` to get that and then `tr` to strip off the trailing line feed. This is split and then I save the last item as the browser name and use a conditional to select the appropriate Automation Task for each browser. I've tested it in Chrome, Vivaldi, Brave, Edge, Safari and Opera and it correctly tries to get the tab title and URL. Anyone interested in this? @vitor can I export a prefab?
  4. I just wrote a quick Universal Action to run that for me. Thanks
  5. Which is enough to test for and then put up a sad dialog as I don't think you can get any data from Firefox can you?
  6. Hi all I am working on correcting some issues in a workflow I have and while I was in there tinkering I thought that I would try to divorce the workflow from Safari. I found a command line call that will read the default browser and return it but I want to get a lot of data to make sure that I have as many browsers covered. The command is: defaults read ~/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure | awk -F'"' '/http;/{print window[(NR)-1]}{window[NR]=$2}' If you are running something other than Safari could you run this command and then paste the return here so I can gather as many browser IDs as possible? Or if someone knows of where there is a list of these apps? Thanks
  7. Really? I don't have that issue here. Can you post a tree of the directory structure you were using? It shouldn't copy the link. I didn't do anything to get the URL to paste. I'll look into the other issues you mentioned.
  8. Then you need to try to set the script to be executable. Open a terminal in the directory with the script and then run sudo chmod +x newdir.py
  9. What version of Python are you using? If you are running v3 then there is an error on line 56 of the Python script os.makedirs(newdir, mode=0755) Version 3 of Python requires that the mode is set using a different Octal format. So it would need to be changed to os.makedirs(newdir, mode=0o755) Try making tht change to the script and then running it.
  10. Can you post some details about the Workflow so we can see how it i structured? Best bet is to export the Workflow and post it somewhere
  11. An updated Workflow has been posted to Github https://github.com/lolbat/Alfred-Workflow-Create-Obsidian-Link
  12. Well whatever the heck was causing the problem isn't happening now so I am not sure what I was doing. 🙂 I've updated the code to remove that parse() function call.
  13. Hi all I have a few Workflows that use a Script Filter. I have the icon showing for the results but I am still a touch confused about how the `type` options work. The documentation says: So in this instance I am unsure what "file icon for the specified path" means. The filetype code sample just points to `~/Desktop` as an example without an explanation. So how exactly does filetype work?
  14. The Discord app is written in Electron and doesn't have support for many of the Mac specific features that Alfred and other apps use to help automate requests like that. I don't even think that Discord has URL support to parse URLs internally. As @andy4222 mentions, you may want to look at using the web interface to try to do this as you can control your browser.
  15. There is this search engine https://www.nerdfonts.com/cheat-sheet
  16. I had to add that to the code because I was getting an error in Python and the path that was being supplied to my Python script had a tilde in it. I will go back and see if I can generate the error again. I will need to go back to this and re-examine it as I added some features to it. Oddly, I thought that I had posted the workflow but clearly I didn't. Weird.
  17. That is the downside to using Electron. I don't think it can and most devs don't seem to care that they are missing features like that.
  18. i posted some comments about the Workflow on my blog https://whatiswrongwithyourdog.netlify.app/posts/obsidiannotes/
  19. I have all of my bookmarks in Obsidian now and I am slowly working on a workflow to make it easier to post the links in the appropriate note. The first part was to make a script to list the notes in the vault and then open one So a super simple Python script import os import json import copy from pathlib import Path import urllib.parse vaultPathData = os.getenv("obVaultPath") vaultName = os.getenv("obVaultName") vaultPath = Path(vaultPathData) vaultPath = vaultPath.resolve() fileList = [] #first get the root level files rootFiles = vaultPath.glob('*.md') for mdFile in rootFiles: fileList.append(['', mdFile.name, mdFile.stem]) #now the files in any directories directoryFiles = vaultPath.rglob('*.md') for mdFile in directoryFiles: fileList.append([mdFile.parts[-2], mdFile.name, mdFile.stem]) #now build the JSON data # default item in JSON/dict format fileItem = { "type": "file", "title": "", "subtitle": "", "arg": "", "icon": { "type": "fileicon", "path": "./MarkdownFileIcon.jpg" } } # the JSON wrapper that we will be putting items into jsonFileList = {"items": [] } for file in fileList: thisJSONItem = copy.deepcopy(fileItem) thisJSONItem["title"] = file[2] thisJSONItem["subtitle"] = file[1] thisJSONItem["arg"] = "obsidian://advanced-uri?filepath=" + urllib.parse.quote(file[2], safe='') jsonFileList["items"].append(thisJSONItem) # print out the JSON data print(json.dumps(jsonFileList)) The arg is the Advanced URI to the specific note. The Script Filter makes a list of all of the .md files at the root of the Vault and then in each directory. It presents a list and when one is selected it is opened. So now I can quickly open the Note that stores the type of URL I want to save.
  20. To add on to what @vitor is saying. The python environment is set in the Run Script object from the dropdown. It won't respect any environment change that you set inside the script. When you set the script to be external it runs the script from outside Alfred. Alfred is no longer controlling the environment that the script runs under and so you directive to use a specific environment will then work.
  21. I wrote a short blog post about using Alfred to make it easier to export code and data files to svg using the Rich CLI python library. https://whatiswrongwithyourdog.netlify.app/posts/richsvg/
  22. The beginnings of a Workflow to allow you to create content for the Hugo blogging system. This is my own code and it can be accessed from Github https://github.com/lolbat/Alfred-Hugo-Workflow Currently there are six commands: Add: Add a new file Edit: Edit an existing file Start: Start the Hugo server Start - drafts: Start the Hugo server with --buildDrafts enabled Stop: Stop the Hugo server Date: Get a date in the Go format to use in the YAML frontmatter of content.
  23. You need to modify your CSV file so that there are three columns: Title, Subtitle and Args (you can call them whatever you want). Alfred will use the three columns to fill in the fields in the List Filter. Add a blank column between act and prompt. It will use act as the title, you can leave the subtitle blank and then it should put the prompt into the args field. Alfred just reads the three columns in the csv file and assumes that the first column is meant to be the title, the second the subtitle and the third are the args you want to use. I did something similar and posted about it in my blog https://whatiswrongwithyourdog.netlify.app/posts/alfred-workflow/
  24. Wow. Why won't they release a new binary?
×
×
  • Create New...