castanaut 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,14 @@
1
- == 1.0.0 / 2008-02-21
1
+ == 1.1.0 / 2010-02-26
2
+
3
+ * Replaced the gem/rubyforge packaging cruft with a gemspec and rake task.
4
+ * IRB support (see README). [metavida / joseph]
5
+ * Added click_menu_item function. [topfunky]
6
+ * Added basic TextMate plugin. Name is textmate to comply with Castanaut
7
+ expectations. [topfunky]
8
+ * Added wait_for_element method [metavida]
9
+ * Added perform method for organization. [topfunky]
10
+ * Keystroke method using special keys if necessary. [jlsync / topfunky]
11
+
12
+ === 1.0.0 / 2008-02-21
2
13
 
3
14
  * Initial release.
data/README.txt CHANGED
@@ -5,16 +5,16 @@
5
5
 
6
6
  == DESCRIPTION:
7
7
 
8
- Castanaut lets you write executable scripts for your screencasts. With a
9
- simple dictionary of stage directions, you can create complex interactions
10
- with a variety of applications. Currently, and for the foreseeable future,
8
+ Castanaut lets you write executable scripts for your screencasts. With a
9
+ simple dictionary of stage directions, you can create complex interactions
10
+ with a variety of applications. Currently, and for the foreseeable future,
11
11
  Castanaut supports Mac OS X 10.5 only.
12
12
 
13
13
  == SYNOPSIS:
14
14
 
15
15
  === Writing screenplays
16
16
 
17
- You write your screenplays as Ruby files. Castanaut has been designed to
17
+ You write your screenplays as Ruby files. Castanaut has been designed to
18
18
  read fairly naturally to the non-technical, within Ruby's constraints.
19
19
 
20
20
  Here's a simple screenplay:
@@ -31,12 +31,12 @@ Here's a simple screenplay:
31
31
  say "I drew a square!"
32
32
 
33
33
  With any luck we don't need to explain to you what this screenplay
34
- does. The only thing that might need some explanation is "say" -- this has a
35
- robotic voice speak the given string. (Also: all numbers are pixel
34
+ does. The only thing that might need some explanation is "say" -- this has a
35
+ robotic voice speak the given string. (Also: all numbers are pixel
36
36
  co-ordinates).
37
37
 
38
38
  About the robot: no, we don't recommend you use this in real screencasts for
39
- a large audience. Most people find it a little offputting.
39
+ a large audience. Most people find it a little offputting.
40
40
  You are free to contravene our recommendation though. You
41
41
  can tweak the robot in the Mac OS X Speech Preferences pane.
42
42
 
@@ -46,7 +46,7 @@ Simply give the screenplay to the castanaut command, like this:
46
46
 
47
47
  castanaut test.screenplay
48
48
 
49
- This assumes you have a screenplay file called "test.screenplay" in the
49
+ This assumes you have a screenplay file called "test.screenplay" in the
50
50
  directory where you are running the command.
51
51
 
52
52
  Of course, it isn't always convenient to drop to the terminal to run your
@@ -57,7 +57,7 @@ You need to add this line (the "shebang" line) at the top of your screenplay:
57
57
 
58
58
  Then you need to set the screenplay to be executable by running this command
59
59
  on it:
60
-
60
+
61
61
  chmod a+x test.screenplay
62
62
 
63
63
  Again, substitute "test.screenplay" for your screenplay's filename.
@@ -68,25 +68,38 @@ it with Quicksilver, or run it any other way that floats your boat.
68
68
  === Stopping the screenplay
69
69
 
70
70
  If you want to abruptly terminate execution before the end of the screenplay,
71
- you just need to run the 'castanaut' command again -- with or without any
71
+ you just need to run the 'castanaut' command again -- with or without any
72
72
  arguments.
73
73
 
74
- Of course, that might be easier said than done, if you haven't got full
74
+ Of course, that might be easier said than done, if you haven't got full
75
75
  control of the mouse or keyboard at the time. One recommendation is to assign
76
76
  a system hot-key to invoke castanaut. I use a Quicksilver trigger for this,
77
77
  assigned to Shift-F1, that calls castanaut. You'll need the full path to
78
- the command for this, which is usually /usr/bin/castanaut, but you can check
78
+ the command for this, which is usually /usr/bin/castanaut, but you can check
79
79
  it with the following command:
80
80
 
81
81
  which "castanaut"
82
82
 
83
+ === Running interactively with IRB
84
+
85
+ You can now run Castanaut interactively from IRB — to test commands, try stuff
86
+ out, etc:
87
+
88
+ $ irb -r 'castanaut'
89
+ >> irb Castanaut::Movie.spawn
90
+ >> move to(100, 100)
91
+ => "Moving mouse.\n"
92
+
93
+ Note that this technique creates an IRB subsession, so you'll have to exit out
94
+ of that before exiting out of IRB. There's heaps you can do with subsessions -
95
+ read up about them online.
83
96
 
84
97
  === What stage directions can I make?
85
98
 
86
99
  Out of the box, Castanaut performs mouse actions, keyboard actions,
87
100
  robot speech and application launches.
88
101
 
89
- For a complete overview of the built-in stage directions, see the
102
+ For a complete overview of the built-in stage directions, see the
90
103
  Castanaut::Movie class.
91
104
 
92
105
  === Using plugins
@@ -96,9 +109,12 @@ and verbose. Plugins allow you to extend the available dictionary with
96
109
  some additional convenience actions. Typically a plugin is specific to an
97
110
  application.
98
111
 
99
- Castanaut comes with several plugins, including Castanaut::Plugin::Safari for
100
- interacting with the contents of web-pages, and Castanaut::Plugin::Ishowu for
101
- recording screencasts using the iShowU application from Shiny White Box.
112
+ Castanaut comes with several plugins, including
113
+
114
+ * Castanaut::Plugin::Safari for interacting with the contents of web-pages
115
+ * Castanaut::Plugin::Ishowu for recording screencasts using the iShowU
116
+ application from Shiny White Box.
117
+ * Castanaut::Plugin::Textmate for opening files to specific line numbers.
102
118
 
103
119
  To use a plugin, simply declare it:
104
120
 
@@ -114,7 +130,7 @@ To use a plugin, simply declare it:
114
130
  click
115
131
  pause 4
116
132
  say "Oh. I was hoping for more results."
117
-
133
+
118
134
 
119
135
  In the example above, we use the two methods provided by the Safari module:
120
136
  url, which causes Safari to navigate to the given url, and to_element, which
@@ -123,7 +139,7 @@ the screen.
123
139
 
124
140
  === Creating your own plugins
125
141
 
126
- Advanced users can create their own plugins. Put them in a directory
142
+ Advanced users can create their own plugins. Put them in a directory
127
143
  called "plugins" below the directory containing the screenplays that use
128
144
  the plugin.
129
145
 
@@ -134,12 +150,19 @@ your own.
134
150
 
135
151
  * Mac OS X 10.5
136
152
 
153
+ or
154
+
155
+ * Mac OS X 10.4
156
+ * The Extras Suite application <http://www.kanzu.com/main.html#extrasuites>
157
+
137
158
  == INSTALL:
138
159
 
139
160
  Run the following command to install Castanaut
140
161
 
141
162
  sudo gem install castanaut
142
163
 
164
+ If you're using Mac OS X 10.4 (Tiger) you will also need to download and install the XTool scripting additions.
165
+
143
166
  Once installed, you should run the following command for two reasons:
144
167
 
145
168
  castanaut
data/bin/castanaut CHANGED
File without changes
data/cbin/osxautomation CHANGED
File without changes
@@ -1,7 +1,7 @@
1
1
  module Castanaut
2
2
  # All Castanaut errors are defined within this module. If you are creating
3
- # a plugin, you should re-open this module in your plugin script file to
4
- # add any plugin-specific exceptions (it's also a good idea to have them
3
+ # a plugin, you should re-open this module in your plugin script file to
4
+ # add any plugin-specific exceptions (it's also a good idea to have them
5
5
  # descend from CastanautError).
6
6
  module Exceptions
7
7
  # The abstract parent class of all Castanaut errors.
@@ -13,7 +13,7 @@ module Castanaut
13
13
  class ScreenplayNotFound < CastanautError
14
14
  end
15
15
 
16
- # If Castanaut::Movie#run sees a non-zero exit status from the shell
16
+ # If Castanaut::Movie#run sees a non-zero exit status from the shell
17
17
  # process, this error will be raised.
18
18
  class ExternalActionError < CastanautError
19
19
  end
@@ -28,5 +28,16 @@ module Castanaut
28
28
  # this exception.
29
29
  class OSXAutomationPermissionError < CastanautError
30
30
  end
31
+
32
+ # Raised within Compatibility layers if the requested method or options are
33
+ # not supported by the current operating system.
34
+ class NotSupportedError < CastanautError
35
+ end
36
+
37
+ # Allows you to skip the rest of a perform block (therefore usually
38
+ # raised if some condition fails). See Movie#skip for the shorthand.
39
+ class SkipError < CastanautError
40
+ end
41
+
31
42
  end
32
43
  end
@@ -1,7 +1,7 @@
1
1
  module Castanaut
2
-
2
+
3
3
  # Some standard keys (for use with 'hit'), presumably only for US keyboards.
4
-
4
+
5
5
  #
6
6
  Return = "0x24"
7
7
  Enter = "0x4C"
@@ -14,6 +14,7 @@ module Castanaut
14
14
  CapsLock = "0x39"
15
15
  Alt = "0x3A"
16
16
  Ctrl = "0x3B"
17
+ Command = "0x37"
17
18
 
18
19
  LArrow = "0x7B"
19
20
  RArrow = "0x7C"
@@ -5,13 +5,13 @@ module Castanaut
5
5
  class Main
6
6
 
7
7
  # If Castanaut is not running, this runs the movie specified as the first
8
- # argument. If it *is* already running, this nixes the flag file, which
8
+ # argument. If it *is* already running, this nixes the flag file, which
9
9
  # should cause Castanaut to stop.
10
10
  def self.run(args)
11
- if File.exists?(Castanaut::FILE_RUNNING)
11
+ if File.exists?(Castanaut::FILE_RUNNING)
12
12
  File.unlink(Castanaut::FILE_RUNNING)
13
13
  else
14
- Castanaut::Movie.new(args.shift)
14
+ Castanaut::Movie.spawn(args.shift)
15
15
  end
16
16
  end
17
17