brunogrande Posted January 27, 2013 Posted January 27, 2013 In Alfred v1, I had a simple AppleScript that created a new file in Finder's frontmost window: tell application "Finder" to make new file at (the target of the front window) as alias I'm trying to get it to work in Alfred v2 and I simply can't. I also tried alternatives, like this one, which uses Bash instead (from Mac Tuts), but nothing successful: myPath=$(osascript -e 'try' -e 'tell application "Finder"' -e 'set this_folder to (the target of the front window) as alias' -e 'set this_folder to POSIX path of this_folder' -e 'return this_folder' -e 'end tell' -e 'end try' -e 'set this_folder to POSIX path of (path to desktop)' -e 'return this_folder'); cd $myPath; touch newfile Can someone point out what I'm doing wrong (or perhaps the Beta hasn't reached that point yet)? Also, if someone would like to lend a hand, all I want is a workflow that allows me to create a file. If you really want to have fun, an optional keyword argument which can specify the filename (and extension) would be even better. Thanks in advance, Bruno jovotrox 1
phyllisstein Posted January 27, 2013 Posted January 27, 2013 Can someone point out what I'm doing wrong (or perhaps the Beta hasn't reached that point yet)? Also, if someone would like to lend a hand, all I want is a workflow that allows me to create a file. If you really want to have fun, an optional keyword argument which can specify the filename (and extension) would be even better. Here's what I put together: http://d.pr/f/KbzM Use the keyword "touch" followed by a filename to create that file in the frontmost Finder window. "touch add" allows you to store commonly-used filenames for later access through Alfred's new feedback system.
Carlos-Sz Posted January 31, 2013 Posted January 31, 2013 If you want to code yourself, here is an example to create a text file with clipboard content using osascript in a easier way rather than -e: http://d.pr/f/5Jp7 I’m still learning and studying some advanced workflows around here like the “touch” from phyllisstein.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now