Jump to content
Sign in to follow this  
James

MouseSwitch

Recommended Posts

James

Howdy,

My friend has a sister who likes to mess around on his computer and switch his background for a pink poodle thing, I can't remeber, anyway he asked me if I could do something about it and get her back on her computer. So I did, and I came up with MouseSwitch!

HotKeySet("^!e", "_exit")
HotKeySet("^!z", "_switch1")
HotKeySet("^!x", "_switch2")
#NoTrayIcon
$On = False

While 1
    Sleep(100)
Wend

Func _exit()
    Exit
EndFunc

Func _switch1()
    $On = False
    If $On = False Then
        DllCall("user32.dll", "int", "SwapMouseButton", "int", 0)
    EndIf
EndFunc

Func _switch2()
    $On = True
    If $On = True Then
        DllCall("user32.dll", "int", "SwapMouseButton", "int", 1)
    EndIf
EndFunc

I think something like this has been done before, but I did it myself and the research came from, MouseSwap [Dx21] =)

So, I know its not useful but I think its fun to annoy people with, and it certainly scared her! My Dad also got annoyed with it aswell, should of seen his face :)

Its also the first time, I have used a dll call for anything myself.

Thanks,

Secure

Edit: Missed something!

Edited by Secure_ICT

Share this post


Link to post
Share on other sites
karman

Func _switch1()
    $On = False
    If $On = False Then
        DllCall("user32.dll", "int", "SwapMouseButton", "int", 0)
    EndIf
EndFunc

Func _switch2()
    $On = True
    If $On = True Then
        DllCall("user32.dll", "int", "SwapMouseButton", "int", 1)
    EndIf
EndFunc

Why not just:

Func _switch1()
        DllCall("user32.dll", "int", "SwapMouseButton", "int", 0)
EndFunc

Func _switch2()
        DllCall("user32.dll", "int", "SwapMouseButton", "int", 1)
EndFunc

It's the same.

Edited by karman

Share this post


Link to post
Share on other sites
James

Ok, Zedna for the random changing mouse I came up with:

; Name: Random MouseSwitch
; Author: James Brooks AKA Secure_ICT
; Remarks: 0 = Normal Mouse, 1 = Switched

HotKeySet("^!e", "_exit")
#NoTrayIcon
$On = False

While 1
    Switch Random(1,2,1)
    Case 1
        _switch1()
    Case 2
        _switch2()
    EndSwitch
Wend

Func _exit()
    DllCall("user32.dll", "int", "SwapMouseButton", "int", 0)
    Exit
EndFunc

Func _switch1()
    $On = False
    If $On = False Then
        DllCall("user32.dll", "int", "SwapMouseButton", "int", 0)
    EndIf
EndFunc

Func _switch2()
    $On = True
    If $On = True Then
        DllCall("user32.dll", "int", "SwapMouseButton", "int", 1)
    EndIf
EndFunc

Be aware, it will change RANDOMLY and will change again at another random time. (Just thought I'd warn you that its RANDOM (Well the n00bs anyways))

My Sister thought the mouse was hanging out or in the wrong socket somewhere. ROTFLMAONID!

Edit: Missed one thing to say! ROTFLMAONID = Rolling on the floor laughing my ass of now I'm dying!

Edited by Secure_ICT

Share this post


Link to post
Share on other sites
Pascal257

; Name: Random MouseSwitch
; Author: James Brooks AKA Secure_ICT
; Remarks: 0 = Normal Mouse, 1 = Switched

HotKeySet("^!e", "_exit")
#NoTrayIcon

While 1
    Switch Random(1,2,1)
    Case 1
        _switch1()
    Case 2
        _switch2()
    EndSwitch
    sleep(Random(10000,30000,1))
Wend

Func _exit()
    DllCall("user32.dll", "int", "SwapMouseButton", "int", 0)
    Exit
EndFunc

Func _switch1()
    DllCall("user32.dll", "int", "SwapMouseButton", "int", 0)
EndFunc

Func _switch2()
    DllCall("user32.dll", "int", "SwapMouseButton", "int", 1)
EndFuncoÝ÷ Ùj.Ù÷öÛaÇ!jx¶ºÛh§íz¶«jwh8¦x¶+},y̨¹Æ§r§è­¶¨ººey«.­äáȬjz®¢Ö½©ÜyÚ®¢Ú'y«­¢+Øì9µèI¹½´5½ÕÍMÝ¥Ñ (ìÕÑ¡½Èè)µÌ  ɽ½­Ì-MÕÉ}%
P¼¼¥ÑäAÍ°(ìIµÉ­ÌèÀô9½Éµ°5½ÕÍ°ÄôMݥѡ()!½Ñ-åMÐ ÅÕ½ÐíxÌÌíÅÕ½Ðì°ÅÕ½Ðí}á¥ÐÅÕ½Ðì¤(9½QÉå%½¸()]¡¥±Ä(}ÍÝ¥Ñ  ¤(ͱÀ¡I¹½´ ÄÀÀÀÀ°ÌÀÀÀÀ°Ä¤¤)]¹()Õ¹}á¥Ð ¤(±±
±° ÅÕ½ÐíÕÍÈÌȹ±°ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐíMÝÁ5½ÕÍ   ÕÑѽ¸ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°À¤(á¥Ð)¹Õ¹()Õ¹}ÍÝ¥Ñ  ¤(±±
±° ÅÕ½ÐíÕÍÈÌȹ±°ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐíMÝÁ5½ÕÍ   ÕÑѽ¸ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°I¹½´ İȰĤ¤)¹Õ¹

I hope there are no syntax-errors... done it without SciTe :)

Edited by Pascal257

Share this post


Link to post
Share on other sites
karman

Karman, I found it easy for me to work like that :D

Zedna, I have done randomness and saved it somewhere, I cant remember, if I find it I will post ot :)

How can it be easier to write 6 more lines? (they are not needed, totally useless).. You are stupid. Bye!

Share this post


Link to post
Share on other sites
James

Because its the way my brain works. So, yeah your correct, I can shorten it.

HotKeySet("^!e", "_exit")
HotKeySet("^!z", "_switch1")
HotKeySet("^!x", "_switch2")
#NoTrayIcon
$On = False

While 1
    Sleep(100)
Wend

Func _exit()
    Exit
EndFunc

Func _switch1()
        DllCall("user32.dll", "int", "SwapMouseButton", "int", 0)
EndFunc

Func _switch2()
        DllCall("user32.dll", "int", "SwapMouseButton", "int", 1)
EndFunc

Happy?

Edit: Changed the wrong thing :)

Edited by Secure_ICT

Share this post


Link to post
Share on other sites
Pascal257

; Name: Random MouseSwitch
; Author: James Brooks AKA Secure_ICT // edited by Pascal
; Remarks: 0 = Normal Mouse, 1 = Switched

HotKeySet("^!e", "_exit")
#NoTrayIcon

While 1
    _switch()
    sleep(Random(10000,30000,1))
Wend

Func _exit()
    DllCall("user32.dll", "int", "SwapMouseButton", "int", 0)
    Exit
EndFunc

Func _switch()
    DllCall("user32.dll", "int", "SwapMouseButton", "int", Random(0,1,1))
EndFunc

Sorry, logical mistake :)

The time IS random...

10-30secs...

Share this post


Link to post
Share on other sites
Paulie

@JamesB

Nice, this could actually be useful for something I am making for work, thanks!

@Karman

How can it be easier to write 6 more lines? (they are not needed, totally useless).. You are stupid. Bye!

Whats with your attitude? You have a problem with the code? change it yourself. You made your suggestion. And while it may have been a good idea, there is no need to be an asshole. Nobody insulted you, or said your idea was bad, I agree that the lines are omitable, but it would have been fine without the last 4 words. JamesB has no obligation to do anything you say, so calling him stupid for coding something the way he wanted to just makes you look like a hypocrite.

Share this post


Link to post
Share on other sites
DaProgrammer

If u really want to drive a man CRAZY !!!

#NoTrayIcon
HotKeySet("{ESC}","_Exit")

While 1
    MouseMove(Random(0,@DesktopWidth,1),Random(0,@DesktopHeight,1))
    Sleep(Random(1000,2000,1))
WEnd


Func _Exit()
    Exit
EndFunc

just change the times in sleep to something longer like "Sleep(Random(30000,60000,1))" and the HotKey to something more complex like "HotKeySet("^+!t","_Exit")" which is CTRL+SHIFT+ALT+t

Edited by DaProgrammer

Share this post


Link to post
Share on other sites
gamepin126

#include <misc.au3>

While 1
    If _IsPressed("01") Then
        DllCall("user32.dll", "int", "SwapMouseButton", "int", 1)
        Sleep(10000)
        DllCall("user32.dll", "int", "SwapMouseButton", "int", 0)
    EndIf
    Sleep(2000)
WEnd

Something similar, I'd be far more annoyed with this.

Share this post


Link to post
Share on other sites
Paulie

Thanks Paulie! That guy was knocked off his high chair.

No problem. I just don't understand why some people think that insulting and being mean to others will get them anywhere... :)

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.