Reassign Mouse Button (program) Function
August 4, 2012 11:49 PM   Subscribe

How can I assign a command to a mouse button so that a .jpg will open in MSPaint?

I've got an MS wireless mouse 5000 (model 1058*). O/S = Windows 7. The mouse control software is working fine: I can reassign functions to any of the buttons including have program specific functions. So I can make it open MSPaint from mousewheel click or I can have mousewheel click take on another function inside the MSPaint program. But I want to be able to middle-click on a saved image and have it load in MSPaint and I don't really see an easy way to do it with win7 or the mouse controls (or with Irfanview or MSPaint for that matter).

Normally I have to R-click and jog down to "Open with" and then choose from the menu items that appear (and which don't have shortcuts). And I do this action a LOT and I'm looking at ways of reducing wrist affects from over-mousing (I also recently got a logitech touchpad too which helps)

I've had a quick look at the AutoHotkey tutorial and it looks a bit daunting for my pedestrian abilities. {mind you, this might be the start of a useful learning curve} Any easy recipe recommendations??
posted by peacay to Computers & Internet (9 answers total) 1 user marked this as a favorite
 


2nding Muffin Man. That's exactly what came to my mind. Sounds like what you're trying to achieve is a bizarre work around for the built-in feature that allows you to associate applications with file types.
posted by Hartham's Hugging Robots at 12:12 AM on August 5, 2012


Response by poster: 80% of the time I want them to open in Irfanview. It's the rest of the time I want them open in MSPaint. I play with images a LOT. So I want Irfanview as default.
posted by peacay at 12:22 AM on August 5, 2012


Response by poster: In case I wasn't clear enough..

Thanks MuffinMan for the suggestion but it's not actually the answer for my problem.

I don't want to reassign the default program for images on my pc.

I want all my images to open normally in Irfanview when I double click them.

BUT! I want to be able to mousewheel-click on an image and have it automagically open in MSPaint when I want. I often use Irfanview to crop and resize and then reopen that same image in MSPaint to do spot touch-ups (mainly book illustrations). Hence my desire to have a mouse button reassignment.
posted by peacay at 4:44 AM on August 5, 2012


You could probably write a script in Autoit or Autohot Key to do this. Alternatively in windows 7 you can right click on the JPG and choose "Open With" to open the jpg in its non default application but that may be what you are trying to avoid.
posted by jmsta at 6:51 AM on August 5, 2012


Response by poster: Um yep, exactly. But, as I said up above, I'm not sure I know how to write an AutohotKey script for this; the examples in the tutorial don't suggest themselves as being applicable models to copy - but if you can help that would be grand!
posted by peacay at 7:13 AM on August 5, 2012


Best answer: The following Autohotkey script will do what you ask. Download and install Autohotkey, copy and paste the script into a new text file and save with a .ahk extension. Run the new script file when you want the functionality to be active, or place in your startup folder. While you run the script, your normal middle-click operation will be broken, so I've added in another hotkey so that you can press Ctrl+Middle-Click and it will do what would normally be done when you click the middle button. You could probably improve on that aspect by searching the Autohotkey forums for context sensitive hotkeys.

MButton::
Send {Lbutton}
ClipBackup = ClipboardAll
Clipboard = ""
Send ^c
ClipWait, 0.1
Run mspaint "%Clipboard%"
Clipboard = %ClipBackup%
Return

^MButton::Send {Mbutton}
posted by UsernameGenerator at 10:55 AM on August 5, 2012


Response by poster: Thanks so much for that. Since I last posted I've actually started reading more deeply and playing around with the scripts a bit so I haven't had you do my 'homework' on the back of pure laziness. I'm on an iPod at the mo' so haven't tried out your script yet but I'm not as fearful of tweaking it as before. Cheers!
posted by peacay at 8:24 PM on August 5, 2012


I just realized that I had an error in my earlier code when I was emptying the clipboard. Here is the updated version with comments:

MButton::
Send {Lbutton} ; Selects the file under the mouse
ClipBackup = ClipboardAll ; Creates a backup of the clipboard
Clipboard = ; Clears the clipboard
Send ^c ; Copies the path of the file under the mouse
ClipWait, 2 ; Waits for the clipboard to contain data for up to 2 seconds
Run mspaint "%Clipboard%" ; Runs Paint and opens the path copied earlier
Clipboard = %ClipBackup% ; Restores the clipboard to the original value
Return

^MButton::Send {Mbutton}
posted by UsernameGenerator at 1:04 PM on August 6, 2012


« Older What Font is this?   |   iPhone Not Restoring Newer »
This thread is closed to new comments.