Jump to content

Subject22

Member
  • Posts

    171
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by Subject22

  1. I took Runar's Open in Chrome workflow and made a new version which (theoretically) behaves a bit more intelligently in situations where Safari either isn't open, or doesn't have any windows open, and which posts slightly more informative notifications. The Applescript I wrote behaves exactly as intended when run from Applescript Editor, but not when run from Alfred. If Safari isn't open it ought to simply post a notification saying as much, but the Alfred version always opens Safari in the background first. Workflow: Open in Chrome Keyword: openinchrome Hotkey: alt+g if application "Safari" is running then tell application "Safari" try set theURL to URL of current tab of window 1 set pageName to name of current tab of window 1 on error return "There are no pages open in Safari at the moment" end try end tell tell application "Google Chrome" activate if (count of windows) is 0 then make new window set URL of active tab of front window to theURL end tell # Enable this line to have notifications posted after sending URLs to Chrome #return "Opening '" & pageName & "' in Chrome" else return "Safari is not open at the moment" end if
  2. Invoking the hotkey for this workflow cleans up the icons of the currently open Finder window or the desktop (if it has focus). It was a mission and a half getting all the weird edge cases sorted out because the desktop itself (as opposed to a Finder window of ~/Desktop) is not directly scriptable. If anyone can think of a way of neatening up my code I'd love to see it :-) Download: Clean Up Icons
  3. That's not hard at all :-) Below is a version which contains a duplicate path which clears the Desktop. I considered making it possible to specify any folder, but I was concerned about the potential for disaster if someone spelled a folder's name incorrectly. This version keeps it simple. desktop clears ~/Desktop, downloads clears ~/Downloads. Download: Clear Downloads & Desktop Keywords: desktop, downloads I am now out of posts for the next 18 hours or so, so I'll get back to you with any replies tomorrow :-)
  4. No problem :-) I'm a little confused though. Key code 49 still translates to an "I pressed the space bar" command, doesn't it? I was hoping to change this: tell application "System Events" keystroke " " using command down # Edit with your own Alfred hotkey end tell To something like this: tell application "System Events" keystroke (the Alfred hotkey for this user) end tell That way this workflow would work as-is, without requiring anyone to edit it with their own, personal Alfred hotkey (not everyone uses cmd+space, of course). Perhaps I've misunderstood what you were saying though? As for using # to comment things out, I thought about the potential for confusion too, but I assumed that anyone brave enough to edit a shell script would know enough to figure that one out :-) I'm most comfortable with Python (with a dash of C and Java thrown in for good measure), and I'm used to just using the language's standard comment symbol to temporarily disable code. Are things different with shell scripts? Is there a more accepted way of disabling code, without actually removing it? Just as an aside, I'm only allowed to make one more post for the next 18 hours, so my reply may be delayed ;-) It's a little frustrating, but I understand why the restriction's there.
  5. If I understand you correctly you want to be able to open Alfred, type the name of a script (which is located somewhere on your computer), and hit enter and have Alfred run the script. Is that right? Here is a workflow that uses a file filter to search only certain file types (currently it'll only accept .py, .sh and .scpt, but it's easy to modify) in a certain search scope (currently ~/Desktop, but again, that's easily modified). To use it you type "script" and then search for the script that you want to run. When you hit enter the chosen script is passed through to a shell script which runs it (in theory ). This is just to get you started, and won't do everything you require. For example, it currently attempts to run any script passed to it with Python, Bash and osascript, so you'd need to add some if statements to make sure the right script gets run with the right language :-) I'm fairly new to all this myself, so excuse me if I've misunderstood something. That's my best guess, anyway
  6. A while back a mate managed to lock me out of my room and and proceeded to tinker with my computer while I watched helplessly through a window. I wasn't going to take that lying down so I used my iPad to airplay Liam Neeson's immortal line from Taken to the speakers in my room. My friend was suitably freaked out Since I've been having fun using Alfred 2 to automate every tiny little function on my computer I thought I might as well throw this workflow together. It uses an Applescript to: Pause iTunes if it's playing Set the computer's volume to maximum Play the audio clip Set volume and mute to their original settings Resume iTunes playback (if it was playing) To use it you'll need to edit the script in the workflow with the path to the audio file (a copy of which is bundled with the workflow). More detailed instructions: Import the workflow into Alfred Double click the Run Script tile in the workflow Click "Open workflow folder" at the bottom right Note the file path to Taken_Audio.aif (you can find this by clicking and dragging the aif into Alfred ) Back in the Run File tile, scroll to the bottom of the script and edit the path to the audio file (it's located under "# Play the clip"). It's mostly filled out for you, all you really need to add is the long string of characters from the end of the workflow folder name. Download: Taken Keyword: taken Here's a standalone copy of the audio: Taken Audio
  7. I like to keep my computer tidy and that means that I often shift the contents of ~/Downloads to the Trash. Doing things manually is so last year, so I made a simple workflow to automate the process. Download: Trash Downloads Keyword: trash downloads
  8. I was pretty happy when I discovered that you could embed images hosted on Droplr by appending a "+" to the image URL, but I ran into trouble when I tried to post something on these forums. This thread gave me the solution (append "+.png", for posterity), but I feel that things would be a bit simpler if either the forums allowed images without file types in the URL to be embedded, or if a sticky was updated to include that tip. I'm not entirely sure if this is the appropriate place to post this, but I'm sure someone will set me straight if it's not :-)
  9. Thanks! Here's a version that automatically applies the blur setting by restarting Alfred (and his preferences, if they're open) as per my Restart Alfred workflow :-) As with Restart Alfred, you can have this workflow invoke your Alfred hotkey to make Alfred show himself after a successful restart (see the linked thread for details). Download: Blur Alfred Keyword: blur
  10. Here's a quick little workflow to restart Alfred and his preferences (if they're open). Download (v1.0.2): GitHub Keyword: restart
  11. Nice workflow, looks handy :-) Is there any chance it could be modified to support sharing via Dropbox? The selected file would be copied to /Dropbox/Public (or another user-specified location) and the Dropbox URL would be copied to the clipboard, or put directly into an iMessage, email, tweet or other message. If the file was already in the Dropbox folder then the Dropbox URL would be copied to the clipboard without moving anything. EDIT: I did find this workflow, but I still wonder if you'd like to incorporate Dropbox sharing into your own workflow. Just a suggestion :-)
  12. That seems to have done the trick! I'll post back if I run into more difficulties. Cheers! :-)
  13. I thought I'd done that in my first post: "I thought it'd be handy to have an Alfred Workflow to help out with that." But this is a silly thing to disagree over. Sorry if I wasn't clear enough the first time around :-)
  14. Yeah, I want search results from both of those folders to show up side-by-side in Alfred. Essentially it'd be like a normal file search (eg: 'somefolder or 'somefile), but the search scope would be limited to just those two folders, and nothing else (i.e.: typing appsupport somefolder or appsupport somefile would give results only from ~/Library/Application Support or from /Library/Application Support)
  15. Aha. I think I've misunderstood a couple of things. Typing appsupport application support into Alfred does indeed bring up both Application Support folders. What I really want is for the workflow to return results from within both of those folders simultaneously. Is that possible? I brought the Finder window up manually, so that you could see what some valid results might be.
  16. I tried turning on unintelligent searching, but it didn't make a difference, and I'd also rather not use it (if possible). Typing the keyword works: Typing a query does not: EDIT: Made the screenshots a little less huge. Figured out how to do inline images
  17. I find myself searching ~/Library/Application Support and /Library/Application Support quite often so I thought it'd be handy to have an Alfred Workflow to help out with that. I'd like to type a keyword (eg: "appsupport") and have Alfred return results from the aforementioned folders based on whatever query follows it. This seemed fairly simple, but my attempt doesn't appear to work. It just returns results from my contacts, and then from my fallbacks. I wondered if that might be because I haven't added either of the Application Support folders to Alfred's default search scope (I don't want to see results from them by default), but adding them didn't make a difference. The only other thing I could think of was that OS X itself may not be indexing those folders (if so, I'm not sure how to go about changing that behaviour). Any help would be appreciated :-)
×
×
  • Create New...