As i promised I gonna make an tutorial how to make an basic Macro for AVA in C#. If you plan to release an macro on this base please mention me in the credits.
The First are the requirements:
- Visual Studio 2012 (at least I use 2012)
- Brain.exe
Skills required:
- Know how to make an gui in the Designer
That are Basic Skills which everybody can learn in 2 hours. But if you don't understand some piece of code, ask google, only if your search wasn't successful you can ask me.
Now the Steps:
1. Create an New C# Windows Forms Application, Name doesn't matter.
2. Wait until the Designer has loaded and you see an Fresh Window.
3. Add Folowing items to the Form (you can find them in the Toolbox). Rename them in the Properties Window:
- 3 Buttons
- 1 Textbox
- 1 Timer
4. Double Click the first button and add following code to the new appeared window in between the new void:
Code:
timer1.Interval = Convert.ToInt32(textBox1.Text);
in the end it should like this:
Code:
private void button1_Click(object sender, EventArgs e)
{
timer1.Interval = Convert.ToInt32(textBox1.Text);
}
5. Now go back to the Designer and Doubleclick the second button and add this code inbetween the new void:
in the End it should look like this:
Code:
private void button2_Click(object sender, EventArgs e)
{
timer1.Start();
}
6. Switch Back to the Designer and Doubleclick the third and last button and add this code inbetween the new created void:
In the End it should look like this:
Code:
private void button3_Click(object sender, EventArgs e)
{
timer1.Stop();
}
7. Switch Back to the Designer and Doubleclick the timer and add this to the new created void:
Code:
int x = GetAsyncKeyState(Keys.LButton);
if ((x == 1) || (x == Int16.MinValue))
{
Middown();
Midup();
}
In the End it should look like this:
Code:
private void timer1_Tick(object sender, EventArgs e)
{
int x = GetAsyncKeyState(Keys.LButton);
if ((x == 1) || (x == Int16.MinValue))
{
Middown();
Midup();
}
}
This will throw us 3 Errors, because the Programm doesn't know what GetAsyncKeyState, Middown and Midup is.
8. Add following code somewhere
between the voids, not inside:
Code:
void Middown()
{
mouse_event((uint)mef.MIDDLEDOWN, 0, 0, 0, 0);
}
void Midup()
{
mouse_event((uint)mef.MIDDLEUP, 0, 0, 0, 0);
}
Now there are 5 Errors.
9. Add following code somewhere
between the voids, not inside:
Code:
enum mef : uint
{
LEFTDOWN = 0x00000002,
LEFTUP = 0x00000004,
MIDDLEDOWN = 0x00000020,
MIDDLEUP = 0x00000040,
MOVE = 0x00000001,
ABSOLUTE = 0x00008000,
RIGHTDOWN = 0x00000008,
RIGHTUP = 0x00000010,
WHEEL = 0x00000800,
XDOWN = 0x00000080,
XUP = 0x00000100
}
Only three Errors left.
10. In the top of the code, there were are alot of using, add this line of code:
Code:
using System.Runtime.InteropServices;
11. Add following code somewhere
between the voids, not inside:
Code:
[DllImport("user32.dll")]
static extern short GetAsyncKeyState(System.Windows.Forms.Keys vKey);
[DllImport("user32.dll")]
static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint dwData,
int dwExtraInfo);
12. Push CTRL+F5, Wait until a small window shows up, close Visual Studio, Launch AVA and enjoy
The Compiled .exe File You can find in "*Your name*/Documents/VS 2012/Projects/*Project Name*/*Project Name*/bin/Debug/*Project Name*.exe"
I spent lot of time to create this simple tut how to create an simple macro (my macro is better in performance and reaction time). But the Difference is nearly not feel-able when you got a new/powerful computer. So I would like you apprenciate my work. If I see enough interest I will maybe make an tutorial for an extended macro like mine
. I attached the Source for Reference.
Virusscans for Attachment:
https://www.virustotal.com/de/file/1...is/1370723295/
Basic Macro.zip - Jottis Malwarescanner
@
Flengo, @
BACKD00R please approve
Kind Regards, PPCINJ