Jump to content

alfredclough

Member
  • Posts

    94
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by alfredclough

  1. Playing around more with Script filter looks like it will work. I think I can capture the input plus set a variable for which option a user clicked so I should be able to do it all in one step.
  2. Right--My question is how I can capture an argument at the same time as giving the user three selections to choose between in one step.
  3. Here's what I want to do: User selects an option in a script filter. That passes them to a second step which is a list filter where they can make a choice and optionally enter a second argument. In my case what I want to do is let someone enter a search parameter in that second step. So the second step is a list filter that gives them three choices: search, search in a new window, search in a new tab and allows them to enter a search parameter. My problem is that anytime you enter an argument in a list filter it filters the options if that makes sense, but what I want to do is let someone enter a parameter that is passed along the workflow but have a choice of how to action that parameter. I realize I could easily do this by using modifiers (shift, fn, etc) but I'd rather make it more obvious by picking the option out from a list. I haven't created it yet or I would attach the workflow--I'm looking for input on how to do this.
  4. I tried that and I can build the JSON when I run the AppleScript in Apple's script editor, but when I tried to run it using Alfred, I get the message: execution error: System Events got an error: Can’t get path of file of application process "Safari" Here's the AppleScript I'm running: on run argv tell application "System Events" set runningProcesses to (every process whose background only is false) end tell set alfredJSON to "{\"items\": [" repeat with runningProcess in runningProcesses set appName to name of runningProcess set appPath to path of file of runningProcess set alfredJSON to alfredJSON & "{\"uid\": \"" & appName & "\", \"type\": \"default\", \"title\": \"" & appName & "\",\"subtitle\": \"\", \"arg\": \"" & appName & "\",\"autocomplete\": \"insert passage\", \"icon\": { \"type\": \"fileicon\", \"path\":\"" & appPath & "\" }}," end repeat set alfredJSON to alfredJSON & "]}" return alfredJSON end run Here's a link to the workflow. I'm using Alfred 3.6 and Mac OS 10.13.3
  5. I have a workflow where I want to provide a list of applications so that an application can be selected and the workflow continue. I want a list of the current running applications so I'm using a Script Filter. My question is how can I load the icon of the app to show it in the list rather than the icon of the workflow? I can't seem to find out how to programmatically load it. Here is the AppleScript I'm using with the Script Filter: on run argv tell application "System Events" set runningProcesses to (name of every process whose background only is false) end tell set alfredJSON to "{\"items\": [" repeat with appName in runningProcesses --set appName to name of runningProcess set alfredJSON to alfredJSON & "{\"uid\": \"" & appName & "\", \"type\": \"default\", \"title\": \"" & appName & "\",\"subtitle\": \"\", \"arg\": \"" & appName & "\",\"autocomplete\": \"insert passage\"}," end repeat set alfredJSON to alfredJSON & "]}" return alfredJSON end run
  6. I used NSPasteboard. For reference in case someone else lands here, here's what I used. The first option gets the html version of what's on the clipboard, the second version gets the text (how Alfred returns the clipboard in a workflow). In the first option, you could use other formats (rtf, etc) as per Apple's documentation. from AppKit import * # Get the current clipboard directly from Mac pb = NSPasteboard.generalPasteboard() # Check if we need html format from the clipboard if ulFormat == "html": cbDirect = pb.stringForType_("public.html") else: cbDirect = pb.stringForType_(NSStringPboardType)
  7. I tried a shell script first but I was running into problems with how it escaped markdown characters. Probably easy to fix, but to be honest it's been over a decade since I did any bash scripts so it wasn't obvious to me how to fix it. I solved it by doing a python script. In the process I discovered that Alfred seems to always use the plain text version of the clipboard in workflows, so I had to use Python to pull the clipboard directly if I wanted html that had been copied instead of just text. Regardless, Python solved the problem.
  8. Here's what I'm trying to do: I frequently capture information and store it in Ulysses for research on writing projects. I typically copy/paste it into Ulysses in the appropriate group. I created a workflow to automate this via Alfred. The workflow takes the contents of the clipboard and passes it to an Openurl to use Ulysses x-callback-url to add a new sheet. So far, so good. Frequently I copy/paste content that is online, and I want to keep the url of the content for later research. In order to automate this as much as possible, I used clipboard history. I copy the url, then copy the content, then insert it into Ulysses. In order to automate this completely, I modified my workflow so that it checks the chipboard history and if {clipboard:1} is a url, it combines that url with the content on the current clipboard and then passes it to Ulysses. I used an AppleScript to do this by storing the clipboard and previous item from clipboard history into a variable, loading those variables in AppleScript and then creating a new string. Here's the problem: when I do this something is wrong with the encoding of the string and I get strange characters in it. For example, apostrophes become Ă„Ă´. Text passed through the workflow fine until I added this AppleScript. I don't know if the problem is when the AppleScript loads the variables using system attribute or if the problem is when it returns the string. I've included the AppleScript below to show what is does. Does anyone know how to get the AppleScript to encode the text properly? I tried using Run NSApplescript instead. It seems to properly encode the text, but the problem is that I cannot find a way to pass the clipboard contents since it doesn't read workflow variables and as far as I know, can't access the clipboard history. If an NSApplescript action could access the clipboard that would be an ideal solution. on run argv set theQuery to item 1 of argv set cbCurrent to (system attribute "cb_current") set cbPast to (system attribute "cb_past") set httpPrefix to "http" set newQuery to theQuery if cbPast starts with httpPrefix then set newQuery to theQuery & "\n" & "%% Source: " & cbPast & "\n" & cbCurrent else set newQuery to theQuery & "\n" & cbCurrent end if return newQuery end run
  9. I can see the usefulness, but right now it's not a big factor for me. The fact that searching groups searches the group tree enables me to drill down pretty quickly to child groups if that makes sense. There is one enhancement that would help me a bunch--the ability to open a sheet or a group in a new Ulysses window. I uses Ulysses for enough things that I frequently need to open something but not lose the sheet I have open already. I have a work around, but it would be great to have a modifier key or something that enabled opening a selected group or sheet in a new Ulysses window.
  10. Just want to say this workflow is amazing--it makes working with Ulysses so much more efficient.
  11. This feels like it should be simple, but can I create an Alfred workflow to add a keyboard shortcut for a menu item in an application. For example, in the same way you can go into System Preferences under App Shortcuts and you can create a keyboard shortcut for a specific application by giving it a menu item name, can you do the same in an Alfred workflow? I know this should be simple but I've done some searches and haven't found an example to do this.
  12. Sorry about that. Link has been updated.
  13. Sorry about that - I updated the link.
  14. Great catch. The linked file for the workflow has been updated.
  15. Sorry, I don't have Sierra so I'm not sure what the problem would be.
  16. Hmm. The workflow is working just fine for me. I'm on the latest version of Alfred and OSX.
  17. You have to make sure you have allowed Alfred full access to control the computer. This is a new future in recent versions of OS X. There are other posts on the forums covering how to do this.
  18. This workflow add an action to what you can do to a file or folder. You have to select a folder and then you can use the action.
  19. I believe you have to have Mavericks for it to work.
  20. I'm not sure how to accommodate that, it's simply an Applescript that feeds what you enter to Calendar. Perhaps someone with programming skills could determine why it's interpreting what you enter incorrectly.
  21. I'm not having any problem and I've tried it repeatedly. The problem may be that it looks like you are using "cal" as a keyword. This extension is triggered by the keyword "newevent". If you are trying to passing something directly to the Calendar application then maybe that's what's causing the problem.
  22. I understand that. I'm just looking for a quick way to access mounted drives in the same way that the eject command allows you to easily access a mounted drive. I'll write up a little extension.
  23. Ok, it sounds like they cannot be accessed with any of the default searches. I may create an extension to browse them then.
  24. Before I look at creating a workflow, I wanted to see if there was any way build into Alfred to select a mounted volume. I know the "eject" keyword works with any mounted volume, but I don't see an easy way to select any mounted volume if I wanted to open it in finder or search it for files.
×
×
  • Create New...