Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by mklement0

  1. E.g., searching for "Dunbar's number" correctly shows the preview of the Dictionary.app article, but submitting the entry in order to display it in Dictionary.app quietly fails - a blank page is shown. Omitting the apostrophe (single quote) - searching for "Dunbar number" - works as expected.
  2. Note: This is not a workflow, but a helper CLI (command-line utility) geared toward Alfred users who manage development of multiple workflows intended for sharing. I suggest installing via the npm registry, if you have Node.js installed - if not, consider installing it just to benefit from its great package manager, npm; try curl -L http://git.io/n-install | bash ): [sudo] npm install -g awf Alternatively, here are instructions for manual installation. Note, however, that the npm-based installation makes updating to a newer version much easier. Below is a high-level overview; you can find the full manual in the repo's Usage chapter, or, once installed, you can execute awf help (concise overview), awf help all (full manual), or awf help <sub-command>. ------ awf (Alfred Workflow) is an OS X CLI for managing and assisting in the development of workflows for command-line launcher Alfred 2. It comes with a broad range of features: Note: Some features related to Alfred Preferences.app involve GUI scripting and therefore require that the application running awf - typically, Terminal.app - be granted access to accessibility features - you will be prompted for authorization on first use; for more information, see Apple’s support article on the subject. Retrieving information about workflows List all workflows or workflows matching a filter, optionally with selectable output fields.awf list -s i net.same2u. # list matching workflows by bundle ID substring Print information about a given workflow.awf info net.same2u.speak.awf Locating workflows Locate a workflow’s installation folder by its bundle ID.awf which net.same2u.speak.awf # prints installation folder path Reveal a workflow’s folder in Finder.awf reveal net.same2u.speak.awf Trigger a keyword search for workflows in Alfred Preferences.awf search speak Editing workflows Change to a workflow’s folder in Terminal.awf cd net.same2u.speak.awf # opens a tab in a new window Open a workflow in Alfred Preferences for editing.awf edit net.same2u.speak.awf awf edit # from a workflow source folder Installing and exporting workflows Install a (copy of a) workflow from a source folder.awf install . Export a *.alfredworkflow archive from a source folder.awf export . # exports to '*.alfredworkflow' in same folder by default Developing workflows Note: The purpose of the following features is to allow you to store workflows being developed in a separate location instead of directly among the installed workflows. A symlink to the dev location placed among the installed folders ensures that you can still use and develop the workflow from within Alfred and Alfred Preferences. These features move directories, create symlinks, and delete files. Care is taken not to accidentally overwrite or delete files, but use these features with caution and always create backups. Symlink a dev folder (source folder) into the folder of installed worklows or remove a dev folder’s symlink.awf link . # effective installation without moving the directory awf unlink . # remove a symlink - effective uninstallation Move an existing, regular workflow to a dev folder in a different location and replace the original workflow folder with a symlink to the dev folder.awf todev net.same2u.speak . # move to current folder and perform 'awf link' Conversely, move a dev folder back to the folder of installed workflows as a regularly installed workflow.awf fromdev . # -k keeps the source folder Manage workflow version numbers via file version.awf version patch # bumps the patch component of the workflow's version number
  3. The workflow comes with two distinct feature groups: Speak the active application's text with a specific voice; useful for multilingual setups where you want to have text spoken in one of several languages on demand. For instance, you could have one global keyboard shortcut for speaking text in English, and another one for Spanish. Speak specified text with one or more voices, selectable by name(s) or language(s); useful for interactive experimentation with multiple voices, such as to contrast regional accents. For details, see the repo. Here's the direct download link to the most recent stable version (this link will remain current). However, I suggest installing via the npm registry, if you have Node.js installed - if not, consider installing it just to benefit from its great package manager, npm; try curl -L http://git.io/n-install | bash ): [sudo] npm install -g speak.awf The advantage of this installation method is twofold: Remembering only the package name is sufficient to install the workflow (again). More importantly: It's easy to update the workflow to its latest version: [sudo] npm update -g speak.awf If the latest version is already installed, no action is performed.
  4. Below is a fairly robust AppleScript that uses tel:// to prepare a call and then presses the Call button using GUI scripting (Alfred needs to be authorized once via System Preferences > Security & Privacy > Accessibility). It's trivial to adapt it to using facetime:// or facetime-audio:// instead. In my case I've assigned it to an /usr/bin/osascript Run Script action attached to a Contact Action trigger named 'Instantly call with iPhone' in a custom workflow, and I've associated that contact action with the Phone field in Alfred Preferences > Features > Contacts > Custom Actions. (I've also created a variant for FaceTime Audio calls and assigned it to the Email field.) Thus, when I press ↩ on a contact's phone number in Alfred, an iPhone call is instantly started. (And when I press ↩ on a contact's email address, a FaceTime Audio call is instantly started.) # Open the URL, which will present the click-to-call window. # Note: Replace 'tel:' with 'facetime:' or 'facetime-audio:' for FaceTime Video / Audio do shell script "open tel:" & quoted form of "{query}" # Wait until the click-to-call window appears. # Note: # If FaceTime wasn't running, that window will be the first and only one to appear. # Otherwise, that window is presented quickly enough to be the front (and only) # window by the time we try to click the button below. my syncActivateWithWindow("FaceTime") # Click the 'Call' button to start the call. tell application "System Events" to click button "Call" of front window of application process "FaceTime" # --- # *Synchronously activates* the specified application *and waits for at least one window to open*. # I.e., when this subroutine returns, the specified app is frontmost with a window open. # Required, because on 10.10+ the activate command is *asynchronous*. # Set TMOUT to adjust the timeout after which an error is raised. # CAVEAT: Works with non-AppleScriptable apps, but assumes that the application *process* name is the same as the application name. on syncActivateWithWindow(appName) local TMOUT, elapsedSoFar set TMOUT to 5 # secs. set elapsedSoFar to 0 tell application appName activate repeat while not frontmost if elapsedSoFar > TMOUT then appName & " failed to activate within " & TMOUT & " seconds." delay 0.1 set elapsedSoFar to elapsedSoFar + 0.1 end repeat tell application "System Events" # Note: We check for windows in the "System Events" context so as to also work with non-AppleScriptable apps. tell application process appName repeat while true if elapsedSoFar > TMOUT then error "No " & appName & " window appeared within " & TMOUT & " seconds." try front window of it exit repeat end try delay 0.1 set elapsedSoFar to elapsedSoFar + 0.1 end repeat end tell end tell end tell end syncActivateWithWindow
  5. - It stopped working with the very same contacts that it used to work with? If they're different ones, there may be a problem with their formatting: try retyping the number from scratch in the contact-card field. - On your iPhone, is Settings > FaceTime > iPhone Cellular Calls still turned on? Can you still *accept* calls on your Mac?
  6. By "modal" query type I mean one created by connecting a hotkey directly to a script filter, or by calling an external trigger directly connected to a script filter. (Alfred then show's that script filter's icon (in place of Alfred's) and directs all input to that script filter - no keyword is being shown.) As an aside: is there an established/better name for this? - Currently, the typed-query history (pressing up-arrow or, if turned on, having the last query automatically redisplayed) doesn't work in such modal queries at all. - Similarly, query strings entered in a modal query do not get recorded even in the general history. It would be helpful to have a *query-type-specific* (scoped) typed-query history in that event. I.e., when you enter such a modal query again, only *that* query's history is presented. In addition or alternatively, query strings from modal query types could be included in the general history, prefixed by their script filter's keyword (if defined). ------ I realize that I could alternatively define a hotkey to simply open Alfred with a keyword, giving me regular queries that become part of the history, but I quite like the separate mode / scope that is entered for modal query types - and it does open the door for a scoped history. Example use case: I have a modal query for searching Evernote that I activate with a hotkey. Having access to past queries there - limited to queries of that type - would be handy.
  7. Great tip. Note that the // part is optional, tel:{query} will do. On a related note, facetime:{query} (audio+video) and facetime-audio:{query} (audio only) work as well. A caveat, though it may unique to my setup: among my contacts I found phone numbers with no-break spaces (Unicode 0xa0; UTF-8: 0xc2 0xa0) instead of regular spaces - these won't work.
  8. As of v2.4 (279) If a workflow name contains words in parentheses/curly braces/square brackets, searching for the word immediately following the opening parenthesis/curly brace/square bracket doesn't work in Preferences (Workflows tab). Example: Say you have a workflow with the following name: Ask Different (StackExchange site) Searching for any of these words in isolation in Preferences works, EXCEPT for "StackExchange", seemingly because it immediately follows the "(" - the same applies to "{" and "[" - possibly to others. Perhaps this is related to use of regular expressions behind the scenes? If you simply insert a space after the opening parenthesis/curly brace/square bracket, the word is found again.
  9. @chadv: Thanks for investigating and letting me know. Shame indeed, especially given that it hasn't been fixed in OS X 10.10 (the current public beta), which still ships with the same libiconv version (1.11). Curiously, 3- and 6-byte UTF8 emoji sequences as well as those 7-byte sequences that start with an ASCII char. byte (followed by combining characters) do work properly, but the majority of emoji (4-byte sequences) do not. On a side note, Terminal.app, while *rendering* emoji as expected, doesn't handle them properly in terms of cursor placement, printing the next character, and backspacing. 6-, 7-, 8-byte sequences seemingly involve combining characters, and are misinterpreted as comprising *2 or 3* characters, which has all sorts of unwanted side effects.
  10. @Andrew's normalise utility works great, but I've since found that there is an alternative using the standard utility iconv with the (somewhat obscurely named) UTF8-MAC encoding scheme: Note: The following examples use bash. iconv expects its input via a filename or stdin. Applied to the example above: # Converts NFD form of 'й' to NFC form iconv -f UTF8-MAC <<<'й' Some background: The following examples use input string 'ü' in NFC form, $'\xc3\xbc' - i.e., bytes 0xC3 0xBC, which is the UTF8 encoding of Unicode codepoint 0xFC in NFD form, $'u\xcc\x88' - i.e., a u - the base character - followed by bytes 0xCC 0x88, which is the UTF8 encoding of Unicode codepoint 0x308, the so-called combining diaeresis (¨). to demonstrate converting; note that in Terminal the result will always appear as ü - pipe to hexdump -C, for instance, to see the byte values. # NFC -> NFD iconv -t UTF8-MAC <<<$'\xc3\xbc' # -> $'u\xcc\x88' # NFD -> NFC iconv -f UTF8-MAC <<<$'u\xcc\x88' # -> $'\xc3\xbc' These conversions are safe to use in that if the input string is already in the target format, it is left as is.
  11. @Andrew: Just an FYI (given that your `normalise` CLI solved the problem): using `iconv -t ASCII/TRANSLIT` to replace accented characters with their base form, as described in the stackoverflow.com answer you linked to, does NOT work properly on OS X as of 10.9.2. For instance echo 'aüé' | iconv -f UTF8 -t ASCII//TRANSLIT yields 'a"u'e' rather than 'aue'.
  12. > That's what computers work with Not consistently: OS X has reported base-10 numbers with respect to drive capacity (in line with manufacturers' specs.) since Snow Leopard (10.6). Confusion exists, but it can be avoided by using distinct unit names for the base-10 and base-2 definitions: GB (gigabyte)= base 10 = 10 ^ 9 GiB (gibibyte [sic]) = base 2 = 2 ^ 30 (analogous distinction for KB/KiB, ...) This distinction was adopted by the IEC (International Electrotechnical Commission) and "the IEC Standard had been adopted by the IEEE, EU, and NIST." Source: https://en.wikipedia.org/wiki/Gigabyte
  13. Thanks - works great now; my pleasure, Andrew; thanks for a great app.
  14. Thanks, Vero - works great. +1 on Carlos' suggestion re 'uid' as an element, too. Carlos, I'm afraid I don't understand the Quick Look suggestion. Do you mean having Alfred show the value of 'arg' in the result list if there's no 'title' or 'subtitle' element? What other workflow tasks do you mean?
  15. Thanks, Vero. It works in principle, but the prefix isn't passed through if there's no selection in the frontmost app. Is that the intent? I'd rather see it passed through unconditionally.
  16. Very nice. Suggestion: add support for US-style feet-and-inches specs., commonly used in (human) height measurement; common forms are: 5ft 7in 5'7 5'7" Also, how about showing the unit categories even before a number is typed? That would enable direct browsing of them.
  17. [OBSOLETE - superseded by speak.awf] Uses OS X’s TTS (text-to-speech) feature to speak text aloud. It is especially useful if you handle many voices, possibly in multiple languages - note that OS X allows on-demand download of voices in other languages. Examples say # Speak the default voice's demo text. say I speak, therefore I am. # Speak the specified text with the default voice. Selection by voice name say @ # Show list of active voices on typing @; submit to speak demo text in all voices. say @alex # Press Opt-Return to make Alex the default voice. say @alex I'm Alex # Speak "I'm Alex" with voice Alex. sayalex I'm Alex. # ditto say I'm Alex @alex # ditto say First Alex, then Jill. @alex,jill # Speak first as Alex, then as Jill. Selection by language say #es # Show list of Spanish voices, regardless of regional accent; i.e., both 'es_ES' (Spain) and 'es_MX' (Mexico) say y ahora en español #es # Speak text with Spanish voices. say Pottery #enie,enza # Speak text with Irish and South African English voices. Download Direct download link: https://dl.dropboxusercontent.com/u/10047483/Say%20-%20Speak%20Text.alfredworkflow Supports updating via Alleyoop. Also available via http://alfredworkflow.com. Features Aside from speaking text with the default voice, offers the following features: Voice selection, optionally with voice-name and target-language filtering. Ability to speak text in sequence with multiple voices. Rich, dynamic feedback (name of default voice, voice languages, demo text). Have selected voices speak their demo text. Makes Alfred redisplay with the same query for interactive experimentation. Make a new voice the default voice directly from Alfred. Option to open System Preferences to manage voices and TTS options. Option to use a hotkey to speak the selected text in any application using the default voice (while OS X has such a feature built in, using Alfred is preferable in that it also works with non-native applications). Dependencies Developed and tested on OS X 10.8.3; possibly works on 10.7 and 10.6, too.Usage Note: The workflow uses the set of active voices, as defined in System Preferences. Active voices are those selected for active use, and are typically a subset of the installed voices. Thus, if you want to make an installed voice available to the workflow, make sure it is checked when you go to System Preferences > Dictation & Speech, anchor Text to Speech, list System voice:, and select list item Customize.... Omitting text always speaks the demo text for each voice. The workflow uses a single keyword, say: Speak text with default voice Simply specify the text to speak; e.g. say I speak, therefore I am. To speed things up, no voices are offered by default; type @ or # before or after the text to speak to show the list of active voices (see below). Using single and double quotes, even unbalanced, is supported. After submitting a command, Alfred redisplays with the same query to facilitate experimentation. Speak text with voice selection / filtering Type @ or # before or after the text to speak to see the list of active voices. Type @{voiceNameOrPrefix} to filter the list of active voices by name; e.g.: @alex Optionally, you can append the name directly to the keyword (no space); e.g.: sayAlex Matching is case-sensitive; omit spaces for voice names with embedded spaces. Type #{langIdOrPrefix} to filter the list of active voices by language ID; e.g.: #en If you just type #, you’ll see the language identifier of each voice in parentheses. Matching is case-sensitive; you can omit the _ character, e.g., enus to match en_US. You can even use multiple, ,-separated specifiers; e.g.: @alex,jill You only need to type as much of a name or language as is necessary to filter the list down to the desired result. You can also auto-complete based on the selected result, but this only works for single-token specifiers. Whenever more than one voice matches, the first result item offers to speak the specified (or demo) with all matching voices, in sequence. Make a voice the default voice Whenever a specific voice is selected in the result list, simply hold down Option while pressing Return to make that voice the default voice. A notification will indicate success. Configuration Typing just say, with no arguments, shows an additional command: Manage Voices Opens the System Preferences application’s Dictation & Speech pane where the set of active voices - including on-demand download of additional voices - and other TTS options can be managed. Bonus track: CLI voice The workflow folder contains a command-line utility named voice, which can be used stand-alone to provide much of the functionality the workflow offers, notably the ability to change the default voice and to speak text using multiple voices. Invoke it with -h for help. Changelog 0.1 (20 May 2013): initial release
  18. Thanks, David, but I wasn't talking about hotkeys, but *action modifiers* - the modifier keys you can assign - effectively combined with `Return` - to modify what happens when *a script-filter result is actioned*.
  19. Another use case: For workflows that opt in, keep Alfred open indefinitely. For instance, I have a text-to-speech workflow that I'd like to play with iteratively: Type in a word or phrase, have it pronounced - without closing Alfred. Rinse and repeat. I know that for now I can use AppleScript to redisplay Alfred, but it would be nicer if it didn't close to begin with (which avoids flashing). On a related note, it would be nice to control what part of the command line is preselected on actioning (and continued display). In the described use case it's desirable to pre-select all *arguments* for instance - allowing either easy replacement or modification of existing arguments. With current (Alfred 2.0.3) AppleScript support, the cursor is invariably placed at the *end* of the specified query, with nothing selected.
  20. Similar request here: http://www.alfredforum.com/topic/1790-provide-a-hotkey-to-pin-alfred-on-top-temporarily/?hl=%2Bkeep+%2Bopen#entry9393
  21. For advanced workflows it would be nice to be able to specify *combinations* of modifier keys when specifying action modifiers for workflow connections. For instance, allow an action modifier based on holding down *both* the Option and the Shift key. (I know there's potential for conflict with global hotkeys, such as Cmd-Opt-Return for the iTunes mini player.) Currently (Alfred 2.0.3), you're limited to a single modifier key.
  22. As of Alfred 2.0.3: Create a hotkey trigger Select action `Pass through to workflow` Select argument `Selection in OS X` *or* `OS X Clipboard contents` Enter a text prefix When this hotkey is pressed, the prefix is ignored - it is not prepended to the OS X selection / clipboard content - only the selection / clipboard text is passed on to the next workflow step. I'm not sure these combinations were ever *meant* to work, but the UI currently allows them. I can see how these combinations are useful, though: For instance, you could use the prefix text to pass a flag to the next workflow step signal[l]ing that input was provided via hotkey (+selection/clipboard content).
  • Create New...