Is there any other way to run ruby script?

The code in my script file “export.rb” is shown below:

result = Sketchup.open_file("D:\\model.skp")
model = Sketchup.active_model
filename = "D:\\model.3ds"
status = model.export(filename, false)  # export 3dsfile
Sketchup.send_action 57602  # shutdown sketchup

I have to run the script like this ----->: SketchUp.exe -RubyStartup “export.rb”`

Every time I run this script,I should start sketchup. So the way is very heavy.
Could you give me some way to run this script without starting sketchup
when sketcup process is active?

Can you edit your post and format it properly so that the text that is not code is not formatted as code to make it readable? Thanks.

Actions in SketchUp can not be triggered from outside, only from SketchUp. But you could make a script in SketchUp that observes an external process or file and then calls a method in export.rb.