Jump to content

Two mice? Not at the same time... :(


Achilles
 Share

Recommended Posts

Very simple. I was bored and have needed something like this a lot while messing around with graphics.

What it does: Press the ` key and the script will save your mouse location, and then give you a new one. Press ` again and your other position is saved and you are back to controlling the original mouse.

I realize that you can cover up the pic, but since I did ghetto job of making the picture in the first place I'll leave at that. If anyone has a good .png mouse image (with shadow) I might (or they might) take the time to add that in instead of just taking a little screen shot.

#Include <ScreenCapture.au3>
#include <WindowsConstants.au3>

Global Const $PIC_DIR = @TempDir & '\mice_temp_pic.jpg' ; where to store the screen shot

Global $showPic = False ; capture a picture to show where the old mouse is

Opt('OnExitFunc', '_Exit')

If $showPic then 
    $bGui = GUICreate('', 0, 0)
    $gui = -1
EndIf 

HotkeySet('`', '_Toggle')

$oPos = MouseGetPos() 

While 1 
    Sleep(200) 
WEnd 

Func _Toggle()
    $temp = MouseGetPos() 

    If $showPic then 

        If $gui <> -1 then 
            GUIDelete($gui)
        EndIf
        
        FileDelete($PIC_DIR)

        _ScreenCapture_Capture($PIC_DIR, $temp[0], $temp[1], $temp[0] + 50, $temp[1] + 50, True)

        $gui = GuiCreate('', 50, 50, $temp[0], $temp[1], $WS_POPUP, -1, $bGui) 
    ;~      ConsoleWrite('-> $gui = ' & $gui & @CRLF)
            
            GUICtrlCreatePic($PIC_DIR, 0, 0, 50, 50) 
            GUISetState() 
    EndIf 
        
    MouseMove($oPos[0], $oPos[1], 0)  
    
    $oPos = $temp 
    
EndFunc 
    
Func _Exit()
    If $showPic then GUIDelete($gui)
    Exit 
EndFunc
Edited by Achilles
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...