You will need to learn core Ruby and especially working with the IO
class and it’s File
subclass. (The latter inherits methods from it’s superclass.)
You would likely use:
Sketchup::AppObserver
class
… combined with command line switches to start SketchUp …