Quick SCP from inside Finder with Applescript

Because I own both a Macbook and a Linux desktop I frequently need to transfer files to my desktop for my laptop. This is usually a painless process of opening Terminal and typing an SCP command but I wrote a script to automate this process for me.

I use the script by first selecting the files I want to transfer and then invoke Quicksilver run “quickscp”. The script grabs the files I have selected in Finder and SCPes each one to the destination specified in the script. For this to work I first had to setup ssh keys on my desktop so scp can log in without prompting me for my password, this is essential for the transfer process to be seamless.

For non Quicksilver users I also created an Automator workflow which can be saved as a Finder plugin and then invoked by right clicking on the file -> More -> Automator -> ‘name of plugin’.

Before using either script you have to change the destination variable to the ip address or hostname of the computer you want the files to be transfered to.

quickscp.scpt Quick SCP Applescript
For use with Quicksilver. Updated December 6, 2007
quickscp.workflow Quick SCP Automator Workflow
Updated December 6, 2007

Change VLC cache preference with a Finder plugin using Automator

Over on MacOSXHints.com there is a great tip showing how to use Automator to set VLC caching delays. Something like this is great (actually essential) for anyone who watches videos or listens to music over a network share (Samba, NFS, AFP). I do this almost daily and before it was annoying because the video would be very jaggy because VLC was not caching enough of the video ahead of time. The solution to this was to change the following preference in VLC: Input / Codecs -> Access Modules -> File -> (click Advanced) -> Caching value in ms. This is a huge hassle so nclark42 wrote an automator action that changed the preference for you (that is the workflow given on macosxhints). To run that script you must first run either the network workflow or the local workflow depending on where your video is located and then open the video file which is fine but my roommate suggested that it would be nice if you could just open the file in finder and have the script set the correct preference for you.

And thus I cooked up this alternative Automator action. One is scripted in Ruby and the other is done in Applescript. They do the same thing I am just providing both is case anyone has a preference. Each script takes the following actions:

  1. Check is VLC is running
  2. If VLC is running close it and sleep for 1 second
  3. Check the path of the file, if it starts with “/Volumes” then change the caching preference to 5000 ms, otherwise set it to the default 300 ms.
  4. Sleep for another second.
  5. Launch VLC and play the video.

According to MaxOSXHints, the pauses are necessary to allow VLC to write out to the vlcrc file before we make our changes. To use the workflow, open it Automator then select File -> Save as Plugin. Make sure Finder plugin is selected and give it a name like “Open in VLC and change cache”. Finally open finder, right click on a video and select More -> Automator -> Open in VLC and change cache.

I wrote the script twice, once using Ruby and once using Applescript.  Both do exactly the same thing so just pick one and use it. I am making both available in case someone wants to look at them. I tested the scripts in OS X 10.5 but they should work with 10.4 as well. Let me know if it doesn’t.

VLC w/ Ruby.workflow VLC Cache Modifier
Ruby version. See instructions above. Updated December 6, 2007
VLC w/ Applescript.workflow VLC Cache Modifier 2
Applescript version. See instructions above. Works exactly the same as the one above. Updated December 6, 2007

← Previous Page