Jump to content

rice.shawn

Member
  • Posts

    973
  • Joined

  • Last visited

  • Days Won

    57

Reputation Activity

  1. Thanks
    rice.shawn got a reaction from dipsy in [Request] Workflow to resize window to specific size   
    The easiest way to do it is with AppleScript. Layouts uses Perl, which is harder, but faster. Here's a script from a workflow that I wrote a long time ago (before Layouts, which is what I use). You can adapt it to what you need.
    on run {query} tell application "Finder" get bounds of window of desktop end tell --- This script takes an argument and set the active window to the argument --- Options: --- (1-4) either of the four quadrants --- (5-8) any particular half of the screen --- (9) Maximized --- Get the size of the display --- send escape key: tell application System Events to key code 27 --- set query to "maxi" tell application "Finder" set x to get bounds of window of desktop set tr to third item of x -- top right corner set br to fourth item of x -- bottom right corner end tell if query = "ulq" then set thissize to {0, 0, tr / 2, br / 2} end if if query = "urq" then set thissize to {tr / 2, 0, tr, br / 2} end if if query = "llq" then set thissize to {0, br / 2, tr / 2, br} end if if query = "lrq" then set thissize to {tr / 2, br / 2, tr, br} end if if query = "lhalf" then set thissize to {0, 0, tr / 2, br} end if if query = "rhalf" then set thissize to {tr / 2, 0, tr, br} end if if query = "thalf" then set thissize to {0, 0, tr, br / 2} end if if query = "bhalf" then set thissize to {0, br / 2, tr, br} end if if query = "maxi" then set thissize to {0, 0, tr, br} end if --- set thissize to the value of query --- get the front app name tell application "System Events" set activeapp to first application process whose frontmost is true set appname to name of activeapp end tell --- set the window tell application appname to set the bounds of the front window to thissize end run If you want it always to be a fixed size, then you can just use numbers, and if you want it to work only with OmniFocus, then you can use that explicitly instead of the code to find "appname".
  2. Like
    rice.shawn got a reaction from cadegore in PowerPoint Remote   
    You need to make sure that you add the remote page. Click on the "Remote" tab in Alfred Preferences. On the left bottom side, you'll see a "+" button. You'll have three options: "Examples", "Workflows", and "Blank Page". Select "Workflows" and then select "PowerPoint Remote". That should add the Remote Page with all the buttons, and it should look like this:
     

  3. Like
    rice.shawn got a reaction from Zach in Can Alfred search the Mac Keychain   
    The Alp library has some keychain integration, if I remember correctly. So if you're good with python, look into that one.
  4. Like
    rice.shawn got a reaction from Myo Myint Aung in Can malware/virii exist in workflows?   
    As Andrew mentioned, among other things, Packal.org runs a virus scan on every workflow uploaded (using clamscan, and the virus database is updated daily), so I can assure you that there are no viruses in any workflow that clamscan can catch (early on I did test by uploading workflows with viruses, and Packal rejected them).
     
    That being said, there can still be malicious activity, but I haven't seen any workflow that has done anything bad since Alfred 2 has been out. By bad, I mean intentionally bad. The problems that Dean mentioned have happened, but the community is pretty good about finding these and then reporting them and getting them changed.
     
    S
  5. Like
    rice.shawn got a reaction from Myo Myint Aung in Packal: Workflow and Theme Repository   
    I'm happy to announce that after months of development, I'm ready to make a new workflow and theme repository available to the public as an open beta: Packal. Workflows and themes are taggable and searchable. You can add in the icons, screenshots, long descriptions, and brief ones. There are many different ways to find whatever you need there. Since this is an initial announcement, there isn't much content there yet, except for the workflows and themes that a few kind testers uploaded.
     
    Themes are stored as a simple application URL, which means there are no files to download, but, instead, they import directly into Alfred2. Workflows are scanned for viruses after they are submitted but before they are made available publicly. Workflow authors can easily update their workflows just by editing the page and replacing the workflow file there.
     
    What is even better is that Packal has its own updater for workflows. So, you have the option to update any workflows that you have downloaded from Packal.
     
    I think that these are exciting developments for Alfred, and this sort of repository is what many people have been waiting for since these forums were created.
     
    One great advantage for distributing your workflows via Packal is that you do not need to maintain your own download links for your workflows anymore, so you won't need to worry about download limits on sharing services. Another advantage is that it will receive more visibility as it is a place where people can look for workflows and themes without having to page through the impressive number of posts in these forums.
     
    So, please, head over to Packal, browse what's there, and, very importantly, submit your own workflows and themes.
     
    --Shawn
  6. Like
    rice.shawn got a reaction from hpiwzqda in Caffeinate Control v 3 Released   
    Update: rewrote the entire thing as a bash script. It's much faster now. All the links are the same. Grab it if you want. Let me know if there are any bugs. (I couldn't find any).
     
    Caffeinate Control v2 v3
     
    I just pushed a major update to my old Caffeinate workflow, and I figured I'd just start a new thread. It is a complete overhaul. Find version 2 3 on Packal.org: packal page. 
     
    Option Configuration
     
    You can configure how you want Caffeinate to work for you. Do you want to keep the system awake? Just the display? Everything? Just type "caff configure" (or "caff c"), and you can set the options easily. If you want to change how it works later, then just run the config again. Change however frequent you want!
     
    Defaults
     
    We default to "i" or just to keep the system from idling (which lets you display turn off). Just run the config and choose more options to as you please. Multiple options are available by pressing cmd while clicking.
     
    Commands
     
    Just type "caff" to get started. It will tell you the status and give you the most relevant option first.     Example Arguments "caff e" enables caffeinate indefinitely "caff d" disables caffeinate "caff 15 2" enables caffeinate for 15 hours and 2 minutes "caff 23" enables caffeinate for 23 minutes "caff 2h" enables caffeinate for 2 hours "caff configure" opens the configuration dialog "caff help" opens the help dialog. Here are some screenshots:
     
    Shows the status left in hours / minutes, depending on how much time is left. You can also see the configure and help entries in the bottom. I need to get around to uninstalling caffeine because I don't use it anymore.
     

     
    Configure the behavior of how you want it to sleep. Just select the options and press "Set Options".
     

     
    If you input one number, it defaults to minutes. If you put in two numbers, it interprets as hours and minutes.
     

     
    You can specify with arguments too. Feel free to type out the whole words "hours" or "minutes" or whatever part of them you want to.
     

     
    Here's the help, explaining it a tiny bit more. Click on "More Info..." to be taken to the caffeinate man page.
     

     
    If you get really excited about typing a lot of minutes, then we'll still let you know how many hours that is... 
     

     
     
    (edited to add more pretty screenshots.)
  7. Like
    rice.shawn got a reaction from Rosa Walton in Dynamic results   
    I'm pretty sure that Andrew didn't quite expect us to go as crazy as some of us have with these workflows when he created the infrastructure. I mean, you, Carlos, have basically rewritten Evernote on top of Evernote. Luxinate is just crazy. When I first saw the workflows, I just thought that they would be there for easier things (i.e. toggle caffeine or caffeinate). I love how much we're pushing the limits of what Alfred can do. I'd love to troll through the forums and try to get a tally of just how many apps have been obsolesced via workflows. Now, if someone could write a performant and pluggable keylogger, we could replace TextExpander. That would be rad.
  8. Like
    rice.shawn got a reaction from CJK in Workflow development   
    You've always been pretty good about keeping things organized from the get-go, which is, really, the best practice that anyone could have.
     
    While it is fun to build convoluted scripts for problems that exist either barely or theoretically (or is that just me?), it is probably a better use of your time to work on something more substantial than the build scripts.
     
    ---
     
    As for me, I'm not a Python guy, and my organization isn't nearly as good as Dean's. But, here's what I'd do if I had a standard way of doing things:
     
    Each of my workflows would have two main directories:
    1. lib
    2. scripts
     
    And each would (usually) have two scripts in the root:
    1. filter.{EXT}
    2. action.{EXT}
     
    `filter` is just whatever script filter it is in, and the `action` should probably be called router because it actually just parses the action query and calls the right script (in the scripts directory) from there. All library files go in `lib`.
     
    That works well enough for workflows written in Php, Bash, and Ruby.
     
    Ideally, I'd keep all the code in a separate folder and use some symlinks like Dean does, but I'm not well-organized to do that. It'd also help me keep all the ST3 projects laid out well.
     
    Damn. What this thread says is that I need to re-organize my computer (take the "re-" off that).
  9. Like
    rice.shawn got a reaction from jeffsui in Obscure Password   
    Alfred supports only plain text, so... no.
     
    If you want to have a password box, then you can use CocoaDialog's Secure Input.
  10. Like
    rice.shawn got a reaction from russmatney in Encode HTML Special Characters   
    Here's a quick workflow that will encode a string with its HTML special characters. There are no frills; if you select the result, then it will copy it to your clipboard.
     
    You can choose either a single character or a full string. The result is basically the same.
     
    Download HTML Special Characters from on Packal.
     
    Cheers.
  11. Like
    rice.shawn got a reaction from rigrassm in Google Translate (Languages Configurable)   
    Note: the original version of this workflow utilized an unofficial API that Google Translate exposed. Unfortunately, the Google has shut down the API. There is an alternative workflow that uses the official (paid) Google Translate API that you can find here: http://www.packal.org/workflow/translate-api. It's actually pretty cheap. 
     
    Here's a little ditty that interfaces with Google Translate. The upside of this one is that it gives you access to all of Google Translate's languages (or at least about 80 of them). You can enable/disable languages from inside the workflow.
     
    Find it on Packal.
     
    Demo:
     

     
     
    Current Languages:
    Afrikaans Albanian Arabic Armenian Azerbaljani Basque Belarusian Bengali Bosnian Brazilian Portuguese Bulgarian Catalan Cebuano Chinese Croatian Czech Danish Dutch English Esperanto Estonian Filipino Finnish French Galician Georgian German Greek Gujarati Hatian Creole Hausa Hebrew Hindi Hmong Hungarian Icelandic Igbo Indonesian Irish Italian Japanese Javanese Kannada Khmer Korean Lao Latin Latvian Lithuanian Macedonian Malay Maltese Maori Marathi Mongolian Nepali Norwegian Persian Polish Portuguese Punjabi Romanian Russian Serbian Slovak Slovenian Somali Spanish Swahili Swedish Tamil Telugu Thai Turkish Ukranian Urdu Vietnamese Welsh Yiddish Yoruba Zulu
  12. Like
    rice.shawn got a reaction from deanishe in OneUpdater — Update workflows with a single node   
    Sometimes it is near 16 hours a day. It's not quite dead yet.
  13. Like
    rice.shawn got a reaction from Wildcard in Alfred is searching directories I don't want   
    If you want to implement this feature on your own, deanishe, then you could just create a workflow that does it. You could just set it up so that you query everything using mdfind filtering for just the names. Then you could setup your own exclusion code.
     
    Basically, just use the code that you wrote above as a packaged workflow for a more targeted search.
  14. Like
    rice.shawn got a reaction from deanishe in Caffeinate Control - El Capitan & Alfred 3   
    The AS just runs a quick pop-up for the configuration, so that problem does not apply. There is no tell Alfred 2 or Alfred 3 in there (unless I'm totally forgetting something from code that I wrote three years ago -- total possibility).
     
    (Although you could get around that problem by checking to see if they are installed, and wrapping the tell statements in an if, etc...)
  15. Like
    rice.shawn got a reaction from Grug in Battery - view summary stats about your laptop battery   
    Opening Google search is just the "fallback" search, which means that the workflow failed to produce any usable results for Alfred.
     
    This happened to me as well at some point with some upgrade. To fix it, just open the file battery.sh in the workflow and, around line 81, change
    <title>$TEMPERATURE° C</title> <subtitle>Temperature</subtitle> <icon>temp.png</icon> </item> to
    <title>${TEMPERATURE}° C</title> <subtitle>Temperature</subtitle> <icon>temp.png</icon> </item> So, probably some Yosemite upgrade changed a version of Bash, and that version of Bash chokes when the degree symbol is next to a variable.
  16. Like
    rice.shawn got a reaction from humdash in Script filter if query matches regex, no keyword   
    You can't run a script filter without a keyword. Andrew wrote it this way to ensure performance; otherwise, the script would run on every key press, slowing down Alfred as it waited for the script to finish. If you installed a few workflows that ran like that, then it would slow everything down.
     
    However, there is a hack.
     
    You could set the keyword to 'http://' or to 'www.' or something like that. If you wanted it closer, then you could set the keyword to either 'h' or 'w'. If you want to query domains that might start with any letter, then you could set 26 keywords (one for each letter of the alphabet) that all run the same script filter. If you do it that way, then there are three things to remember:
     
    (1) make sure that there is no space needed to run the script (checkbox in the keyword settings)
    (2) remember that the first letter won't be in {query}, so for each script filter, make sure you prepend it to the query.
    (3) exit early and often so that you don't slow Alfred down immensely.
  17. Like
    rice.shawn reacted to deanishe in Search notes in native search app?   
    That's an entirely wrong assumption on your part. I believe exactly the same. I dare say most forum members do.
     
    However, some of us have spent a good deal of time thinking about exactly this problem, and we understand that it really isn't as simple as you assume it to be.
  18. Like
    rice.shawn got a reaction from wallace in Google Translate (Languages Configurable)   
    I could re-implement that logic. I took it out because the new one is paid, and I didn't want users to blow extra characters on the problem, but, again, I can re-implement it. Give me a couple of days. Work is crazy right now.
  19. Like
    rice.shawn got a reaction from xilopaint in Google Translate (Languages Configurable)   
    I've been way swamped. Too much so to get back to this right now. The code isn't too hard to write, but the UX part is more difficult to work out.
  20. Like
    rice.shawn got a reaction from alfredappuser in Google Translate (Languages Configurable)   
    I could re-implement that logic. I took it out because the new one is paid, and I didn't want users to blow extra characters on the problem, but, again, I can re-implement it. Give me a couple of days. Work is crazy right now.
  21. Like
    rice.shawn got a reaction from Will-i-am in Coding clean up   
    After you install the workflow, just open it up and look at the `script-filter.php`. You'll see that I've included a library called "Alphred" that I wrote that makes writing workflows in PHP much, much easier, and so that is what controls the output for the script filter. Here, the library just easily creates the XML that Alfred reads.
     
    The text to date functionality (for things like "now" or "tomorrow" or "+1 year") are built into PHP's date functionality. More specifically, they're built into the function `strtotime`, and so that does a lot of the heavy lifting.
     
    The actual conversion from Arabic to Roman numerals is done by breaking the date string (31/3/1999) into an array and then using an `array_filter` (which just applies the same function to each part). So, all we needed was a single function to convert an Arabic number to a Roman numeral.
     
    The function that does that is here:
    function toRoman( $integer ) { $output = ''; $conversion = [ 'M' => 1000, 'CM'=> 900, 'D'=>500, 'CD'=>400, 'C'=>100, 'XC'=>90, 'L'=>50, 'XL'=>40, 'X'=>10, 'IX'=>9, 'V'=>5, 'IV'=>4, 'I'=>1 ]; while ( $integer > 0 ) : foreach ( $conversion as $roman => $arabic ) : if ( $integer >= $arabic ) { $integer -= $arabic; $output .= $roman; break; } endforeach; endwhile; return $output; } So, basically it takes an associative array that defines the translations between Arabic and Roman and then just uses two loops to modify the input value while constructing an output string. Each time it adds onto the string, it removes the equivalent value from the input integer and just keeps going until the integer reaches 0 and then returns the string.
     
    Hopefully the explanation helps.
     
    I did decide to make it a script filter rather than using an Applescript input box because it makes it easier to manipulate the values quickly and see the results.
  22. Like
    rice.shawn got a reaction from Will-i-am in Coding clean up   
    I re-coded it in PHP and dropped it in a simple workflow that you can download here: https://www.dropbox.com/s/hihr5zl054wdq5u/Roman%20Date.alfredworkflow?dl=0.
     
    It works as a script filter and uses PHP's date parser, so you can do things like "rd now" and "rd tomorrow" and "rd next friday" and "rd -1000 years" as well as "Oct 29 1993" or "10/29/1993".
     
    Currently, if you press enter, it just displays it as large text.
  23. Like
    rice.shawn got a reaction from Kubaton in Caffeinate Control v 3 Released   
    Nope. That turns out not to be just on your end but on everyone's end. I had overlooked that part. Anyway, I just put in a fix. v3.03. Is available to fix that.
  24. Like
    rice.shawn reacted to deanishe in Is there an existed workflow that using full-path search?   
    http://www.packal.org/workflow/fuzzy-folders
  25. Like
    rice.shawn got a reaction from forgetfulfellow in Google Translate (Languages Configurable)   
    Note: the original version of this workflow utilized an unofficial API that Google Translate exposed. Unfortunately, the Google has shut down the API. There is an alternative workflow that uses the official (paid) Google Translate API that you can find here: http://www.packal.org/workflow/translate-api. It's actually pretty cheap. 
     
    Here's a little ditty that interfaces with Google Translate. The upside of this one is that it gives you access to all of Google Translate's languages (or at least about 80 of them). You can enable/disable languages from inside the workflow.
     
    Find it on Packal.
     
    Demo:
     

     
     
    Current Languages:
    Afrikaans Albanian Arabic Armenian Azerbaljani Basque Belarusian Bengali Bosnian Brazilian Portuguese Bulgarian Catalan Cebuano Chinese Croatian Czech Danish Dutch English Esperanto Estonian Filipino Finnish French Galician Georgian German Greek Gujarati Hatian Creole Hausa Hebrew Hindi Hmong Hungarian Icelandic Igbo Indonesian Irish Italian Japanese Javanese Kannada Khmer Korean Lao Latin Latvian Lithuanian Macedonian Malay Maltese Maori Marathi Mongolian Nepali Norwegian Persian Polish Portuguese Punjabi Romanian Russian Serbian Slovak Slovenian Somali Spanish Swahili Swedish Tamil Telugu Thai Turkish Ukranian Urdu Vietnamese Welsh Yiddish Yoruba Zulu
×
×
  • Create New...