Module: Castanaut::Plugin::Ishowuhd

Defined in:
lib/plugins/ishowuhd.rb

Overview

This module provides primitive support for iShowU, a screencast capturing tool for Mac OS X from Shiny White Box.

iShowU is widely considered a good, simple application for its purpose, but you’re by no means required to use it for Castanaut. Simply write your own module for Snapz Pro, or ScreenFlow, or whatever you like.

Shiny White Box is promising much better Applescript support in an imminent version, which could tidy up this module quite a bit.

More info: www.shinywhitebox.com/home/home.html

Instance Method Summary collapse

Instance Method Details

#ishowu_hideObject

Hide the iShowU window. This is a bit random, and suggestions are welcomed.



76
77
78
# File 'lib/plugins/ishowuhd.rb', line 76

def ishowu_hide
  ishowu_menu_item("iShowU HD", "Hide iShowU HD")
end

#ishowu_menu_item(menu, item, quiet = true) ⇒ Object

Execute an iShowU menu option.



61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/plugins/ishowuhd.rb', line 61

def ishowu_menu_item(menu, item, quiet = true)
  ascript = %Q`
    tell application "iShowU HD"
      activate
      tell application "System Events"
        click menu item "#{item}" of menu "#{menu}" of menu bar item "#{menu}" of menu bar 1 of process "iShowU HD"
      #{'set visible of process "iShowU HD" to false' if quiet}
      end tell
    end
  `
  execute_applescript(ascript)
end

#ishowu_set_region(*options) ⇒ Object

Set the screencast to capture a particular region of the screen. Generate appropriately-formatted co-ordinates using Castanaut::Movie#to.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/plugins/ishowuhd.rb', line 21

def ishowu_set_region(*options)
  ishowu_applescriptify

  options = combine_options(*options)

  ishowu_menu_item("Edit", "Edit Capture Area", false)
  sleep(0.2)
  automatically "mousewarp 0 0"
  drag to(0, 0)

  automatically "mousewarp #{options[:to][:left]} #{options[:to][:top]}"

  drag to(
    options[:to][:left] + options[:to][:width],
    options[:to][:top] + options[:to][:height]
  )


  sleep(0.2)
  hit Enter
  ishowu_hide
end

#ishowu_start_recording(options = {}) ⇒ Object

Tell iShowU to start recording. Will automatically stop recording when the movie is ended, unless you set :auto_stop => false in options.



46
47
48
49
50
51
52
53
# File 'lib/plugins/ishowuhd.rb', line 46

def ishowu_start_recording(options = {})
  # ishowu_hide # iShowU preference
  ishowu_menu_item("Edit", "Record")
  sleep(3)
  unless options[:auto_stop] == false
    at_end_of_movie { ishowu_stop_recording }
  end
end

#ishowu_stop_recordingObject

Tell iShowU to stop recording.



56
57
58
# File 'lib/plugins/ishowuhd.rb', line 56

def ishowu_stop_recording
  ishowu_menu_item("Edit", "Stop")
end