How to map buttons on my mouse with AppleScript? Since BetterTouchTool is becoming paid, I was looking for an alternative solutions to map my navigation buttons (prev. page, next page) on my mouse (Logitech MX518) that I enjoy using for browsing websites. Right now these two button perform the same action like pressing the scroll wheel. 

I already tried Logitech's own software but that seems to be a rather overkill solution and apart from using too much resources, it is also too obtrusive while booting up.

So I was wondering if there is an easy solution with AppleScript that I could write to just do this trick of mapping a button on my mouse to possibly a swipe gesture (like on trackpads)?
Karabiner, which Joonas suggested, natively has back/forward options for buttons 4 and 5. You do not have to create a xtml file.
The option is under 'pointing device' > 'button to key' > 'use button 4 and 5 as back/forward'.
I have only used it for 30 minutes so far, but it worked straight away by just activating those checkmarks (mouse: ttesports black v2)