Jump to content

_CursorActivate


Skrip
 Share

Recommended Posts

Activates the message after a combination of cursor changes.

In this given example move the mouse change to an IBeam, then Arrow, then repeat.

$pass = 1
While 1
    $1 = MouseGetCursor()
    _CursorActivate(0, 5);5 = IBeam
    _CursorActivate(1, 2);2 = Arrow
    _CursorActivate(2, 5)
    _CursorActivate(3, 2)
    _CursorActivate(4, 5)
    _CursorActivate(5, 2)
    _CursorActivate(6, 5)
    _CursorActivate(7, 2, 7, "Works!")
WEnd

Func _CursorActivate($pass_number, $cursor, $done=0, $done_message="")
; Description:          _CursorActivate
; Parameter(s):     $pass_number = The function number.
;                   $cursor = Cursor number you want to find.
;                   $done = If this is the last part to activate the done message.
;                   $done_message = Message to display if done is activated.
;
; Requirement:      Must have a $1 varible for MouseGetCursor()
;                   Must have a varible $pass = 1
;                   Best used within While.
;
; User CallTip:     _CursorActivate($pass_number, $cursor, [$done=0, [$done_message="")
; Author(s):        Firestorm
; Notes:            Check the help file for cursor numbers.

;~  ToolTip($pass, 1, 1)
    If $pass = $pass_number Then
        If $done = 0 Then
            If $1 = $cursor Then
                $pass = $pass_number + 1
            EndIf
        EndIf
            If $pass = $done Then
                    MsgBox(0, "", $done_message)
                    $pass = 0
            EndIf
    EndIf
EndFunc

Very simple. But useful.

Edited by Firestorm

[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]

Link to comment
Share on other sites

Activates the message after a combination of cursor changes.

Very simple. But useful.

It's not obvious to me how this is useful. Can you give an example of where it would be used?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Maybe increased security for a password program. That's what I'd use it for.

[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]

Link to comment
Share on other sites

I don't want to sound insulting, but in my opinion, that whole block of code is garbage.

The only thing the code will actually do is show a MsgBox when two variables are equal. You don't have any sort of loop for detection of the cursor, you only check once at the very beginning, so what good does it really do? Also, $1 doesn't make any sense. Why would you use a number as a variable name? Does that even work?

Edited by Richard Robertson
Link to comment
Share on other sites

The only thing the code will actually do is show a MsgBox when two variables are equal.

Not that hard to make it a function..

Why would you use a number as a variable name?

I guess I wasn't thinking too well at the time.

Does that even work?

Why wouldn't it work?

[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]

Link to comment
Share on other sites

Hmm, very neat idea. Could you further your explanation on how this would help the security of a password program, Firestorm?

Okay. Let's say you have a GUI box. You have 2 things, a button ("Confirm"), and an input ("Enter password"). Then you type in your password. And (from remembering what to do) to must move your mouse to the input box (changing the cursor to an IBeam). Then press tab, highlighting the Confirm button, and press enter.

Example!

#include <GUIConstants.au3>
$pass = 1
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("", 354, 125, 193, 115)
$Input1 = GUICtrlCreateInput("Enter Password..", 16, 32, 321, 21)
$Button1 = GUICtrlCreateButton("Confirm", 72, 72, 195, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $read = GUICtrlRead($Input1)
            $1 = MouseGetCursor()
            _CursorActivate(1, 5)
            _CursorActivate(2, 5, 2)
    EndSwitch
WEnd

Func check()
    If $read = "test" Then
        MsgBox(0, "", "Win!")
    EndIf
EndFunc

Func _CursorActivate($pass_number, $cursor, $done=0, $done_message="")
; Description:          _CursorActivate
; Parameter(s):     $pass_number = The function number.
;                   $cursor = Cursor number you want to find.
;                   $done = If this is the last part to activate the done message.
;                   $done_message = Message to display if done is activated.
;
; Requirement:      Must have a $1 varible for MouseGetCursor()
;                   Must have a varible $pass = 1
;                   Best used within While.
;
; User CallTip:     _CursorActivate($pass_number, $cursor, [$done=0, [$done_message="")
; Author(s):        Firestorm
; Notes:            Check the help file for cursor numbers.

;~  ToolTip($pass, 1, 1)
    If $pass = $pass_number Then
        If $done = 0 Then
            If $1 = $cursor Then
                $pass = $pass_number + 1
            EndIf
        EndIf
            If $pass = $done Then
                    check(); MINOR modifcation.
                    $pass = 0
            EndIf
    EndIf
EndFunc
Edited by Firestorm

[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]

Link to comment
Share on other sites

It would be much more secure if you used valuater's hover function so that the mouse had to be over that control as opposed to being an I beam anywhere. Aside from all of this, thanks for sharing your ideas and examples, keep up the great work!

- Dan [Website]

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...