ruby/com testing 2, november 11. admin grades for mid-term & hw 2 posted homeworks 3 & 4...
TRANSCRIPT
Ruby/COMRuby/COM
Testing 2, November 11Testing 2, November 11
AdminAdmin
Grades for mid-term & hw 2 postedGrades for mid-term & hw 2 posted
Homeworks 3 & 4 postedHomeworks 3 & 4 posted
Project 2Project 2
People doing presentations – stay after People doing presentations – stay after class today to plan whenclass today to plan when
What Is COM?What Is COM?
Technology for allowing interactions Technology for allowing interactions between programsbetween programsInterface to allow applications to share Interface to allow applications to share functionalityfunctionalityComponent Object ModelComponent Object ModelTechnically COM AutomationTechnically COM AutomationPowerful capability for automated test Powerful capability for automated test development!development!
Main Elements Of COMMain Elements Of COM
ObjectsObjects
MethodsMethods
PropertiesProperties
EventsEvents
ObjectsObjects
Things that can be interacted withThings that can be interacted with FilesFiles Ranges of DataRanges of Data ParagraphsParagraphs
““Nouns”Nouns”
Objects can contain other objects and Objects can contain other objects and collections (groups of objects)collections (groups of objects)
MethodsMethods
Ways in which objects can be interacted Ways in which objects can be interacted withwith SaveSave Check SpellingCheck Spelling PrintPrint
““Verbs”Verbs”
PropertiesProperties
Descriptions of the objects and their stateDescriptions of the objects and their state Whether a file is savedWhether a file is saved File nameFile name Text FormattingText Formatting
““Adjectives”Adjectives”
EventsEvents
Outside things that an object can react toOutside things that an object can react to Mouse ClickMouse Click File being savedFile being saved Text being enteredText being entered
““Triggers”Triggers”
Using COM from RubyUsing COM from Ruby
require ‘win32ole’require ‘win32ole’<variable> = WIN32OLE.new(<COM <variable> = WIN32OLE.new(<COM identifier>)identifier>)
COM identifier = ‘Word.Application’ or COM identifier = ‘Word.Application’ or ‘InternetExplorer.Application’‘InternetExplorer.Application’Use <variable>.<property> or Use <variable>.<property> or <variable>.<method> to access the <variable>.<method> to access the properties and methodsproperties and methods
IE ControllerIE Controller
Wraps interaction with IEWraps interaction with IE
Download from wtr project at rubyforge.orgDownload from wtr project at rubyforge.org
Unzip and run install scriptUnzip and run install script
DemoDemo
Sources of COM InfoSources of COM Info
Office apps: Office apps: VB Language References at VB Language References at
msdn.microsoft.com/library/default.aspmsdn.microsoft.com/library/default.asp
IEIE http://msdn.microsoft.com/library/default.asp?http://msdn.microsoft.com/library/default.asp?
url=/workshop/browser/webbrowser/url=/workshop/browser/webbrowser/reference/Objects/InternetExplorer.aspreference/Objects/InternetExplorer.asp