[Gambas-user] desktop mouse
Gianluigi
bagonergi at gmail.com
Tue Apr 5 17:01:07 CEST 2022
Il giorno mar 5 apr 2022 alle ore 16:00 Gianluigi <bagonergi at gmail.com> ha
scritto:
>
>
> Il giorno dom 3 apr 2022 alle ore 06:09 Shane <buster6seven at gmail.com> ha
> scritto:
>
>> Hi Everyone I'm trying to move the mouse automaticallyon the desktop and
>> click. I can use "Mouse.Move" to move the mouse on the desktop but is
>> there anyway to click?
>>
>> Cheers Shane
>>
>
> Hi Shane,
> I don't know if this is what you want, but if there is at least one
> 'link', 'launcher', folder? on the desktop that is not 'home' and you
> create an executable, put it on the desktop and run it....
>
> I copied from Fabien and vuott's codes ;-)
> '-----------------------------------
> Private $hPicture As Picture
> Private hDrawing As DrawingArea
> Private hTimer As Timer
> Private $fStartX As Float
> Private $fStartY As Float
> Private $fEndX As Float
> Private $fEndY As Float
> Private $aNames As String[]
>
> Public Sub Form_KeyPress()
>
> If Key.Code = Key.Esc Then Me.Close
>
> End
>
> Public Sub Form_Open()
>
> Dim sNames As String
> Dim aPoints As Float[] = [6, 2.25, 26, 17.25, 20.5, 20.75, 24.25, 27.75,
> 19.25, 30.5, 15.25, 23.75, 9.25, 26.75, 5.75, 2.25]
>
> $hPicture = New Picture(32, 32, True)
> With Paint
> .Begin($hPicture)
> .Brush = .Color(Color.Green)
> .Polygon(aPoints)
> .Fill
> .End
> End With
>
> With Me
> .Border = False
> .Width = Screen.AvailableWidth
> .Height = Screen.AvailableHeight
> .Arrangement = Arrange.Vertical
> .SkipTaskbar = True
> '.Tracking = True ' for mouse use
> .Transparent = True
> End With
> $fStartX = Me.W - 64
> $fStartY = Me.H - 64
> With hDrawing = New DrawingArea(Me) As "DrawingArea1"
> .Expand = True
> .Refresh
> End With
>
> Shell "gio list '" & Desktop.Path & "'" To sNames
> If sNames Then
> $aNames = Split(sNames, "\n", Null, True)
> For i As Integer = 0 To $aNames.Max
> Print $aNames[i]
> Next
> Shell "gio info '" & Desktop.Path &/ $aNames[$aNames.Max] & "'" To
> sNames
> If sNames Then
> $fEndX = Val(Scan(sNames, "*icon-position: *,*\n*")[1])
> $fEndY = Val(Scan(sNames, "*icon-position: *,*\n*")[2])
> Else
> Message.Warning(("Unable to continue"))
> Me.Close
> Endif
> With hTimer = New Timer(5) As "Timer1"
> .Start
> End With
> Else
> Message.Warning(("Unable to continue"))
> Me.Close
> Endif
>
> End
>
> Public Sub DrawingArea1_Draw()
>
> Paint.Begin(hDrawing)
> Paint.DrawPicture($hPicture, $fStartX, $fStartY, 32, 32)
> Paint.Fill()
> Paint.End
>
> End
>
> Public Sub Timer1_Timer()
>
> Dec $fStartY
> Dec $fStartX
> Dec $fStartX
> hDrawing.Refresh
> If $fStartY <= $fEndY Then $fStartY = $fEndY
> If $fStartX <= $fEndX Then $fStartX = $fEndX
> If $fStartY <= $fEndY And $fStartX <= $fEndX Then
> hTimer.Stop
> Shell "gio open '" & Desktop.Path &/ $aNames[$aNames.Max] & "'"
> Me.Close
> Endif
>
> End
> '--------------------------
>
Sorry,
I forgot to mention that you need to check the gb.desktop component
> Regards
> Gianluigi
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20220405/af189e77/attachment.htm>
More information about the User
mailing list