Jump to content

MacOCD

Member
  • Posts

    11
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MacOCD

  1. Is there a way to have a snippet return the NAME of the current day of the week? Example: SATURDAY if the snippet is triggered on a Saturday? Thanks.
  2. I have 14.4.6 Installed and working on 2 different Macs. I will definitely not update them until we know there is a work around Thank you so much for your original script, it's been really useful to me.
  3. [EDIT] Having read the thread from the start it turns out that this is actually Vincent's workflow thread. I'll say then that this workflow is working for me on Yosemite 10.10.1 with Office 2011 using the method I describe below. I'm using Yosemite 10.10.1 with a KShell script called converttopdf.ksh by vdesabou (Vincent) that I'm pretty sure I hear about on these forums. It creates a PDF version of a highlighted word document in Finder in the same folder as the original .doc file. The Shell script runs a separate applescript called converttopdf.applescript for the conversion then it brings up options so that I can automatically send the newly created PDF as an email. I have a keyboard command of OPTION-CMD-P that will trigger this workflow. I use it many times a day. Vincent's Github link for his KShell script is here I'm no shell expert but I'm sure someone here can adapt Vincent's script to just convert to PDF. My workflow is to use Alfred's "run script" workflow option with a keyboard combination to trigger ksh converttopdf.ksh "{query}" in Alfred with the appropriate converttopdf.ksh and converttopdf.applescript scripts held is a workflow folder The converttopdf.applescript script as I have it (from 2013) is copy & pasted below. It could be that this is that same applescript you guys are trying to run directly from Alfred, I'm not sure if it was written by Vincent on run theQuery set these_files to {} -- Convert to PDF set keep_duplicates to "Keep Duplicates" set keep_original to "Keep Original" set microsoftWordWasRunning to "false" set text item delimiters to " " set these_files to text items of (theQuery as string) set the_counter to count of these_files set text item delimiters to "" repeat with i from 1 to the_counter set cur_file to (POSIX file ((item i of these_files) as string)) as string set file_name to (remove_extension(cur_file) & ".pdf") file_name tell application "Microsoft Word" open cur_file tell application "Finder" if exists file file_name then if keep_duplicates is "Discard Duplicates" then delete file file_name else if keep_duplicates is "Keep Duplicates" then set file_name to (file_name & "(duplicate).pdf") end if end if end tell save as active document file format format PDF file name file_name close document 1 saving no if keep_original is "Discard Original" then tell application "Finder" delete cur_file end tell end if end tell end repeat end run on remove_extension(file_name) set theCharacters to characters of file_name set theReverse to reverse of theCharacters as string set extension_length to (offset of "." in theReverse) + 1 set cut_file to (text 1 thru -extension_length) of file_name end remove_extension The converttopdf.ksh script as I have it (from 2013) is copy & pasted below, I've been using the script combination since April 2013 so the version on Vincent's Github page may well be updated/different but as it's working perfectly for me I really haven't seen any point in changing what I'm currently using. #!/bin/ksh -p #set -x #Set IFS variable to only separate on tabs IFS=$'\t' #Create an array with the tab-delimited files passed from Alfred filesFromAlfred=(`echo "$1"`) #Loop through each file in the array for file in ${filesFromAlfred[@]} do IFS=$'\n' #do something with the file filename=$(basename "$file") filedirname=$(dirname "$file") extension="${filename##*.}" filename="${filename%.*}" cp $file /tmp/tmp.$extension osascript converttopdf.applescript "/tmp/tmp.${extension}" if [ $? != 0 ] then if [ -f /tmp/tmp.${extension} ] then rm /tmp/tmp.${extension} fi echo "ERROR during conversion of $file" continue fi if [ -f /tmp/tmp.pdf ] then mv /tmp/tmp.pdf ${filedirname}/${filename}.pdf echo "${filedirname}/${filename}.pdf" fi if [ -f /tmp/tmp.${extension} ] then rm /tmp/tmp.${extension} fi done #Reset IFS to its original state unset IFS osascript <<EOT tell application "Alfred 2" to search "${filedirname}/${filename}.pdf" EOT exit 0
  4. Your Workflow is working great, thanks! I've set OPTION+CMD+P as a "Print to PDF" hotkey, ideally I'd like to add a further step that would automatically send the resulting PDF to a new message in mail.app, ready for sending. I only typically make PDF versions of .doc files when emailing. I wouldn't imagine this to be too challenging would it? Would a relative novice (like me) be able to modify your workflow like this with a little applescript Google-Fu? Thanks again for the great workflow. Mark.
  5. That fixed it, thanks I hadn't checked the languages section as I only have English installed. Suprised that having 1 language only doesn't disable "Previous Language" keyboard shortcuts defaults. I was unaware of Alfred until I saw a ScreenCastsOnline tutorial a week or so ago. I was so impressed I jumped straight in as a MegaSupporter. I've loving the extra power. I'm really looking forward to the Workflows tutorial they'll be doing soon. http://www.screencastsonline.com/search/?s=alfred Mark.
  6. I'm Running Alfred 2 on my iMac 10.8.3. I've disabled CMD+SPACE from launching Spotlight and I have that to launch Alfred instead. I've tried to do the same on my 10.7.5 Macbook (too old to upgrade to 10.8), but I am not allowed to set the Launch Alfred Hotkey to CMD+SPACE. Having had many years of launching items with CMD+SPACE I'd really like to keep that as the setting with Alfredv2. Is it possible? I have disabled Spotlight launching so that's not the problem. Any ideas? Thanks.
×
×
  • Create New...