The content of this page will not longer be maintained and could be incomplete or incorrect.
Date: 2010-07-28

How to write a plugin

The structure

Filename

The filename plays an important role. The "Key-Assistant” of Miriam detects the name of the program, which the plugin is for, from the filename. If you name your file "Outlook.ini” then Miriam simply deletes the file extension and the "Key-Assistant” will display "Outlook" as name for your plugin. The plugins must have the file extension *.ini and you have have to save them in "../miriam/Lib/" otherwise Miriam won't be able to detect the plugin.

The *.ini file is structured in sections. Each section has a few keys and their values.

[Name_of_the_function]
Classname1=Classname1
Classname2=Classname2
Key1=Key1
Key2=Key2
Hint=Hint

Classname

Classname 1

It's necessary to explain how Miriam works. Miriam simulates keystroke of your keyboard and controls other applications with this method. Miriam needs a kind of an address to where the the shortcuts or keystrokes will be sent. This "address” is the classname1. Every program has such a classname1, which can be used by Miriam as an address. To find out, how to detect a classname read the paragraph "How to detect a classname”

Classname 2

Writing such a plugin is more or less based on trying. If you have to send keystrokes to an object like a TextEdit and not to a window you have to use classname1 and classname2. The classnam2 is also used like an address but this time is the target an object like a table or Edit field.

Summarization

... with a little example. Imagine, you want to write a plugin for notepad. Sure, someone else has already done this but you can also try this. We want that miriam writes numbers pressed on your remote control into the text field of Notepad. You need classname1 and classname2. Classname1 stands for the main window of Notepad and is "Notepad”. Note: Classname1 is not automatically the name of the program but here this is the case.

Because we don't want to send the numbers to the main window but to the text field, we have to specify classname2, which is "Edit”. Miriam will now send the keystrokes first to the main window "Notepad” and than to the text field "Edit”. One more hint for you: if you want to simulate shortcuts with miriam you have to send them to the main window. The classname2 must be left empty in this case.

How to detect a classname

Now the more difficult task: the detection of our classnames. To detect them use the build in tool in miriam. You will find it, if you use the plugin editor of miriam and add a function.behind the the text field, where you have to specify the classname there is a button with a mouse pointer. Press this button. The classname finder will start than.

Now open the program for which the plugin should be for. Read the following paragraphs to find out how to detect the classnames. If you found them just press CTRL + 9.

Classname 1

The Classname1 is a kind of identifier for the program window. We will find him if you move the mouse pointer over the titel of your program. Than press CTRL + 9.

Note: there are some programs, which don't use standard title bars but for exemple flatstyle components (wich are also used in miriam). In this case you won`t find the classname1 there.

There are also programs, those uses not the standard title borders but e.g. FlatStyle. In such programs we do not find the Classname in the title border. If we have such a program before us, then we must proceed unfortunately differently: look in the program surface for places, which are not covered by Buttons, Toolbars, menus, input and text fields etc.. In these places the original program windows must have to be seen. There we also find the Classname 1.

If you should not find such places however, the integrated tool is not powerful enough. Then professional programs are needed. This is e.g. in Power Point the case.

Classname 2

If you need the Classname 2 you'll find it relatively simple. At first do the same as before with Classname 1. Now we look for the Classname 2 however not in the title border but in the object. We remember again to our Notepad example: We wanted to find out now the Classname 2 for the text field in Notepad. Simply move the Mousepointer into the text field. The Handle Finder (the tool you are working with) now displays the Classname "Edit". And that's all. Press STRG + 9 to take over the value.

Key1= , Key2=

The keys that Miriam has to simulate are defined here. The indicated keys will be "pressed" all at once, so that also shortcuts are possible.

The values for Key1 and Key2 are so-called "Virtual key codes". You do not have to know, what this is, and which key has which code. Simply select in drop down the menus the keys and the correct "Virtual key code" will be filled in.

Author: Hannes Kaube