Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create automation macro support within an application

I need to get an automation macro like thing within our desktop application. The desktop app will probably be in VB.NET or C#.net. The reason is to enable the user to record and replay certain tasks that they'd like to automate. Something like macros within office apps and visual studio. The first thing that comes to my mind is VBA.

Is this the right approach or whether are there any other options available?
Any gotchas or things to look out for, if some body has already done it before.
Some helpful links to get me going.

Whatever little help is highly appreciated.

Thanks in Advance.
Samrat.

P.S. This is a quite generic question not belonging to any specific technology. If some of you think the tags are inappropriate or if it needs some more tags which I missed out, feel free to edit them :)

like image 796
Samrat Patil Avatar asked Oct 30 '10 07:10

Samrat Patil


People also ask

What are macros in automation?

A macro is a series of commands and actions that can be stored and run whenever you need to perform a computer task. Use macros to automate actions that you perform repeatedly or on a regular basis. Record the macro steps.


2 Answers

Are you thinking of macros that are just for "record-replay" of some consecutive actions? This might be pretty well doable if you use the Command pattern in your UI programming. Then every user action is described by an object (derived from an abstract Command class having a "execute()" method). Now recording and replaying is simply storing a list of command objects, serializing them and your macro is done. For replaying it you simply deserialize the data and execute the list of commands again.

Hope that helps!

like image 147
Philipp Avatar answered Oct 16 '22 06:10

Philipp


VSTA (Visual Studio Tools for Applications) is the replacement for VBA. It hasn't caught on as much as VBA did with 3rd party vendors or even in MSFT's own products (the only one that currently has it is InfoPath). But it's far more modern than VBA, if that is a concern.

Check out VSTA main page, and in particular the video: Integrating VSTA to Enable Macro Recording.

like image 33
Todd Main Avatar answered Oct 16 '22 06:10

Todd Main