Jump to content

dfay

Member
  • Posts

    1,054
  • Joined

  • Last visited

  • Days Won

    61

Posts posted by dfay

  1. "If it works in a script but doesn't work in Alfred, it's always something about the Path settings. Every time."

     

    http://www.alfredforum.com/topic/4959-enoent-path-issues-bash-nodejs/?hl=%2Bbash+%2Bpath

     

    I'd take a look at the above - and search this forum for bash path - this comes up a lot and is probably a candidate for a FAQ.

     

    From the error message you're getting I'd be pretty sure that the script when run from Alfred doesn't know the path to wp.

  2. In Spotlight results displayed in the Finder (though not in the new Yosemite Spotlight interface), tags with colors appear next to the filename, e.g.

     

    finder%20tags.png

     

    Would it be possible to get the tag colors to also appear in Alfred results?

     

    I have a Hazel script backing up stuff to Dropbox automatically and applying a red tag to it, so I can easily distinguish the backup from the original in search results.  I don't want to exclude the backup directory from Spotlight.  So it would be great if Alfred would display the tag colors like the Finder does.

     

    thanks

    Derick

     

  3. If you're going to explore UI scripting in Applescript, this pair of approaches to finding how to refer to items will be a huge help:

     

    http://hints.macworld.com/article.php?story=20111208191312748

     

    http://apple.stackexchange.com/questions/40436/how-to-know-the-name-of-ui-elements-using-accessibility-inspector-or-any-other

     

    The first one there is my preference - that's how I found the anchor and the checkbox in the script above.  Have fun with it!

  4. call this applescript:

     

    tell application "System Preferences"

    activate

    reveal anchor "Privacy_LocationServices" of pane id "com.apple.preference.security"

    authorize pane id "com.apple.preference.security"

     

    end tell

     

    tell application "System Events"

    click checkbox "Enable Location Services" of group 1 of tab group 1 of window "Security & Privacy" of application process "System Preferences" of application "System Events"

    end tell

     

     

    There may be a better way, but Applescript UI scripting (with the authentication when required) is the only way I see to programmatically access Location Services.  If you know of another, calling the script in a workflow is trivial.

  5. I'd recommend this workflow as an alternative, unless you need to include the Google Image search terms in the links you post: http://www.alfredforum.com/topic/935-workflowshorten-url-support-googl-bitly-tcn-jmp-isgd-vgd/?hl=bitly#entry9644

     

    It's a general purpose URL shortener offering your choice of shortening services.  

     

    And for the opposite direction: http://www.alfredforum.com/topic/4843-resolve-canonical-urls-from-shortened-urls/

  6. Ok....another one, in case this is useful for someone else.  The workflow stopped working again and was throwing an error after flashing the first few results:

     

    PCDATA invalid Char value 28

     

    This is caused by an invisible character which is legal in BibTeX but not in XML .  I found it by opening the XML in TextWrangler and searching for \x1C (hexidecimal equivalent of 28), and deleting the character from the corresponding BibDesk entry.

     

    Now the workflow works again.

     

    Again, downloaded BibTeX has all kinds of dirt scattered in it.

     

    Perhaps this would be a nice addition to the workflow:

     

    http://lsimons.wordpress.com/2011/03/17/stripping-illegal-characters-out-of-xml-in-python/

  7. Hmm....that is a file that seems to exist in some people's Alfred installations and not others.  The workflow checks for its existence, and if it doesn't exist, it defaults to All.

     

    Could you try adding a category in Alfred prefs., and/or changing a category?  I'm not sure what it takes for Alf to generate this file.

  8. Could you clarify the relationship between the files?

    i.e. there is a separate unique spreadsheet for each Word document?

    or there is a standard spreadsheet that gets inserted into each Word document?

    or there is a single Word document describing the rubric into which you want to insert a spreadsheet as well?

     

    If the calculations aren't complicated, as you suggest, this might be more easily done by using calculations within a table in Word, rather than trying to deal with moving from Numbers to Word.  Directions here are for Word for Windows but they are basically the same on the Mac:

     

    http://www.brighthub.com/computing/windows-platform/articles/15649.aspx

  9. Yeah, I just tested it and the Keynote 5.3 version works in Safari with one line (selecting Individual Slides in Keynote) commented out.  Here's the script (I also deleted some if statements that would never be true in Safari, just to clean it up, and added your code to render in Reader):

    -- Safari
    
    tell application "System Events"
    	tell application process "Safari"
    		set frontmost to true
    		
    		repeat until window 1 exists
    		end repeat
    		
    		# Render page in Safari Reader
    		keystroke "r" using {command down, shift down}
    		
    		delay 0.02
    		
    		-- Print; wait until the sheet is visible	
    		click menu item "Print…" of menu 1 of menu bar item "File" of menu bar 1
    		
    		repeat until sheet 1 of window 1 exists
    		end repeat
    		
    		set thePopUp to first pop up button of sheet 1 of window 1 whose description is "Presets"
    		click thePopUp
    		click menu item "Default Settings" of menu 1 of thePopUp --replace if desired with your preferred preset
    		
    		click menu button "PDF" of sheet 1 of window 1
    		click menu item "Save as PDF…" of menu 1 of menu button "PDF" of sheet 1 of window 1 -- Save as PDF...
    	end tell
    end tell
    
  10. You're on the right track here with UI scripting - just need to figure out what parts of the print dialog you need to click.

     

    I did this for Keynote, here: https://github.com/derickfay/keynote-to-pdf

     

    You might be able to re-use some of the code - look at the Keynote 5.3 version - as I recall that print dialog was the standard OS X print dialog as it would also appear in Safari....they customized it in Keynote 6.

     

    It takes some patience and trial-and-error, but it's a task I had to do a couple times a day and it was worth it.

     

    These two tools are very helpful for UI scripting:

     

         applescript - How to know the name of UI elements using Accessibility inspector (or any other tool) - Ask Different

     

         Finding Control and Menu Items for use in AppleScript User Interface Scripting - Mac OS X Hints

×
×
  • Create New...