Sign in to follow this  
Followers 0
Achilles

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

3 posts in this topic

#1 ·  Posted (edited)

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]

Share this post


Link to post
Share on other sites



Oohhh. I like it! Kinda clever!


[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites

I like it :D

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0