Maybe you know the mmotps GunZ(
i have already written a few macros for it (so a program, which clicks and presses the keys for you ingame) with the program actool(
But i am tired of using this pascal-like programming language...

So is there a possibility to get a macro, which presses keys and clicks when the user presses a key, written in python?

So is there a possibility to get a macro, which presses keys and clicks when the user presses a key, written in python?

So, let me see if I have this right. You want a script to emulate mouse clicks/key presses when the user presses a certain key (ALT + F, for example)? If so, then it depends on what OS you're running. I'll assume you're running Windows for now.

This should get you started:

Download pyHook here.
Download win32 extensions (pythoncom) here.

#Detecting keystrokes as events
import pyHook
import pythoncom

def OnKeyboardEvent(event):
    print event.Ascii

hm = pyHook.HookManager()
hm.KeyDown = OnKeyboardEvent

while True:

If you are by chance running Linux or another OS with X11 as its windowing system, I can give you one piece of advice: don't do it unless you have to. Just don't. If you're really determined, you can search for hours for some documentation for xbindkeys. If you need help with xbindkeys, post back. I have enough experience with it to help you get started.

Good luck with your scripting.

EDIT: If you want to do things the EASY way, check out AutoHotkey. You could probably write the entire script in about 5 minutes.

Well you can use many languages for autobot program creation.

Python works, but I don't think it is the best way since you have to mess with Win32API and hooks.

I think one of the best ways is to write an Autoit script.

Wow, that works nicely :twisted: :twisted:

but is there a documentation for this module?

and how can i send mouseclicks and keyevents with the win32 module?

It would be nice if u would tell me this too :)

The documentation is pretty much nonexistent, but you can find plenty of examples by searching the web for "python win32 simulate mouse click" or something similar.

Simulate a mouse click:

import win32api
import win32con

def click(x,y):
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y, 0, 0)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y, 0, 0)

click(100, 100) # simulate mouse click at 100px, 100px

Simulate a key press:

Download SendKeys from here.

from SendKeys import SendKeys