osaka 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +85 -0
- data/lib/osaka/keynote.rb +1 -1
- data/lib/osaka/numbers.rb +1 -1
- data/lib/osaka/typicalapplication.rb +1 -1
- data/lib/osaka/version.rb +2 -2
- data/spec/numbers_spec.rb +1 -1
- metadata +2 -2
- data/README +0 -0
data/README.rdoc
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
|
2
|
+
Osaka - apple OSA script Kontrolling the Application (OSAKA :P)
|
3
|
+
This is a Ruby 1.9 library for automating work via GUI on Mac (using OSA/Applescript)
|
4
|
+
|
5
|
+
= How to install
|
6
|
+
|
7
|
+
$ sudo gem install osaka
|
8
|
+
|
9
|
+
= How to use
|
10
|
+
|
11
|
+
Examples:
|
12
|
+
|
13
|
+
#### Example: Controlling Keynote
|
14
|
+
|
15
|
+
require 'osaka'
|
16
|
+
|
17
|
+
# Create a new application-specific wrapper
|
18
|
+
app = Osaka::Keynote.new
|
19
|
+
|
20
|
+
# Open a keynote file
|
21
|
+
app.open "presentation.key"
|
22
|
+
|
23
|
+
# Show a print dialog
|
24
|
+
dialog = app.print_dialog
|
25
|
+
|
26
|
+
# Save as PDF
|
27
|
+
dialog.save_as_pdf("presentation.pdf")
|
28
|
+
|
29
|
+
# Quit
|
30
|
+
app.quit
|
31
|
+
|
32
|
+
#### Example: Controlling Numbers
|
33
|
+
|
34
|
+
require 'osaka'
|
35
|
+
|
36
|
+
# Create a new application-specific wrapper
|
37
|
+
app = Osaka::Numbers.new
|
38
|
+
|
39
|
+
# Open a file
|
40
|
+
app.open "Numbers.numbers"
|
41
|
+
|
42
|
+
# Change a field
|
43
|
+
app.fill_cell(1, 4, "Hello World!")
|
44
|
+
|
45
|
+
# Save and quit
|
46
|
+
app.save
|
47
|
+
app.quit
|
48
|
+
|
49
|
+
#### Example: Using the Application Wrapper (lower-level)
|
50
|
+
|
51
|
+
require 'osaka'
|
52
|
+
|
53
|
+
# Create an application wrapper
|
54
|
+
calculator = Osaka::ApplicationWrapper.new("Calculator")
|
55
|
+
|
56
|
+
# Start the application
|
57
|
+
calculator.activate
|
58
|
+
|
59
|
+
# Control the calculator
|
60
|
+
calculator.click('button "1" of group 2 of window "Calculator"')
|
61
|
+
calculator.click('button "+" of group 2 of window "Calculator"')
|
62
|
+
calculator.click('button "4" of group 2 of window "Calculator"')
|
63
|
+
calculator.click('button "=" of group 2 of window "Calculator"')
|
64
|
+
|
65
|
+
calculator.quit
|
66
|
+
|
67
|
+
API document: To be done.
|
68
|
+
|
69
|
+
= Source code
|
70
|
+
|
71
|
+
https://github.com/basvodde/osaka
|
72
|
+
|
73
|
+
The license of this source is "BSD Licence"
|
74
|
+
|
75
|
+
= Note on current version (0.1.1)
|
76
|
+
|
77
|
+
Currently the functionality is fairly limited. It can be easily expanded by writing more application wrappers with convenient interfaces for controlling specific application. If you write some for common application or extend the ones, please submit a merge request :)
|
78
|
+
|
79
|
+
= Supported environments
|
80
|
+
|
81
|
+
1.9.x.
|
82
|
+
|
83
|
+
= Author
|
84
|
+
|
85
|
+
Bas Vodde - basv AT odd-e.com
|
data/lib/osaka/keynote.rb
CHANGED
data/lib/osaka/numbers.rb
CHANGED
@@ -6,7 +6,7 @@ module Osaka
|
|
6
6
|
super "Numbers"
|
7
7
|
end
|
8
8
|
|
9
|
-
def fill_cell(
|
9
|
+
def fill_cell(column, row, value)
|
10
10
|
@wrapper.tell("tell document 1; tell sheet 1; tell table 1; set value of cell #{column} of row #{row} to \"#{value}\"; end tell; end tell; end tell")
|
11
11
|
end
|
12
12
|
end
|
data/lib/osaka/version.rb
CHANGED
data/spec/numbers_spec.rb
CHANGED
@@ -10,7 +10,7 @@ describe "Osaka::Numbers" do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it "Should be able to fill in data in cells" do
|
13
|
-
subject.wrapper.should_receive(:tell).with('tell document 1; tell sheet 1; tell table 1; set value of cell
|
13
|
+
subject.wrapper.should_receive(:tell).with('tell document 1; tell sheet 1; tell table 1; set value of cell 1 of row 2 to "30"; end tell; end tell; end tell')
|
14
14
|
subject.fill_cell(1, 2, "30")
|
15
15
|
end
|
16
16
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: osaka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Bas Vodde
|
@@ -44,7 +44,7 @@ extensions: []
|
|
44
44
|
extra_rdoc_files: []
|
45
45
|
|
46
46
|
files:
|
47
|
-
- README
|
47
|
+
- README.rdoc
|
48
48
|
- Rakefile
|
49
49
|
- lib/osaka.rb
|
50
50
|
- lib/osaka/applicationwrapper.rb
|
data/README
DELETED
File without changes
|