K3STROS

What is wrong with this?

2 posts in this topic

Global $Point = MouseGetPos()
Global $Point1 = PixelSearch(599, 499, 735, 567, 0xA95C1D, 5)

$Start_Exit_GUI = GUICreate("XXX", 228, 194, 398, 222) ; Opens GUI with start/exit buttons
GUISetBkColor(0x0000FF)

$Start_Botton = GUICtrlCreateButton("START", 0, 0, 227, 89, $WS_GROUP) ; Start button
GUICtrlSetFont(-1, 28, 400, 0, "Absolute Zero")
GUICtrlSetColor(-1, 0xFF00FF)
GUICtrlSetBkColor(-1, 0x00FF00)

$Exit_Button = GUICtrlCreateButton("EXIT", 0, 96, 227, 97, $WS_GROUP) ; Exit button
GUICtrlSetFont(-1, 28, 400, 0, "Absolute Zero")
GUICtrlSetColor(-1, 0xFFFF00)
GUICtrlSetBkColor(-1, 0xFF0000)

Func SearchExample()

        If IsArray($Point1) = Then

            MouseClick("Left", $Point[0], $Point[1])

        EndIf
        Sleep((Random, 990, 1990, 1))
EndFunc

i get this error message

(88) : ==> Error in expression.: 
If IsArray($Point1) = Then ; Line 88
If ^ ERROR

:mad:

Share this post


Link to post
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

  • Similar Content

    • chacoya121
      By chacoya121
      can anyone help me plz
      how can you put mouseclick in if statement or is it possible
      example:
      if Mouseclick = "left" then Tooltip(" you click left mouse") thank you
    • xgjengen
      By xgjengen
      Hey guys!
      Im new when it comes to scripting and i follow some videos on how to make clicks and such. So i will say i know the basics alrady.
      However, im having a really big problem
      When i run the script is works fine with the clicks and all. But if i run it one or two more times it just moves to very inaccurate positions. YES, i have tried mulitple times to change positions and such but no luck. My script is working its just so inaccurate that im unable to use it. Are there any solution for this?
      I have also set the camera to a specific position. I have also tried other camera angles, no luck there either. Making more smoother macro movements does not seem to work aswell.
      I have also tried to have clicks away from the minimap, since i know some youtuber had problem with inaccuracy because of this.
      I came here because i was googling and did not see anyone else having this problem, or mentioning it. So if someone have a solution, i would be happy!! All i have seen are people trying to change the resolution. But it has nothing to do with that. I heard someone mention controlmouseclick. However are there any differences? I have also A window selection in my script so it changes to the window the macro will be running in. Resolution is not changing or anything. I have also tried other macros and same problem there.
       
      Also does anyone know or can teach me how pixel search works? I want the macro to be able to click at the correct character instead of waiting for the character to get in the position its searching for.
    • Gordi300
      By Gordi300
      Hey everyone!! 
      I'm trying to make a program in VB.NET that click inside a picturebox of an app without moving the mouse (using ControlClick).
      My code is this:
      1) ControlClick("Form1", "", "[CLASS:PictureBox; INSTANCE:12]", "left", 1, 5, 5) 2) ControlClick("Form1", "", "[CLASS:PictureBox; INSTANCE:1]", "left", 1, 5, 5) The code is correct  but the problem is that 1) works perfectly and 2) doesn't work. 
      '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
      Here I leave you the summary of each picturebox:
      >>>> Window <<<<
      Title:    Form1
      Class:    Form
      Position:    168, 0
      Size:    1030, 780
      Style:    0x16CA0000
      ExStyle:    0x00040100
      Handle:    0x00000000000B0092
       
      >>>> Control <<<<                PICTUREBOX 12
      Class:    PictureBox
      Instance:    12
      ClassnameNN:    PictureBox12
      Name:    
      Advanced (Class):    [CLASS:PictureBox; INSTANCE:12]
      ID:    28
      Text:    
      Position:    305, 721
      Size:    40, 40
      Style:    0x56010000
      ExStyle:    0x00000004
      Handle:    0x0000000000040520
       
      >>>> Control <<<<                PICTUREBOX 1
      Class:    PictureBox
      Instance:    1
      ClassnameNN:    PictureBox1
      Name:    
      Advanced (Class):    [CLASS:PictureBox; INSTANCE:1]
      ID:    4
      Text:    
      Position:    4, 176
      Size:    700, 533
      Style:    0x56010000
      ExStyle:    0x00000004
      Handle:    0x00000000000E02BE
       
      Thank you for you help!!!
    • Leo1906
      By Leo1906
      Hello there
      I recently wanted to know how to differentiate between a mouse click and a touch click on controls in your GUI.
      This can be interesting when using picture controls as buttons in combination with this UDF here.
      No one could help me, so I tried my best to get it to work. And it works now! Unfortunately only for Windows 8 and above, as I had to use functions which are unavailable for older OS.
      Additionally this was my first time writing DLLCalls myself. I hope (and think) that there are no mayor mistakes in it,
       
      So here's the sample code:
      #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> OnAutoItExitRegister("_exit") $play = 'iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAAGz7rX1AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAA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XSUqiFvxkYGCZiK0UptQS9fMxDKnUPMjAwmFPbEnTAxcDAwEFtS/5D629JaH1nCvUNAzHVAT7wmoGBoQZatf8jNkyJAUcZGBgKGBgYzlArM0ZCK4WphFINsWbSpVgBDADB5DrGESuD0wAAAABJRU5ErkJggg==' $play = Binary(_WinAPI_Base64Decode($play)) $Form1 = GUICreate("Form1", 444, 372, -1, -1) $pic1 = GUICtrlCreatePic("", 184, 112, 65, 57) $pic1_dummy = GUICtrlCreateDummy() _GDIPlus_Startup() Global $play1 = _GDIPlus_BitmapCreateFromMemory($play, True) _WinAPI_DeleteObject(GUICtrlSendMsg($pic1, $STM_SETIMAGE, $IMAGE_BITMAP, $play1)) DllCall("User32.dll", "bool", "RegisterTouchHitTestingWindow", "HWND", $Form1, "ULONG", 1) ; register your GUI for recieving commands relatet to WM_TOUCHHITTESTING GUIRegisterMsg(0x024D, "WM_TOUCHHITTESTING") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $pic1_dummy MsgBox(0, 0, "touch-click") Case $Pic1 MsgBox(0, 0, "Mouseclick") EndSwitch WEnd Func WM_TOUCHHITTESTING($hWnd, $iMsg, $wParam, $lParam) Local $send = 1 Local $pic1_pos = _WinAPI_GetWindowRect(GUICtrlGetHandle($pic1)) Local $struct = DllStructCreate("uint;long X;long Y") ; first Parameter gives the accuracy of which this control is meant by a touch - second and third are the x/y points of the touch (not relative to GUI) DllCall("User32.dll", "bool", "EvaluateProximityToRect", "ptr", DllStructGetPtr($pic1_pos), "ptr", $lParam, "ptr", DllStructGetPtr($struct)) If DllStructGetData($struct, 1) < 20 Then ; if the proximity of the touch is near enough to the control (I chose 20, but you can vary yourself) then do something GUICtrlSendToDummy($pic1_dummy) ; you shouldn't do very intensive stuff inside the function itself. Outsource it to your main loop. $send = 0 ; no need to pass the command on to your GUI, as you take action yourself .. EndIf If $send Then _WinAPI_DefWindowProc($hWnd, $iMsg, $wParam, $lParam) EndFunc Func _WinAPI_Base64Decode($sB64String) Local $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(1, 0, "") Local $bBuffer = DllStructCreate("byte[" & $aCrypt[5] & "]") $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "struct*", $bBuffer, "dword*", $aCrypt[5], "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(2, 0, "") Return DllStructGetData($bBuffer, 1) EndFunc Func _exit() _WinAPI_DeleteObject($play1) _GDIPlus_Shutdown() EndFunc The magic happens in the WM_TOUCHHITTESTING function.
      The _WinAPI_Base64Decode is written by @UEZ (as well as the way to use PNG as button (from binary) - thanks for that!)
      On Windows 7 there is the WM_TOUCH function which should handle touch events, but I couldn't get it to work on controls ..??
      If you will get the x/y coordinates of a touch (even when you touch on controls) you could make the "EvaluateProximityToRect" check yourself - as this function is not available in Windows 7. Shouldn't be that hard.
      Btw.: this here is the MSDN articel related to this topic: https://msdn.microsoft.com/en-us/library/windows/desktop/hh454931(v=vs.85).aspx
      So thats it. Any questions and comments welcome!
      greetz,
      Leo
    • Dequality
      By Dequality
      I'm currently wondering if there is somehow to actually make autoit click inside a minimized program? & sent keystrokes ? 
      2nd question, how can i make it do a mouse click at e.g. x200,y200 while the are at like x354,y313 (This is purely an example.) would love to be able to do other shizz on my pc while the script is running if possible.
      If this ISNT possible can u recommend a language / other scripting program which are able to do this ? willing to start over learning a new coding/scripting language.
       
      -Dequality.