Jump to content

deanishe

Community Hero
  • Content Count

    6,657
  • Joined

  • Last visited

  • Days Won

    383

Everything posted by deanishe

  1. Here: The script I gave you expects you to pass in the URL to open from a previous workflow element.
  2. Yeah. The script is apparently trying to check for Catalina, but those sys variables don’t actually exist. I think it’s unnecessary, anyway. You can just run open -j -a Contacts and it will work regardless of where the application is.
  3. Almost nobody understands AppleScript. It's an insane language and it's profoundly incapable. It lacks the most rudimentary features that every other language ever has (like the ability to generate valid JSON, for example). Broadly speaking, you're just making your own life more difficult by using it (because it can't do anything). It's the programming equivalent of trying to build things with half-melted Duplo blocks.
  4. Read the thread stickied at the top of this forum.
  5. Python 2 and Python 3 are not particularly compatible with each other. To get any non-trivial program to work with both takes quite a lot of effort. My library does not work with Python 3, and f-strings (f"{blah...}") are not supported in Python 2. You need to pick one version of Python and stick with it. At this point, Python 3 is probably the better choice.
  6. If you’re using Catalina, then no it doesn’t. It’s actually in /System/Applications. Finder lies a lot about where files actually are and what they're called. Go check /Applications in Alfred or Terminal.
  7. JXA is a pretty big mess, imo, but if you need to generate JSON, it beats AppleScript hands-down. If you're coding in AppleScript, then absolutely. It's an awful language. JavaScript is not a good language, either, and JXA is a particularly awful flavour of it. You should seriously consider learning a language like Ruby or Python before coding in AppleScript and/or JavaScript gives you too many absolutely bonkers ideas about programming.
  8. Fixum won't fix it: it only fixes some problems in a library that are unrelated to the workflow's own functionality. "It still just opens FaceTime" isn't an actionable description of a problem. Check Alfred's debugger. See if there's an error being reported. Check if FaceTime is being called with an actual name or number.
  9. Yes, but you’d have to combine all the text-generating elements in one workflow, collect their output as variables, and then combine them in an Arg and Vars element or Copy to Clipboard Action using {var:...} macros.
  10. Yeah, like I said, I think that’s actually UTF-16, which is no good. It’s something like «class utf8» for UTF-8. It's not odd, tbh. The problem is the JSON you're generating isn't correct because the library you're using isn't very good. Just use JavaScript: function run() { const app = Application('Music') let playlists = ObjC.unwrap(app.sources['Library'].userPlaylists) let items = [] for (let i = 0; i < playlists.length; i++) { let p = playlists[i] items.push({ title: p.name(), uid: p.name() }) } return JSON.stringify({items: items}) }
  11. I don’t think AppleScript uses UTF-8. It’s MacRoman by default. You could try retrieving playlist names with _playlist's name as Unicode text (though I think that's actually UTF-16), but the simple answer is “don’t use AppleScript”. It doesn’t support JSON natively, and that library you’re using is really buggy. Use JXA instead. It has real JSON support.
  12. You set up your Snippet Trigger and script to generate whatever text, then in the Copy to Clipboard action it's connected to, you compose your snippet, e.g.: {query} {snippet:\hellomsg} {snippet:\thanksmsg} ({query} is the output of the previous action.)
  13. Sounds like it. You can’t trigger a snippet by putting its keyword in another snippet. You have to actually type the keyword to trigger a snippet. Alfred 4.1 (currently in pre-release) allows you to embed snippets in other snippets (using the {snippet:...} macro—you still can’t just write the other snippet’s keyword), but it doesn’t include Snippet Triggers. That’s not really feasible, as a Snippet Trigger might do anything. You can do it the other way around, however, and use the {snippet:..} macro in a workflow triggered by a Snippet Trigger.
  14. You probably don't want to open Terminal. It's a poor way to do any kind of automation because once you've sent the command to Terminal, you have no way of knowing what happened next. Your workflow won't wait for the command to complete; it will just continue as soon as it has handed the command to Terminal. Alfred's Run Terminal Command action is generally only useful for launching commands that have a UI. In most cases, you'll get better results using a normal Run Script action with Language = /bin/bash or /bin/zsh. Do you want it to select a specific WiFi network, or show a list of available ones in Alfred? The Chrome scripting is possible, but a bit tricky. You'll have to use AppleScript/JXA to create the new window, and I believe there's also a command to tell it to wait until the page has loaded, but to click on the button, you'll probably have to inject some JavaScript into the page. There are other ways, but that's the most reliable.
  15. Hi @Tate4963, welcome to the forum. It was probably this workflow.
  16. I've merged your thread with that (now this) one. Better to keep the discussion in one place.
  17. What do you mean? In any case, FSNotes isn't scriptable, so all you can do is activate it and fire simulated keypresses at it to create a new note. The following AppleScript will activate FSNotes (launching it if need be) and create a new note. Put it in a Run Script action with Language = /usr/bin/osascript (AS) on run tell application "FSNotes" to activate tell application "System Events" -- wait up to 5 seconds for FSNotes to activate repeat 100 times set _name to name of first process whose frontmost is true if _name = "FSNotes" then -- show main window keystroke "\\" using command down -- create new note keystroke "N" using command down exit repeat end if delay 0.05 end repeat end tell end run
  18. It's not just PHP that's being removed. See the existing thread:
  19. Yeah, I know it's Spanish. I wrote that I don't speak Portuguese for the same reason I said that "dente azul" is Spanish. Thanks, I know. I know enough French and Latin to get the gist of what they're saying.
  20. No. You need to contact the application's developer and ask them to make the app tag the data it puts on the clipboard appropriately.
  21. Run NSAppleScript executes your code in Alfred's own process, on its main thread, so it shares Alfred's own environment. Run Script executes your code in a separate subprocess, so Alfred can manipulate the environment it runs in (i.e. adding workflow variables to the environment). Basically, just don't use Run NSAppleScript. Because it runs on Alfred's main thread, it blocks Alfred while the code is running (Run Script doesn't). And it behaves weirdly, too.
  22. You can't set UIDs and impose ordering at the same time. What might work for you is only setting UIDs if there's a search query. That way, you can have your informational item at the top (and other items in a predictable order), but still train Alfred to associate specific items with specific queries. No, but if you do the above, your default results should be in a predictable order, and you can also omit the invalid/informational items when there's a query.
  23. Right. That's probably the workflow/Alfred firing ⌘C at the app to get the selection. It doesn’t need automation permission to use copy/paste. If it did, the spell function wouldn’t work either. Something else is wrong. What does Alfred’s debugger say?
×
×
  • Create New...