Jump to content

<-MousePass-> designed for laptop fingerpads


Valuater
 Share

Recommended Posts

I wrote this little helper and really love it. It allows the mouse to pass-through the screen left-to-right and top-to-bottom.

Updated to ver 1.0.0.2

MousePass.exe

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Description=MousePass for laptops
#AutoIt3Wrapper_Res_Fileversion=1.0.0.2
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=p
#AutoIt3Wrapper_Res_LegalCopyright=By Valuater
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

If UBound(ProcessList(@ScriptName)) > 2 Then
    MsgBox(4096, "Error", "<-MousePass-> is already running.     ", 5)
    Exit 0
EndIf

$Height = @DesktopHeight - 1
$Width = @DesktopWidth - 1

;MsgBox(4096, $Height, $Width) ; for testing

$L_Adjust = 1
$R_Adjust = 2

$T_Adjust = 1
$B_Adjust = 2

$Left = 0 + $L_Adjust
$Right = $Width - $R_Adjust - 1

$Top = 0 + $T_Adjust
$Bottom = $Height - $B_Adjust

; HotKeySet("{ESC}", "Terminate"); this key is hit too often

TraySetToolTip("<-MousePass->")

If @Compiled = 1 And Not FileExists(@StartupCommonDir & "\MousePass.lnk") Then
    FileCreateShortcut(@ScriptDir & "\MousePass.exe", @StartupCommonDir & "\MousePass.lnk", @ScriptDir, "", "This is a <-MousePass-> link", "", "", "", @SW_SHOWNORMAL)
EndIf

While 1

    $x = MouseGetPos(0)
    $y = MouseGetPos(1)

    If ($x > $Width - 100) And ($y < 50) Then ContinueLoop 1 + 0 * Sleep(50) ; block top right coner
    If ($x < 50) And ($y > $Height - 50) Then ContinueLoop 1 + 0 * Sleep(50) ; block start button

    If $x <= 0 Then MouseMove($Right, $y, 0)
    If $x >= $Width Then MouseMove($Left, $y, 0)

    If $y <= 0 Then MouseMove($x, $Bottom, 0)
    If $y >= $Height Then MouseMove($x, $Top, 0)

    Sleep(50)

    ;ToolTip("x = " & $x & @CRLF & "y = " & $y, 10, 10) ; for testing

WEnd

Func Terminate()
    Exit 0
EndFunc   ;==>Terminate

ENJOY!!!

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

heres a simple way to implement it:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Fileversion=1.0.0.1
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=p
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

If UBound(ProcessList(@ScriptName)) > 2 Then
    MsgBox(4096, "Error", "<-MousePass-> is already running.     ", 5)
    Exit
EndIf

$Height = @DesktopHeight - 1
$Width = @DesktopWidth - 1

;MsgBox(4096, $Height, $Width) ; for testing

$L_Adjust = 1
$R_Adjust = 2

$T_Adjust = 1
$B_Adjust = 2

$Left = 0 + $L_Adjust
$Right = $Width - $R_Adjust - 1

$Top = 0 + $T_Adjust
$Bottom = $Height - $B_Adjust

HotKeySet("{ESC}", "Terminate")

TraySetToolTip("<-MousePass->")

While 1

    $x = MouseGetPos(0)
    $y = MouseGetPos(1)

    If ($x > $Width - 100) And ($y < 100) Then ContinueLoop 1 + 0 * Sleep(50)

    If $x <= 0 Then MouseMove($Right, $y, 0)
    If $x >= $Width Then MouseMove($Left, $y, 0)

    If $y <= 0 Then MouseMove($x, $Bottom, 0)
    If $y >= $Height Then MouseMove($x, $Top, 0)

    Sleep(50)

    ;ToolTip("x = " & $x & @CRLF & "y = " & $y, 10, 10) ; for testing

WEnd

Func Terminate()
    Exit 0
EndFunc   ;==>Terminate
Link to comment
Share on other sites

Included block for exit and for Start button

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Fileversion=1.0.0.1
#AutoIt3Wrapper_Res_FileVersion_AutoIncrement=p
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

If UBound(ProcessList(@ScriptName)) > 2 Then
    MsgBox(4096, "Error", "<-MousePass-> is already running.     ", 5)
    Exit
EndIf

$Height = @DesktopHeight - 1
$Width = @DesktopWidth - 1

;MsgBox(4096, $Height, $Width) ; for testing

$L_Adjust = 1
$R_Adjust = 2

$T_Adjust = 1
$B_Adjust = 2

$Left = 0 + $L_Adjust
$Right = $Width - $R_Adjust - 1

$Top = 0 + $T_Adjust
$Bottom = $Height - $B_Adjust

; HotKeySet("{ESC}", "Terminate"); this key is hit too often

TraySetToolTip("<-MousePass->")

While 1

    $x = MouseGetPos(0)
    $y = MouseGetPos(1)

    If ($x > $Width - 100) And ($y < 50) Then ContinueLoop 1 + 0 * Sleep(50) ; block top right coner
    If ($x < 50) And ($y > $Height - 50) Then ContinueLoop 1 + 0 * Sleep(50) ; block start button

    If $x <= 0 Then MouseMove($Right, $y, 0)
    If $x >= $Width Then MouseMove($Left, $y, 0)

    If $y <= 0 Then MouseMove($x, $Bottom, 0)
    If $y >= $Height Then MouseMove($x, $Top, 0)

    Sleep(50)

    ;ToolTip("x = " & $x & @CRLF & "y = " & $y, 10, 10) ; for testing

WEnd

Func Terminate()
    Exit 0
EndFunc   ;==>Terminate

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

Uh oh, can't get to my second monitor, may want to fix that.

For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com

Link to comment
Share on other sites

Please re-read the topic. This is made for a laptop..... unless you are stacking laptops....lol

8)

I know it's for a laptop, but you can have multiple monitors on laptops as well.

For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com

Link to comment
Share on other sites

Thank you very much, interesting utility, I will use it for sure. :D

BTW: :huggles: For those of you who are a bit hamfisted like me and find it difficult to balance the pointer on the bottom edge to get access to the system tray

you may wish to add the following line of code.

If ($x > $Width - 100) And ($y > $Height - 50) Then ContinueLoop 1 + 0 * Sleep(50) ; block SystemTray

Also, a while back I recall seeing on here a thread where someone supplied a way to determine the location of the Taskbar for those who have the taskbar on the side instead of the bottom, that will need to be taken into account for the non-default taskbar location when blocking the Start or SystemTray.

Regards,DeMo.

Quote of the week:"BASIC programmers never die, they GOSUB and don't RETURN." -- UnknownWisdom of the ages:

  

  • I'd be unstoppable... if not for law enforcement and physics.
  • Marriage, the number 1 cause of divorce.
  • Don't steal... the government hates competition.
  • Irish Government Motto: We’ve got what it takes to take what you’ve got.
  • Birthdays are good for you. Statistics show that the people who have the most live the longest.
  • Failure is not an option. It comes bundled with your Microsoft product.-- Ferenc Mantfeld
  • If you learn from your mistakes, then why ain't I a genius?! -- Anonymous
  • Remember, live every day as if it was your last day! one day you will be right.
  • How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?
  • Sure my system is secure, it just locked up again.
  • I haven't lost my mind; I have a tape back-up somewhere.  ~Author Unknown
Link to comment
Share on other sites

  • Moderators

GerrOrneq,

How to find the taskbar (and whether it is hidden or not): :D

ConsoleWrite(Find_Taskbar() & @CRLF)

Func Find_Taskbar()

    ; Find taskbar
    Local $iPrevMode = AutoItSetOption("WinTitleMatchMode", 4)
    Local $aTaskBar_Pos = WinGetPos("classname=Shell_TrayWnd")
    AutoItSetOption("WinTitleMatchMode", $iPrevMode)

    ; If error in finding taskbar
    If Not IsArray($aTaskBar_Pos) Then Return SetError(1, 0, "")

    ; Determine position of taskbar
    If $aTaskBar_Pos[1] > 0 Then
        ; Taskbar at BOTTOM
        If $aTaskBar_Pos[1] > @DesktopHeight - $aTaskBar_Pos[3] Then
            Return "Bottom Hidden"
        Else
            Return "Bottom"
        EndIf
    ElseIf $aTaskBar_Pos[0] > 0 Then
        ; Taskbar at RIGHT
        If $aTaskBar_Pos[0] > @DesktopWidth - $aTaskBar_Pos[2] Then
            Return "Right Hidden"
        Else
            Return "Right"
        EndIf
    ElseIf $aTaskBar_Pos[2] = @DesktopWidth Then
        ; Taskbar at TOP
        If $aTaskBar_Pos[1] < 0 Then
            Return "Top Hidden"
        Else
            Return "Top"
        EndIf
    ElseIf $aTaskBar_Pos[3] = @DesktopHeight Then
        ; Taskbar at LEFT
        If $aTaskBar_Pos[0] < 0 Then
            Return "Left Hidden"
        Else
            Return "Left"
        EndIf
    EndIf

EndFunc

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

@Melba23

Thank you, that is a beautiful, clear and educational example.:D

GerrOrneq,

How to find the taskbar (and whether it is hidden or not): :huggles:

ConsoleWrite(Find_Taskbar() & @CRLF)

Func Find_Taskbar()

    ; Find taskbar
    Local $iPrevMode = AutoItSetOption("WinTitleMatchMode", 4)
    Local $aTaskBar_Pos = WinGetPos("classname=Shell_TrayWnd")
    AutoItSetOption("WinTitleMatchMode", $iPrevMode)

    ; If error in finding taskbar
    If Not IsArray($aTaskBar_Pos) Then Return SetError(1, 0, "")

    ; Determine position of taskbar
    If $aTaskBar_Pos[1] > 0 Then
        ; Taskbar at BOTTOM
        If $aTaskBar_Pos[1] > @DesktopHeight - $aTaskBar_Pos[3] Then
            Return "Bottom Hidden"
        Else
            Return "Bottom"
        EndIf
    ElseIf $aTaskBar_Pos[0] > 0 Then
        ; Taskbar at RIGHT
        If $aTaskBar_Pos[0] > @DesktopWidth - $aTaskBar_Pos[2] Then
            Return "Right Hidden"
        Else
            Return "Right"
        EndIf
    ElseIf $aTaskBar_Pos[2] = @DesktopWidth Then
        ; Taskbar at TOP
        If $aTaskBar_Pos[1] < 0 Then
            Return "Top Hidden"
        Else
            Return "Top"
        EndIf
    ElseIf $aTaskBar_Pos[3] = @DesktopHeight Then
        ; Taskbar at LEFT
        If $aTaskBar_Pos[0] < 0 Then
            Return "Left Hidden"
        Else
            Return "Left"
        EndIf
    EndIf

EndFunc

M23

DeMo

Quote of the week:"BASIC programmers never die, they GOSUB and don't RETURN." -- UnknownWisdom of the ages:

  

  • I'd be unstoppable... if not for law enforcement and physics.
  • Marriage, the number 1 cause of divorce.
  • Don't steal... the government hates competition.
  • Irish Government Motto: We’ve got what it takes to take what you’ve got.
  • Birthdays are good for you. Statistics show that the people who have the most live the longest.
  • Failure is not an option. It comes bundled with your Microsoft product.-- Ferenc Mantfeld
  • If you learn from your mistakes, then why ain't I a genius?! -- Anonymous
  • Remember, live every day as if it was your last day! one day you will be right.
  • How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?
  • Sure my system is secure, it just locked up again.
  • I haven't lost my mind; I have a tape back-up somewhere.  ~Author Unknown
Link to comment
Share on other sites

  • 2 weeks later...

I haven't looked at the code, but I assume this should help the multimonitor people:

#include <Winapi.au3>
ConsoleWrite("Virtual W: " & _WinAPI_GetSystemMetrics(78) & @CRLF) ; SM_CXVIRTUALSCREEN
ConsoleWrite("Virtual H: " & _WinAPI_GetSystemMetrics(79) & @CRLF) ; SM_CYVIRTUALSCREEN
Edited by wraithdu
Link to comment
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
 Share

  • Recently Browsing   0 members

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