VB.NET-Quellcode
- Imports System.Runtime.InteropServices
- Imports AutoItX3Lib
- Public Class Form1
- Dim a As New AutoItX3Lib.AutoItX3
- Dim AutoIt As New AutoItX3Lib.AutoItX3
- Dim Toleranz As Integer = 0
- Dim Fenstername As String = "WDExpress.exe"
- Dim Bild As String
- Dim Bild2 = Bild
- Public Function ImageSearch(ByVal x1 As Integer, ByVal y1 As Integer, ByVal right As Integer, ByVal bottom As Integer, ByVal findImage As String) As String
- End Function
- Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- End Sub
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- Dim AutoIt As New AutoItX3Lib.AutoItX3
- Dim p As Point = ImageSearch("E:\Users\Saimo\Desktop\vstudio.png", True)
- AutoIt.MouseClick("Left", p.X, p.Y, 2)
- End Sub
- Function ImageSearch(ByVal Bild As String, Optional ByVal Mitte As Boolean = True) As Point
- If Not IO.File.Exists(Bild) Then
- MessageBox.Show("Die Datei " & Bild2 & "konnte nicht gefunden werden. Das Programm wird beendet.")
- End
- End If
- If Toleranz > 0 Then Bild = "*" & Toleranz & " " & Bild
- Dim x As String = ImageSearch(a.WinGetCaretPosX(), a.WinGetCaretPosY(), a.WinGetCaretPosX() + a.WinGetClientSizeWidth(Fenstername), a.WinGetCaretPosY() + a.WinGetClientSizeHeight(Fenstername), Bild)
- If x = "0" Then
- MessageBox.Show("Das Bild " & Bild2 & " konnte nicht auf dem Bildschirm gefunden werden. Das Programm wird beendet.")
- End
- Else
- Dim y = x.Split("|")
- If Mitte = True Then
- Return Point.Subtract(New Point(y(1), y(2)), New Size(y(3) \ -2, y(4) \ -2))
- Else
- Return New Point(y(1), y(2))
- End If
- End If
- End Function
- End Class
Ich bekomme diesen Fehler:
Ich verstehe nicht was das bedeuten soll.
Habe es auch mit verschiedenen Bildern versucht.
Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von „Saimo“ ()