Jump to content

ClintonStrong

Member
  • Posts

    115
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by ClintonStrong

  1. I haven't looked in to it much, but would it be possible to add checkmarks to the menu items? I see it's commented out in the code (kAXMenuItemMarkCharAttribute), just wondering if it's something that might be added in the future. Also, it was a bit confusing when I tried to action a menu item that was disabled. I had to check the menu bar to figure out why it wasn't working. Should they just be excluded from the results, or maybe prefixed with "Disabled: "?
  2. Considering there are already other workflows to search Safari's history, it may not be a bad idea to exclude them. Another idea is to do the searching in Objective-C, and limit the results from there. Not sure how feasible that would be though, or how much that would actually affect performance.
  3. Very cool, thanks. It works great for most apps, but it's still pretty slow for Safari (takes 2-3 seconds), probably due to the large number of menu items in History. Still very useful so far.
  4. Maybe try loading the page with the 4 digit code, and if there was an error, load the page with the 3 digit code. You can then store the results of that in a cache file so it doesn't have to wait for a page request every time it runs.
  5. The easiest way to install terminal-share would probably be to install the gem. Just open Terminal, enter the following command, and enter your password when prompted: sudo gem install terminal-share That should get it working.
  6. I personally use '=', but I didn't think it was a good default. I thought it might confusing if you typed '=' and got both the built-in calculator and the workflow's calculator at the same time. You can always change it though. Since it's essentially just a frontend for bc, I doubt it'll get too many advanced features. I'm still looking in to using (or perhaps creating) another parser, so it could be a possibility in the future. For now I'd probably just go with WolframAlpha for those kind of calculations.
  7. Nice workflow. Just had one problem: I had to modify the workflow to use the last 3 digits of my serial number in the URL to get the machine name. Otherwise, the curl request just returned this, and caused no results to show: <?xml version="1.0" encoding="utf-8" ?><root><error>0009</error><locale>en_US</locale></root>
  8. An alternative calculator for Alfred 2, supporting custom functions and variables, automatic parentheses matching, and percentages. It also supports k, m, and b (or thousand, million, and billion) as suffixes on a number. It's essentially a wrapper around bc with a few extras added in. Installation Simply download the workflow and open the file. You'll need to have the Powerpack to install workflows. Default functions I've tried to add support for most of the functions from Alfred's advanced calculator. Supported functions: sin, cos, tan, log, log2, ln, exp, abs, sqrt, asin, acos, atan, sinh, cosh,tanh, asinh, acosh, atanh, ceil, floor, round, trunc, rint, near, dtor, rtod, pow, logx, mod, min, max. Most of these should be similar to the implementation of Alfred's advanced calculator, but there are a few additions: pow(x, y) can be used to raise x to the power of y, without the integer limitations of the ^ operator in bc. logx(base, x) lets you get the log of a number with a defined base (log calculates with a base of 10 and log2 with a base of 2). mod(x, y) performs the modulo operation. dtor(d) and rtod® converts between degrees and radians (this is part of Alfred's calculator, but I'm documenting them here since googling them doesn't turn up useful results). Defining custom functions and variables After using the workflow at least once, you can find the custom functions/variables file at "~/Library/Application Support/Alfred 2/Workflow Data/com.clintonstrong.QuickCalc/custom.txt" Here's an example custom.txt file: define f2c(q) { return (q - 32) / 1.8}define c2f(q) { return 1.8 * q + 32}tax = 8.25%vat = 20% In this case, I just defined some functions to convert between celsius and fahrenheit, and set up some variables to use in calculations. It uses the syntax of GNU bc. Known bugs and limitations When using functions that take multiple arguments, use both a comma and a space to separate the arugments. This is necessary since commas and spaces can be used as thousands separators. For example, use min(5, 10) instead of min(5,10). Because percent signs % are used for percentages, you'll need to use the mod function for modulo. For example: mod(10, 3)evaluates to 1. Due to limitations with bc, the exponentiation operator (^ or **) doesn't allow numbers to be raised to the power of a float (a number with digits after the decimal place). To get around this, you can use the pow function. For example, pow(2, 2.5) evaluates to 5.6568. Percentages don't work as expected within functions. They still get converted (by dividing by 100), but it doesn't work correctly with addition and subtraction (100 + 10% evaluates to 100.10 rather than 110). Percentages should still work fine outside of functions. The workflow currently doesn't have support for detecting locales. It expects a period . to be used as a decimal point, with commas, underscores, or spaces as optional thousands separators. More info bc OS X Manual Page bc programming language on Wikipedia phodd's collection of functions, some of which are used here. Changelog Apr 17, 2013: Added 'x' for multiplication. Bugfixes. Fix for Ruby 2.0.0/Mavericks.
  9. Oh, sorry about that. When you use `bundle install --standalone`, it creates a folder called 'bundle' in the current directory and installs the gems there. If you add `require 'bundle/bundler/setup.rb'` to your file, it'll set up the paths to the gems even if Bundler isn't installed.
  10. Have a look at Duane Johnson's install_gem.sh script to easily install gems in the workflow's directory. You could also look in to using Bundler and running `bundle install --standalone --clean` after setting up your Gemfile (this is what Zhao Cai's ruby template uses). Bundler basically lets you declare all your dependencies in one file so you can easily install/update them all at once.
  11. Here you go: dterm-ish.applescript I'm playing around with making this into a workflow, so you can run scripts in the background and get file/command suggestions while you type. It's not ready yet, but hopefully that custom terminal script holds you over for now.
  12. Hm, it shouldn't be opening a browser if it isn't already running. It just looks for "Google Chrome.app" in the process list (`ps ax`), but maybe there's a background process running that it's picking up. I tried making the search a bit more specific to make sure the browser itself is running, and not just a helper app. Let me know if that fixes it. (Updated download link in the original post.)
  13. I did some more testing, and it looks like I misreported the error. When a script filter returns either an empty set of XML results (like what I posted above) or any other output that isn't valid, Alfred continues to show those old results, rather than clearing them. However, if I wait a bit and type another character, Alfred clears the results. I'm not sure if this is intentional or not. If it is, should script filters display an item with a title of "No results found." instead? That gets around the issue, but you don't get the fallback searches like you normally would when no results were found.
  14. Nice script. Just want to point out that you need "Enable access for assistive devices" checked in the Accessibility preference pane for this to work. Generally, it'll work with apps that display a little document icon in the menu bar. It should work fine in text editors like Sublime Text or TextMate, but I've had trouble getting the proper AXDocument in Xcode -- not sure if there's a way around that in AppleScript. It might also be useful to get the selection in Finder rather than the open folder, but you'd have to figure out a way to deal with multiple selected files. Edit: Oh, and if you wanted to turn this into a workflow, you could just add something like `tell app "Alfred 2" to search "$filename"` to view the file in Alfred.
  15. Here's a screenshot of the results I get (when I hit multiple keys at the same time): To make sure it wasn't just my workflow, I made it write the query to last_query.txt and the XML output to last_output.xml. Here's the XML output from the command I ran to get that screenshot: <?xml version='1.0'?> <items/> Despite returning XML with no results, Alfred was still showing a result. Edit: There shouldn't be anything special about my workflow. I tried it with David's Faves workflow, and I get the same behavior: I type a query, but Alfred doesn't update its results to reflect that query.
  16. I'm using v2.0.2 (178) on OS X 10.8.3. When I type quickly, Alfred doesn't update its results to reflect that query. Alfred still runs the script filter with the correct query, it just doesn't display the updated results. I noticed this mostly seems to happen with slow scripts, like those that load network resources. To replicate it, I just made a simple workflow that waits half a second before outputting the XML, and filters them based on your query. If I type "asdf" slowly, it shouldn't match any results. However, if I type it fast (or if I just mash all the keys at the same time), it shows the results as if I had only typed the first letter ("a"). (You can download the workflow here.) I confirmed that the script filter is being run with the correct query and is displaying the correct output (it writes to last_query.txt and last_output.xml in the workflow folder), but it looks like Alfred isn't keeping up and doesn't update the results. Edit: Just to clarify, you can check last_query.txt and last_output.xml in the workflow folder after running it to see what the correct output should have been.
  17. From my experience, the Help menu doesn't "learn" which menu items you use the most, unlike Alfred. Just another reason I'd like to see this done in Alfred.
  18. Someone's already made a Pocket workflow, but it requires the Pocket app to be installed, and it opens the app if it wasn't already running. Not the most ideal solution, but a workflow using the Pocket APIs would take a bit of work (AFAIK, the developer would need to run a web server to get it working with OAuth).
  19. Change line 74 of recent_downloads.rb to: results.first(40).each do |path| You can change 40 to however many results you want it to display. A better solution would be to add a setting in the config.yaml file, but this is just a quick patch.
  20. I noticed that this workflow was taking a little while to display the results. I did some testing and it looked like the slowdown was from rendering the XML for so many results (I had 276 files/directories in my downloads folder). When I limited the results to 20 or 40 (which is the max amount of results Alfred can show for its built in file search), it loaded about 3 times faster. Just a quick suggestion.
  21. Just a quick suggestion for the color picker: You can show the color picker with any application, not just Finder. You could even use Alfred 2 in the `tell` command. The main benefit is that it won't show any unrelated windows with the color picker, and you can easily bring it back up by invoking Alfred. This pretty much replaced the color picker application I used to use. Clicking the magnifying glass icon in the color picker replaces apps like ColorSnapper. Pretty cool.
  22. I like it. Only thing I'd suggest is maybe adding a subtitle showing the status of the user ("This contact is away.").
  23. Are you displaying any dialogs in your script? osascript doesn't allow user interaction (such as dialogs), however you can wrap them in a tell block to get it working correctly: tell application "System Events" activate display dialog "It worked!" end tell If that doesn't fix it, make sure you're using the correct language in the script action (should be bash or zsh). If it still isn't working, you can try running the command from the Terminal, and see what errors it might be outputting.
  24. It should be wired up to support both a keyword and a hotkey. The default keyword is "tabs".
×
×
  • Create New...