Jump to content

luckman212

Member
  • Content Count

    50
  • Joined

  • Last visited

Everything posted by luckman212

  1. Thank you @deanishe (and @Andrew of course) Reading from the db does seem like a good way to go. I'll save this thread for reference, when I have a bit more time to work on it.
  2. Ok, well the end goal is a workflow that displays the most recent N clipboard history items and upon selecting one, "types" it to the foreground app by simulating keystrokes (AppleScript `keystroke`). The reason for this to exist is e.g. some websites don't allow copy/paste so you want to "type" something into a field. Or Remote Desktop / ARD / other remote control sessions where a "paste" doesn't always work. This might not be useful for many people but I use it all the time. Here's the workflow as it stands if you want to see: https://github.com/luckman212/alfredworkflows/blob/master/Type.alfredworkflow.zip?raw=true
  3. Trying to create a workflow that references items from the clipboard history (up to 25, 50, or more). So I want to set up the variables programmatically via a loop vs. tediously like { "alfredworkflow" : { "variables" : { ... "clip30" : "{clipboard:30}", "clip31" : "{clipboard:31}", "clip32" : "{clipboard:32}", "clip33" : "{clipboard:33}", "clip34" : "{clipboard:34}", ... } } }
  4. I assume that this is just a limitation. Created a feature request ...
  5. I have a Script Action that outputs { "alfredworkflow" : ... } JSON to set variables. The script is ruby/python and generates NNN number of "clipNNN" variables that are set to {clipboard:NNN} contents. This doesn't work. It creates the vars but they are just statically set to the literal "{clipboard:1}" etc. See related thread. It would be quite a lot better if the placeholder substitution also applied to dynamic Script Action JSON output.
  6. @deanishe that worked! So the script is: require 'json' json = {} cc = 20 for i in 0..cc do varname = 'clip' + (i).to_s clipname = '{clipboard:' + (i).to_s + '}' json[varname] = clipname end puts({ "alfredworkflow" => { "arg" => "{query}", "variables" => json }}.to_json) So now the script generates "perfect" output, BUT instead of substituting {query} and {clipboard:1} etc. values, Alfred is setting these as literal values. E.g. instead of the actual query or clipboard history contents, I'm getting the literal text "{clipboard:1}". edit: here's a python version of the same script, also suffers from the same problem of non-substituted variables import json, os obj = {} j = {} varlist = {} cc = int(os.getenv('CLIP_COUNT', 3)) for i in range(cc): varname = 'clip' + str(i) clipname = '{clipboard:' + str(i) + '}' varlist[varname] = clipname j['variables'] = varlist j['arg'] = '{query}' obj['alfredworkflow'] = j print json.dumps(obj) Seems impossible that this would be the way the Dynamic Placeholders feature was designed. Do I need to ask @Andrew ?
  7. @deanishe sorry to ask, but could you possibly nudge me in the right direction on this? I'm trying to dynamically generate the JSON to set variables using a Script Action (ruby). Got this: require 'json' json = [] cc = 20 for i in 0..cc do varname = 'clip' + (i).to_s clipname = '{clipboard:' + (i).to_s + '}' json.push( varname => clipname ) end puts({ "alfredworkflow" => { "arg" => "{query}", "variables" => json }}.to_json) Which generates almost the right output, but not quite (the variables are output as independent items in []'s instead of as direct descendants of `variables`. Any idea what I'm doing wrong here?
  8. Yep. That's what got me. A couple of example workflows featuring the JSON Object would have gone a long way. Thanks again for your help!!
  9. Wow, thanks @deanishe 🀘 Ok so here's where I got tripped upβ€” I right clicked on the configured "Args and Vars" object and selected "Copy Configuration" Then I pasted that into the JSON Config object, and it gives me this: { "alfredworkflow" : { "config" : { "argument" : "", "variables" : { "c" : "chips", "a" : "apple", "b" : "ball" } } } } As you noted, this seems to be incorrect/nonfunctional. So, not sure if this is intended behavior, or a bug...
  10. Guys, can anyone help me out? I'm trying to use a `JSON Config` object to set some variables in my workflow. But it's not working. I've read https://www.alfredapp.com/help/workflows/utilities/json/ and done as much googl'ing as I can. I made a simple test workflow that illustrates my dilemma. When setting args using `Args and Vars` (hold SHIFT) it works, but the JSON Config seemingly does nothing. Download below: JSONConfig.alfredworkflow (github) Any ideas?
  11. Thanks- I'll do that. I used to use Pastebot for clipboard history, and I also own Copied. Pastebot was nice because it also synced the history via iCloud to all my Macs, but when I got Alfred, it's clipboard was "good enough" and so I got rid of Pastebot to simplify.
  12. Thanks for the reply. Ok, I'll experiment with a custom file filter workflow. This is a minor thing, just thought it might have been a bug is all.
  13. (I don't work for Resilio nor was this sponsored in any way, just a good hearted recommendation from a happy user!) I wanted to post a suggestion to anyone looking for a reliable way to sync your Alfred prefs among multiple Macs: Resilio Sync: https://www.resilio.com/individuals/ Resilio Sync is based on Bittorrent so it syncs privately without using a public cloud, great for anyone concerned with privacy and performance. i've been using this to sync not just my Alfred prefs but lots of other things and it's been working great for a couple of years now. Right now they have a 50% coupon code going so you can get it for a great price- this is a 1 time purchase not a monthly subscription coupon code: Back2School
  14. I think I'm already doing that (screenshot below) β€” I still end up with 2 clipboard items added each time the workflow is called. I'm calling the hotkey from Contacts.app, but I've tested the behavior from other apps such as Sublime Text, Evernote etc and it's the same result. I'm linking a test workflow here so you can try it out and see what I mean. If you can get this to work I would love to know how! https://github.com/luckman212/alfredworkflows/blob/master/SpecialCopy.alfredworkflow.zip
  15. Ah ok. Yes I am familiar with the XY problem ( I don't think this is a case of it) What I am doing is triggering a "copy macOS selection" via Hotkey, then performing a trim operation on it, and copy the result back to the clipboard. I only need the final trimmed result, not the intermediate clip. So I would like to delete "{clipboard:1}" basically. Or, prevent it from ever reaching the history.
  16. @Andrew I came searching for a solution to the same problem (clipboard manipulation within a workflow resulting in duplicate/unwanted items). Is there any safer way in 2019 or with Alfred4 to do this now? Thank you
  17. @vitor Wow thank you for this guidance! I understand about the danger of unescaped vars now. Your workflow works great. I will study it and try to educate myself. Thanks for the tip about the heredoc too. I actually knew about those but for some reason I forget to use them.
  18. I'm trying to create a script filter that presents the last 3 items from the clipboard history and takes an action on them. E.g. {clipboard:0} {clipboard:1} {clipboard:2} etc. My language is bash for now (yes I know I should be using a real language, but this is just for POC) Here's what I have printf '%s\n' "<?xml version=\"1.0\"?>" printf '%s\n' "<output>" printf '%s\n' "<items>" printf '%s\n' "<item arg=\"{clipboard:0}\" valid=\"YES\">" printf '%s\n' "<title>{clipboard:0}</title>" printf '%s\n' "</item>" printf '%s\n' "<item arg=\"{clipboard:1}\" valid=\"YES\">" printf '%s\n' "<title>{clipboard:1}</title>" printf '%s\n' "</item>" printf '%s\n' "<item arg=\"{clipboard:2}\" valid=\"YES\">" printf '%s\n' "<title>{clipboard:2}</title>" printf '%s\n' "</item>" printf '%s\n' "</items>" printf '%s\n' "</output>" This does not work. It simply displays "{clipboard:0}" etc verbatim. Is there a way to access Alfred internal vars and special placeholders from within a Script Filter?
  19. macOS: 10.14.6 (18G87) Alfred: 4.0.3 b1092 I use `xattr -w com.apple.metadata:kMDItemKeywords` to add keywords to certain apps/files/folders to make searching easier. This works, but it seems Alfred has trouble when there are multiple keywords assigned. Take the example below, where I have tagged the "BackupLoupe" app with some keywords: The keywords are timemachine, machine and time. Specifying any SINGLE keyword works, e.g. Even this works, strangely (separating keywords by comma, space): But not this (space only): Or this (comma only) In "regular Spotlight" it works fine: I think this is a bug in how Alfred processes multiple keyword metadata.
  20. I tried to make the jump to Firefox last week (adblockalypse). I'm fundamentally opposed to supporting Google's omnipotence, but a few things caused me to give up (for now) and revert to Chrome. This lack of scriptability was one of the biggest ones. I have a bunch of scripts, workflows, and Automator services around browser windows. These depend on being able to reliably fetch the URL of the current browser tab. I commented on FF bug#125419 but so far no response. Nor am I hopeful that we'll see movement on this, seeing how the bug is old enough to fight & die for its country. But I will keep checking back from time to time. I hope to try the switch again later this year.
  21. I'm on 4.0.2 now - Does a section need to be added to this dialog to specifically request Calendar access?
  22. I was super excited to hear about RichText being added to the Snippets function, and one of the first things I did was try it out with Evernote. I have certain styled blocks of text that I want to always re-use in Evernote and I was hoping to use Alfred as a simple template library for these. Alas, it doesn't seem to work right. Example, here's a section (simple text/codeblock) that I wanted to make into a snippet. In EN it looks like this: I created a RichText snippet from this and then tried pasting it into a note, here's how it came out: (note the codeblock formatting is missing, there is a faint gray background separating each line of text, and the header font has changed from Arial to Times) Not sure if this is fixable from Alfred's side or if it's just a peculiarity of how Evernote deals with rich text but... it's no good 😟 For comparison, the same snippet saved in PasteBot and then pasted into EN works fine and is perfectly formatted. (Alfred 4.0.1 b1078)
  23. One thing I noticed when upgrading from v3 β†’ v4 was that I had to enable this checkbox to get the app search results I wanted. Seems like in v3 this defaulted to on but in v4 it's off by default, which may affect results:
  24. I saw Alfred4 is out today (first release!) but I didn't see anything like this in the release notes. Maybe 4.1 πŸ˜‰
×
×
  • Create New...