Module: Castanaut::Plugin::Ishowu
- Defined in:
- lib/plugins/ishowu.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
-
#ishowu_hide ⇒ Object
Hide the iShowU window.
-
#ishowu_menu_item(menu, item, quiet = true) ⇒ Object
Execute an iShowU menu option.
-
#ishowu_set_region(*options) ⇒ Object
Set the screencast to capture a particular region of the screen.
-
#ishowu_start_recording(options = {}) ⇒ Object
Tell iShowU to start recording.
-
#ishowu_stop_recording ⇒ Object
Tell iShowU to stop recording.
Instance Method Details
#ishowu_hide ⇒ Object
Hide the iShowU window. This is a bit random, and suggestions are welcomed.
73 74 75 |
# File 'lib/plugins/ishowu.rb', line 73 def ishowu_hide ("iShowU", "Hide iShowU") end |
#ishowu_menu_item(menu, item, quiet = true) ⇒ Object
Execute an iShowU menu option.
58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/plugins/ishowu.rb', line 58 def (, item, quiet = true) ascript = %Q` tell application "iShowU" activate tell application "System Events" click menu item "#{item}" of menu "#{}" of menu bar item "#{}" of menu bar 1 of process "iShowU" #{'set visible of process "iShowU" 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.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/plugins/ishowu.rb', line 18 def ishowu_set_region(*) ishowu_applescriptify = (*) ("Capture", "Capture full screen") sleep(0.2) ("Capture", "Capture custom area", false) sleep(0.2) automatically "mousewarp 4 4" drag to([:to][:left], [:to][:top]) sleep(0.2) bounds = screen_size automatically "mousewarp #{bounds[:to][:width]} #{bounds[:to][:height]}" drag to( [:to][:left] + [:to][:width], [:to][:top] + [:to][:height] ) 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.
44 45 46 47 48 49 50 |
# File 'lib/plugins/ishowu.rb', line 44 def ishowu_start_recording( = {}) ishowu_hide ("Capture", "Start capture") unless [:auto_stop] == false at_end_of_movie { ishowu_stop_recording } end end |
#ishowu_stop_recording ⇒ Object
Tell iShowU to stop recording.
53 54 55 |
# File 'lib/plugins/ishowu.rb', line 53 def ishowu_stop_recording ("Capture", "Stop capture") end |