Jump to content

dfay

Member
  • Posts

    1,054
  • Joined

  • Last visited

  • Days Won

    62

Posts posted by dfay

  1. Thanks.  I've tweaked the title/URL scripts to produce Markdown links instead -- replace the first tell block in each with

    tell application "Safari"
    	set theURL to URL of front document
    	set theTitle to name of front document
    	set selectedText to (do JavaScript "(''+getSelection())" in document 1)
    	set myCount to count (selectedText)
    	if myCount is greater than 0 then
    		set the clipboard to "\"[" & selectedText & "\"]" & "(" & theURL as string & ")"
    	else
    		set the clipboard to "[" & theTitle & "](" & theURL as string & ")"
    	end if
    end tell
    
  2. Use Applescript -- it'll be along the lines of 

     

    tell application "Alfred 2"

       search "1p mybankshortcut" (*bring up Alfred's search window with the 1password item - substitute desired item for mybankshortcut*)
      delay 2

    end tell

     

    tell application "System Events"

      keystroke return (* hit return *)
    end tell

     

    BUT you'll need to authenticate with 1password and your master password first.  If you try to script that part of the process, you'll need to enter your 1password master password in the script.  Which would be very bad.

  3. Very nice. I started extending this beyond Yosemite and Alfred. Here's how I added the ability to switch taskpaper themes as well:

     

    1. copy your current theme (found in ~/Library/Application Support/TaskPaper/Themes/ ) to a file called current.taskpapertheme

     

    2. update the AppleScript in the workflow as follows (substituting your username and your theme names (for Helvetilight-my.taskpapertheme and Helvetidark-my.taskpapertheme) in the appropriate lines):

    try
    	set guiMode to do shell script "defaults read -g AppleInterfaceStyle"
    	tell application "System Events"
    		tell appearance preferences to set dark mode to not dark mode
    	end tell
    	tell application "Alfred 2" to set theme "OS X Yosemite - larger type"
    	do shell script "cd '/Users/yourusernamehere/Library/Application Support/TaskPaper/Themes'; cat Helvetilight-my.taskpapertheme > current.taskpapertheme"
    on error
    	tell application "System Events"
    		tell appearance preferences to set dark mode to not dark mode
    	end tell
    	tell application "Alfred 2" to set theme "OS X Yosemite Dark - larger type"
    	do shell script "cd '/Users/yourusernamehere/Library/Application Support/TaskPaper/Themes'; cat Helvetidark-my.taskpapertheme > current.taskpapertheme"
    end try
    

    3. after you run the Alfred workflow, quit and restart Taskpaper.  In theory, this could be done by AppleScript, but I didn't want to figure out how to check whether iit s already running, save open files, etc.

  4. Well that site uses a post rather than get command for sending the form (you need to view the source of the web page to see this...), so it doesn't include the query in the url ordinarily. See http://www.w3schools.com/tags/ref_httpmethods.asp for a longer explanation.

    But if you view the source you can figure out that the text field where the search is entered is named SearchTxt . So the following should work for you:

    http://www.allcinema.net/prog/search_all.php?SearchTxt={query}

    Without going too deep into this you're never going to want to add a slash before the question mark. The question mark tells the server that what follows are the parameters for the search. If you put in a slash, the server would think the name of the web page is a directory. See also https://en.m.wikipedia.org/wiki/Query_string .

  5. A simpler way to do this (without the dependency on Automator) would be using a very short AppleScript, which could be called from a keyword in an Alfred workflow:

    tell application "Microsoft Word"
    	activate
    	make new document
    end tell
    

    Word (and Office in general) has some of the best AppleScript support of any apps on the Mac & it's well worth checking out -- you can automate practically every feature of the program.

     

    Incidentally the script above works with the beta (and would probably work on OS 9....).

  6. Take a look at this : http://www.alfredforum.com/topic/4570-rpn-calculator/?hl=calculator . It uses a script filter in an external python script stored in the workflow folder to give live results while it calculates, and implements an rpn calculator in < 50 lines of code thanks to the hard work of others.....If you're working in Python you definitely want to be using deanishe's workflow library. It's well worth downloading the library and working through the tutorials (a pinboard workflow).

  7. If the computer's going to be off frequently, I'd recommend going analog.  You can set the whole thing up for under $75.

     

    Here's what you'll need:

     

    a mixer that takes RCA stereo inputs ($50): http://www.bhphotovideo.com/bnh/controller/home?O=&sku=331962&gclid=CKTgn-yTtcQCFVFffgodryAAxw&Q=&is=REG&A=details

     

    2 x cables to run from the 1/8" headphone outputs on the Mac and iPhone to RCA plugs ($7 each) : http://www.bhphotovideo.com/c/search?N=11019924&InitialSearch=yes&sts=pi 

     

    an RCA cable (prices vary by length and quality): http://www.bhphotovideo.com/c/buy/RCA-to-RCA-Cables/ci/4165/N/3992462209

     

    each of the 1/8->RCA cables goes into the back of the mixer, and the mixer out goes on to your receiver via the RCA cable, while the 1/8" male connectors sit on your desk for use as needed.  Set both inputs on the mixer to the same lever, then stick it behind a bookcase and forget about it.  Plug one of the 1/8" connectors into the Mac and the other into the iPhone, & use the Mac and iPhone to get the levels right.  (Alternatively you could keep the iPhone and Mac at fixed volume levels and use the dials on the mixer to set the volume, if you want a real analog feel).

  8. Hmmm.....with an Onkyo without a network connection you'd be tied to the receiver's remote, definitely.  Unless....you get a $69 Apple TV, connect its outputs to the Onkyo, and send all your audio the Onkyo via Airplay.  (You need to have a TV to set it up, but once that's done, there's no need to power on the TV itself; the Apple TV will send its audio out to the Onkyo irrespective of whether the video signal is going anywhere).  Then just set the Onkyo volume once and forget it, and use your Mac and iPhone to control Airplay output levels.  You'd probably want Airfoil from Rogue Amoeba ($29) as well if you listen to audio on the Mac on sources other than iTunes.

     

    Getting two inputs (the Mac and the iPhone) onto the same output is going to be trickier.  I use AirServer ($14.99, which lets me use the Mac as an Airplay receiver) and I was just able to successfully get my iPhone output to play via AirServer on the Mac while iTunes was also playing on the Mac, with both playing concurrently (Arcade Fire and Johnny Cash...interesting mix...).  And then used Airfoil to pipe the System Audio out to the Apple TV and on to the receiver, which would fit the scenario you're hoping for.  I haven't tested this at length but both AirServer and Airfoil have trial versions so you could check it out.

     

    If you are willing to have your computer wired to your receiver, you could bypass the Apple TV, and use AirServer to mix iPhone output with computer output as in the second scenario.  Of course then you'd need to have the computer on all the time to relay from the phone to the receiver.

     

    This all worked for me with a late 2014 Airport Extreme, 2011 iMac, 2013 Apple TV and iPhone 5S.  In my experience with that setup, Airplay is very reliable.

     

    Alternatively you could get some cables and do it all analog with a little mixer like this: http://www.sweetwater.com/store/detail/MX400 .

  9. Another Remote use scenario I've been playing with is for multi-step music playing tasks.  This is probably better explained by example.  I have set up a remote trigger that runs a single applescript that:

     

    - turns on my Onkyo amplifier (via serial port connection to my Mac)

    - sets the input on the amp to the Apple TV (ditto)

    - sets the volume on the amp to an appropriate level

    -  adds the Apple TV to the active AirPlay devices on iTunes

    - shuffles my usual mix playlist

    - sets the computer volume to an appropriate level

    - sets iTunes volume to maxed (since the amp and computer volume settings were calibrated on this basis, & this lets me use Remote's iTunes controls to lower the volume or mute everything at once if needed)

    - starts playing the mix

     

    So I can hit one button on my phone as I head to the living room and have everything going when I enter the room.  No need to find the IR remote for the amp, fiddle with iTunes settings, etc.  Magical.

  10. Thanks for this.  I've added a couple Remote Triggers - you set up a trigger with the Argument type Text and the string as the name of the desired Airplay device, then pipe it out to the existing script in the workflow.  Works great.

  11. Well....it turns out PySerial has an issue where it sporadically causes loss of access to the keyboard, at least with my driver (see e.g. http://sourceforge.net/p/pyserial/bugs/103/ - it says it's closed there but there issue is very much alive with Yosemite). So I've bitten the bullet and gone back to AppleScript since Serial Port X has been stable for me. And I wrote a python script that did most of the work of converting Miracle2k's list of commands into a script of AppleScript properties. So after some delays I'm at a point where I can focus on the workflow itself rather than the serial port communication....it's going to be heavily customized for my setup (esp. since I'm now targeting the 16 buttons available on Alfred Remote) but the underlying parts should be easy to customize.

    Anyway I need to do some more testing after some late-night hacking but I'll post a version fairly soon.

  12. Right now, you can add alfred:ignore to Spotlight comments and Alfred will ignore them in search results.  

     

    Could this functionality be extended (or changed) to using a tag instead?  (If I'm not mistaken the use of Spotlight comments predates Mavericks.)  

     

     

  13. What's to update? This workflow consists of a 3 line Applescript:

    tell application "Fantastical"
    		parse sentence q
    	end tell
    

    All the real work is done in Fantastical.  And the parse command is the only Applescript command for Fantastical, so there's no exposed functionality that isn't being taken advantage of by the workflow as it is.

×
×
  • Create New...