rb-appscript 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. data/CHANGES +30 -0
  2. data/LICENSE +1 -1
  3. data/README +7 -3
  4. data/TODO +7 -1
  5. data/doc/aem-manual/01_introduction.html +23 -9
  6. data/doc/aem-manual/02_apioverview.html +25 -11
  7. data/doc/aem-manual/03_packingandunpackingdata.html +22 -17
  8. data/doc/aem-manual/04_references.html +49 -36
  9. data/doc/aem-manual/05_targettingapplications.html +25 -14
  10. data/doc/aem-manual/06_buildingandsendingevents.html +47 -21
  11. data/doc/aem-manual/07_findapp.html +22 -11
  12. data/doc/aem-manual/08_examples.html +21 -10
  13. data/doc/aem-manual/index.html +28 -12
  14. data/doc/appscript-manual/01_introduction.html +40 -27
  15. data/doc/appscript-manual/02_aboutappscripting.html +28 -15
  16. data/doc/appscript-manual/03_quicktutorial.html +29 -16
  17. data/doc/appscript-manual/04_gettinghelp.html +31 -16
  18. data/doc/appscript-manual/05_keywordconversion.html +23 -10
  19. data/doc/appscript-manual/06_classesandenums.html +32 -19
  20. data/doc/appscript-manual/07_applicationobjects.html +31 -18
  21. data/doc/appscript-manual/08_realvsgenericreferences.html +23 -11
  22. data/doc/appscript-manual/09_referenceforms.html +33 -20
  23. data/doc/appscript-manual/10_referenceexamples.html +30 -17
  24. data/doc/appscript-manual/11_applicationcommands.html +25 -13
  25. data/doc/appscript-manual/12_commandexamples.html +26 -15
  26. data/doc/appscript-manual/13_performanceissues.html +46 -20
  27. data/doc/appscript-manual/14_notes.html +29 -19
  28. data/doc/appscript-manual/index.html +27 -11
  29. data/doc/full.css +95 -9
  30. data/doc/index.html +27 -10
  31. data/doc/mactypes-manual/01_introduction.html +56 -0
  32. data/doc/mactypes-manual/02_aliasclass.html +134 -0
  33. data/doc/mactypes-manual/03_fileurlclass.html +136 -0
  34. data/doc/mactypes-manual/04_unitsclass.html +102 -0
  35. data/doc/mactypes-manual/index.html +26 -227
  36. data/doc/osax-manual/01_introduction.html +69 -0
  37. data/doc/osax-manual/02_interface.html +149 -0
  38. data/doc/osax-manual/03_examples.html +75 -0
  39. data/doc/osax-manual/04_notes.html +80 -0
  40. data/doc/osax-manual/index.html +26 -195
  41. data/doc/rb-appscript-logo.png +0 -0
  42. data/rb-appscript.gemspec +2 -2
  43. data/sample/TextEdit_demo.rb +1 -1
  44. data/src/lib/_aem/aemreference.rb +1 -1
  45. data/src/lib/_aem/codecs.rb +42 -8
  46. data/src/lib/_aem/connect.rb +3 -1
  47. data/src/lib/_aem/findapp.rb +1 -1
  48. data/src/lib/_aem/mactypes.rb +1 -1
  49. data/src/lib/_aem/send.rb +162 -142
  50. data/src/lib/_aem/typewrappers.rb +2 -2
  51. data/src/lib/_appscript/defaultterminology.rb +76 -46
  52. data/src/lib/_appscript/referencerenderer.rb +1 -1
  53. data/src/lib/_appscript/reservedkeywords.rb +2 -2
  54. data/src/lib/_appscript/safeobject.rb +1 -1
  55. data/src/lib/_appscript/terminology.rb +30 -19
  56. data/src/lib/aem.rb +1 -6
  57. data/src/lib/appscript.rb +65 -20
  58. data/src/lib/osax.rb +21 -18
  59. data/src/rbae.c +1 -1
  60. data/test/test_appscriptcommands.rb +1 -1
  61. metadata +12 -3
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # osax -- invoke scripting addition (OSAX) commands from Ruby
5
5
  #
6
- # Copyright (C) 2006-2008 HAS. Released under MIT License.
6
+ # Copyright (C) 2006-2009 HAS. Released under MIT License.
7
7
  #
8
8
 
9
9
  require "appscript"
@@ -23,22 +23,6 @@ module OSAX
23
23
 
24
24
  OSAXCache = {}
25
25
  OSAXNames = []
26
-
27
- se = AEM::Application.by_path(FindApp.by_id('com.apple.systemevents'))
28
- ['flds', 'fldl', 'fldu'].each do |domain_code|
29
- osaxen = AEM.app.property(domain_code).property('$scr').elements('file').by_filter(
30
- AEM.its.property('asty').eq('osax').or(AEM.its.property('extn').eq('osax')))
31
- if se.event('coredoex', {'----' => osaxen.property('pnam')}).send # domain has ScriptingAdditions folder
32
- names = se.event('coregetd', {'----' => osaxen.property('pnam')}).send
33
- paths = se.event('coregetd', {'----' => osaxen.property('posx')}).send
34
- names.zip(paths).each do |name, path|
35
- name = name.sub(/(?i)\.osax$/, '') # remove name extension, if any
36
- OSAXNames.push(name)
37
- OSAXCache[name.downcase] = [path, nil]
38
- end
39
- end
40
- end
41
- OSAXNames.sort!.uniq!
42
26
 
43
27
  #######
44
28
  # modified AppData class
@@ -64,6 +48,23 @@ module OSAX
64
48
 
65
49
  @_standard_additions = nil
66
50
 
51
+ def OSAX._init_caches
52
+ se = AEM::Application.by_path(FindApp.by_id('com.apple.systemevents'))
53
+ ['flds', 'fldl', 'fldu'].each do |domain_code|
54
+ osaxen = AEM.app.property(domain_code).property('$scr').elements('file').by_filter(
55
+ AEM.its.property('asty').eq('osax').or(AEM.its.property('extn').eq('osax')))
56
+ if se.event('coredoex', {'----' => osaxen.property('pnam')}).send # domain has ScriptingAdditions folder
57
+ names = se.event('coregetd', {'----' => osaxen.property('pnam')}).send
58
+ paths = se.event('coregetd', {'----' => osaxen.property('posx')}).send
59
+ names.zip(paths).each do |name, path|
60
+ name = name.sub(/(?i)\.osax$/, '') # remove name extension, if any
61
+ OSAXNames.push(name)
62
+ OSAXCache[name.downcase] = [path, nil]
63
+ end
64
+ end
65
+ end
66
+ OSAXNames.sort!.uniq!
67
+ end
67
68
 
68
69
  ######################################################################
69
70
  # PUBLIC
@@ -71,7 +72,8 @@ module OSAX
71
72
 
72
73
  def OSAX.scripting_additions
73
74
  # list names of all currently installed scripting additions
74
- return OSAXNames
75
+ OSAX._init_caches if OSAXNames == []
76
+ return OSAXNames.clone
75
77
  end
76
78
 
77
79
  def OSAX.osax(name=nil, app_name=nil)
@@ -95,6 +97,7 @@ module OSAX
95
97
  #
96
98
  # without the additional overhead of creating a new ScriptingAddition object each time.
97
99
  #
100
+ OSAX._init_caches if OSAXCache == {}
98
101
  if name == nil and app_name == nil
99
102
  if @_standard_additions == nil
100
103
  @_standard_additions = ScriptingAddition.new('StandardAdditions')
data/src/rbae.c CHANGED
@@ -4,7 +4,7 @@
4
4
  * ae -- a low-level API providing a basic Ruby wrapper around the various
5
5
  * Apple Event Manager, Process Manager and Launch Services APIs used by aem
6
6
  *
7
- * Copyright (C) 2006-2008 HAS. Released under MIT License.
7
+ * Copyright (C) 2006-2009 HAS. Released under MIT License.
8
8
  *
9
9
  * Thanks to:
10
10
  * - FUJIMOTO Hisakuni, author of RubyAEOSA
@@ -130,7 +130,7 @@ class TC_AppscriptCommands < Test::Unit::TestCase
130
130
  @f.items[10000].get
131
131
  rescue Appscript::CommandError => e
132
132
  assert_equal(-1728, e.to_i)
133
- assert_equal("CommandError\n\t\tOSERROR: -1728\n\t\tMESSAGE: Can't get reference.\n\t\tCOMMAND: app(\"/System/Library/CoreServices/Finder.app\").items[10000].get()\n", e.to_s)
133
+ assert_equal("CommandError\n\t\tOSERROR: -1728\n\t\tMESSAGE: Can't get reference.\n\t\tOFFENDING OBJECT: app(\"/System/Library/CoreServices/Finder.app\").items[10000]\n\t\tCOMMAND: app(\"/System/Library/CoreServices/Finder.app\").items[10000].get()\n", e.to_s)
134
134
  assert_instance_of(AEM::CommandError, e.real_error)
135
135
  end
136
136
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rb-appscript
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - HAS
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-02-18 00:00:00 +00:00
12
+ date: 2009-07-05 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -59,9 +59,18 @@ files:
59
59
  - doc/full.css
60
60
  - doc/index.html
61
61
  - doc/mactypes-manual
62
+ - doc/mactypes-manual/01_introduction.html
63
+ - doc/mactypes-manual/02_aliasclass.html
64
+ - doc/mactypes-manual/03_fileurlclass.html
65
+ - doc/mactypes-manual/04_unitsclass.html
62
66
  - doc/mactypes-manual/index.html
63
67
  - doc/osax-manual
68
+ - doc/osax-manual/01_introduction.html
69
+ - doc/osax-manual/02_interface.html
70
+ - doc/osax-manual/03_examples.html
71
+ - doc/osax-manual/04_notes.html
64
72
  - doc/osax-manual/index.html
73
+ - doc/rb-appscript-logo.png
65
74
  - extconf.rb
66
75
  - LICENSE
67
76
  - rb-appscript.gemspec
@@ -119,7 +128,7 @@ files:
119
128
  - test/testall.sh
120
129
  - TODO
121
130
  has_rdoc: false
122
- homepage: http://rb-appscript.rubyforge.org/
131
+ homepage: http://appscript.sourceforge.net/rb-appscript
123
132
  post_install_message:
124
133
  rdoc_options: []
125
134