Using Win32OLE library in Ruby to automate a custom built C# application - ruby

I have designed a custom Windows application in C#. Now, I would like to automate it using Win32OLE library in Ruby. I have absolutely no experience in using Win32OLE, so I would like to know when I create a new Win32OLE object using:
customApp= WIN32OLE.new('MyApp.Application')
it gives an error since it returns a null Win32OLE object.
Do I need to have a COM file for my application? If so, why is it needed? Also, could someone point me to all the files required by my custom application before I start trying to automate it using Win32OLE.

What exactly do you want to automate? If its by simple actions (tab,enter,etc. mimic the keyboard plus waits for some windows actions) you can use AutoIt.
http://codesnippets.joyent.com/posts/show/829
Everything starts with:
require "win32ole"
au3 = WIN32OLE.new("AutoItX3.Control")
It comes as a requirement of the rubygem watir. But you can see if there a more simple way to install autoit (its a .dll) for your ruby needs.

Related

How To Automate a Native OSX Application with VSCode?

How can I gain programmatic access, with VSCode, to the objects in a native OSX application, written in Swift or Objective-C?
When i say "with VSCode", I mean coding against the object-hierarchy of the target application in the Visual Studio Code IDE, using any language that VSCode supports.
Ideally, consider 2 scenarios:
Scenario in which I am the author of said native application, so I can prepare it for access by VSCode.
Scenario in which I am not the author of said native application, so I cannot get 'under the hood'.
Could something like this be used?
https://developer.xamarin.com/guides/ios/advanced_topics/binding_objective-c/
Note, I wish to gain programmatic access to the underlying object-hierarchy, not just click buttons on the UI.
You can use AppleScript, if the application supports it. If you wrote the application yourself, you can add AppleScript support to it.

Is it possible to automate installion using Ruby or Watir?

Currently we are installing our setup(.exe file) on daily basis for testing purpose.I want to automate my installation using Ruby or Watir.Is it possible to automate? Please help me how to perform and give your suggestions.
There are many libraries available for Ruby. Watir itself is constrained to the web browser. Although it does have some technology it's built on top of that should allow Windows environment control. Some of the libraries you can try are Win32-autogui, RAutomation, and windows-pr to name a few.
If you are installing for testing purposes, you can use autoit. It will run your installer, and you can handle some unexpected (though anticipated) errors. I wouldn't use autoit for testing, just for setting up to test.

Develop application for windows without any depedendency

I need to create an application for all versions of windows (XP, Vista, 7) without the need to install .NET or other 3rd party tools.
The application needs to download files asynchronous which are received in a json format and display a html page which can communicate with the application using javascript.
Is there a way to do that using an advanced IDE like Visual Studio but without requiring anything besides the application exe?
Are there any open source alternatives?
Thank you.
Look into the WebBrowser control. It's basically an Internet Explorer control you can embed in your application, and it has an interface that allows all sorts of manipulations. And given Internet Explorer is always a part of windows, it'll always be available without further installations.
Using the control requires some work. You can start by looking at Using the WebBrowser control, simplified. It uses MFC, but you can use the control with plain C++ as well.
The way I'd use it is push as many complicated tasks as possible to the browser control, and run them using JavaScript. A-synchronously downloading JSON is a pain in C++, but a no-brainer in JS. So you can basically divide your logic between C++ and JavaScript, and figure out some interface (by using, say, the DOM).

IPC with Ruby 1.8.5

I need to do IPC with Ruby 1.8.5. The catch is that it's the Ruby that ships with Google SketchUp, and is only a subset of the full Ruby API. So for instance, there's no Socket class, and no DRb.
What are some other way's of doing IPC with Ruby? Anything that uses the File class, like memory mapped files, or something like that? I'm completely new to IPC, so I apologize if I missed something obvious.
The latest version of SketchUp ships with Ruby 1.8.6. You can download (if you haven't already) the core Ruby API, and just require whatever files you need, to implement your script.
Testing non-SketchUp Ruby code, is much easier outside of SketchUp, with the command line, or an editor like SciTE. Then you can add your SketchUp code for tests within the application.
Ruby Download
SciTE Download

Ruby bindings for Qt gui application

How to create a Qt GUI applications with the ability to access it from the ruby script.
Example:
require 'myQt'
myapp=myQt.new
myapp.startQtGuiApp
myapp.setValue('TextField1',45)
value=myapp.getValue('TextField2')
I assume you're looking for ruby-qt bindings? There are a few links to tutorials there, as well.

Resources