Copy dimensions of VLC video to clipboard

From your noodle to other noodles. Talk about ways to get the most from Hazel. Even exchange recipes for the cool rules you've thought up. DO NOT POST YOUR QUESTIONS HERE.

Moderators: Mr_Noodle, Moderators

Copy dimensions of VLC video to clipboard

Postby Cottser » Wed Sep 21, 2011 10:45 am

I always need to get dimensions of videos and this is the quickest way I've come up with so far.

With this rule in place, you just need to open the video with VLC, and hit the Snapshot button (Cmd-Opt-S by default). Wait a moment, and the width and height will be copied to your clipboard with a space separating the two numbers.

The formatting of the dimensions (with a space between the width and height) allows me to "arrow into" either the width or the height from the LaunchBar clipboard manager. Feel free to change this of course. The output of the script doesn't have to be the clipboard, you could just as easily display a dialog or whatever you prefer.

Set VLC to save snapshots into your preferred folder, then add a Hazel rule to that folder.

Conditions:
Name starts with "vlcsnap-" (or whatever you've set the prefix to be)

Actions:
1. Run Applescript (mostly taken from here):

Code: Select all
try
   tell application "Image Events"
      launch
      set this_image to open theFile
      copy the dimensions of this_image to {width, height}
      close this_image
   end tell
   tell application "System Events"
      set the clipboard to (width as string) & " " & (height as string)
   end tell
on error error_message
   display dialog error_message
end try


2. Optional Growl notification to let you know the dimensions are on the clipboard.

3. You could trash the snapshot automatically as well, I don't.
Cottser
 
Posts: 1
Joined: Mon Jun 11, 2007 10:32 am

Return to Tips & Tricks/Rule Recipe Exchange

Who is online

Users browsing this forum: No registered users and 1 guest

cron


Copyright © 2006-2012 Noodlesoft, LLC, All Rights Reserved. Mac and the Mac logo are trademarks of Apple Computer, Inc., registered in the U.S. and other countries.