Jump to content

Animated gif under/around mouse pointer


myspacee
 Share

Recommended Posts

hello to all,

working on clipput clipget stuf.

Is possible when i put something in clipboard (text) load a small animated gif

that lies under/around my mouse pointer ? (maybe a small blinking star)

want fun way to inform user that something is in clipboard...

(apologize for strange request, but is late... :mellow: )

m.

Link to comment
Share on other sites

hello to all,

working on clipput clipget stuf.

Is possible when i put something in clipboard (text) load a small animated gif

that lies under/around my mouse pointer ? (maybe a small blinking star)

want fun way to inform user that something is in clipboard...

(apologize for strange request, but is late... :mellow: )

m.

You could do something like this. (preferably a bit better organised.) I have used a small label but you could put an icon or a pic like merlin if you make the gui large enough.

#include <GuiConstants.au3>
#include <windowsconstants.au3>
Global Const $WS_EX_COMPOSITED = 0x2000000
Global $fade = 100, $way = 5
HotKeySet("{ESC}", "QuitApp")
Global $Startx, $Starty, $Endx, $Endy, $aM_Mask, $aMask, $nc
Global $gw = 12, $gh = 20
$Main_Gui = GUICreate("nahuel", $gw, $gh, 0, 0, $WS_POPUP, BitOR($WS_EX_COMPOSITED, $WS_EX_TOOLWINDOW, $WS_EX_TOPMOST))

;GUICtrlCreatePic(@SystemDir & "\oobe\images\merlin.gif", 0, 0, 68,71)
GUICtrlCreatelabel("*",0,0,10,20)
GUICtrlSetFont(-1,20,400)
GUICtrlSetColor(-1,0xff0000)

Opt("PixelCoordMode", 2)
GUISetState()
GUISetBkColor(0)

setTrans()
AdlibEnable("chase", 20)

While 1
    $Msg = GUIGetMsg()
    Switch $Msg

        Case - 3
            Exit
    EndSwitch

WEnd

Func setTrans()

    $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 460, "long", 460)

    $rct = DllStructCreate("int;int;int;inr", $aM_Mask[0])
    $TestCol = PixelGetColor(1, 1);<----------------------------set coords for your test colour here
;anything on the window which is the same colour as $TestCol will become transparent
    $Startx = -1
    $Starty = -1
    $Endx = 0
    $Endy = 0

    For $i = 0 To $gw;the window width
        For $j = 0 To $gh;the window height
            If PixelGetColor($i, $j) = $TestCol And $j < $gh Then

                If $Startx = -1 Then;start a new region
                    $Startx = $i
                    $Starty = $j
                    $Endx = $i
                    $Endy = $j
                Else;region already started so extend the end
                    $Endx = $i
                    $Endy = $j
                EndIf
            Else;not testcol or at end of line
                If $Startx <> -1 Then addRegion()

                $Startx = -1
                $Starty = -1
            EndIf
        Next
    Next
    DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $Main_Gui, "long", $aM_Mask[0], "int", 1)
EndFunc  ;==>setTrans

Func addRegion()
    $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $Startx, "long", $Starty, "long", $Endx + 1, "long", $Endy + 1)
    $nc += 1
    DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 3)
EndFunc  ;==>addRegion


Func QuitApp()
    Exit
EndFunc  ;==>QuitApp

Func chase()
    $mp = MouseGetPos()
    WinMove($Main_Gui, "", $mp[0] + 10, $mp[1] + 10)
    $fade += $way
    If $fade > 200 Or $fade < 40 Then $way = -$way
    WinSetTrans($Main_Gui, "", $fade)

EndFunc  ;==>chase
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

  • 3 months later...

sorry for retake post,

this script made blinking red char near your mouse using GDI.

Any way to deactivate it after loading ?

m.

If you mean turn off the character then add these 2 lines before the while loop

HotKeySet("{F10}","turnoff")
HotKeySet("{F11}","turnon")

and add these 2 functions somewhere

Func Turnoff()
    
    GUISetState(@SW_HIDE)
    AdlibDisable()
EndFunc

Func turnon()
    GUISetState(@SW_SHOW)
    AdlibEnable("chase", 20)
EndFunc
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

  • 3 years later...

Hello again,

need this script again but with last AI version return arror on var declaration:

: ==> Can not redeclare a constant.:
Global Const $WS_EX_COMPOSITED = 0x2000000
Global Const ^ ERROR

how correct ?

thank you,

m.

Edited by myspacee
Link to comment
Share on other sites

Maybe read the error message and perhaps you shouldn't be redeclaring the constant variable?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Thank you for reply,

try before post, return another error :

==> Unknown function name.:
AdlibEnable("chase", 20)

don't see AdlibEnable function in script, can't understand how it use "chase" function....

m.

EDIT:

read vesion history changes, and find :

15th January, 2010 - v3.3.4.0 - AdlibEnable() and AdlibDisable() have been removed. See the new functions AdlibRegister() and AdlibUnRegister().

so :

- comment $WS_EX_COMPOSITED

- replace AdlibEnable("chase", 20) with AdlibRegister("chase", 20)

solve.

i'm searching now a valid basic IQ test before post

Edited by myspacee
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...