jvanegmond Posted July 20, 2006 Posted July 20, 2006 No, i ment after the modifications we made. github.com/jvanegmond
Azu Posted July 20, 2006 Author Posted July 20, 2006 (edited) I didn't make any modification besides what I said I did.. I still don't know how to make the x y coordinates work with the int or whatever.. =\ Edited July 20, 2006 by Azu
Moderators SmOke_N Posted July 20, 2006 Moderators Posted July 20, 2006 I modified it, and it isn't working for me either Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
themax90 Posted July 20, 2006 Posted July 20, 2006 Here are a few ControlSend things I picked up looking for botting in AutoIt: expandcollapse popupFunc _ControlMouseClick($Window, $Button = "Left", $X = "", $Y = "", $Clicks = 1) Local $MK_LBUTTON = 0x0001 Local $WM_LBUTTONDOWN = 0x0201 Local $WM_LBUTTONUP = 0x0202 Local $MK_RBUTTON = 0x0002 Local $WM_RBUTTONDOWN = 0x0204 Local $WM_RBUTTONUP = 0x0205 Local $WM_MOUSEMOVE = 0x0200 Local $i = 0 Select Case $Button = "Left" $Button = $MK_LBUTTON $ButtonDown = $WM_LBUTTONDOWN $ButtonUp = $WM_LBUTTONUP Case $Button = "Right" $Button = $MK_RBUTTON $ButtonDown = $WM_RBUTTONDOWN $ButtonUp = $WM_RBUTTONUP EndSelect If $X = "" Or $Y = "" Then $MouseCoord = MouseGetPos() $X = $MouseCoord[0] $Y = $MouseCoord[1] EndIf For $i = 1 To $Clicks DllCall("user32.dll", "int", "SendMessage", _ "hwnd", WinGetHandle($Window), _ "int", $WM_MOUSEMOVE, _ "int", 0, _ "long", _MakeLong ($X, $Y)) DllCall("user32.dll", "int", "SendMessage", _ "hwnd", WinGetHandle($Window), _ "int", $ButtonDown, _ "int", $Button, _ "long", _MakeLong ($X, $Y)) DllCall("user32.dll", "int", "SendMessage", _ "hwnd", WinGetHandle($Window), _ "int", $ButtonUp, _ "int", $Button, _ "long", _MakeLong ($X, $Y)) Next EndFunc ;==>_ControlMouseClick ; http://www.autoitscript.com/forum/index.php?showtopic=3307&hl=ControlSendPlus*# Func ControlSendPlus($title, $text, $className, $string, $flag) ;VERSION 2.0.3 (06/13/2004) Local $ctrl = 0, $alt = 0, $upper, $start, $end, $i, $char, $and, $Chr5Index, $isUpper, $ret If $flag = 2 Or $flag = 3 Then $ctrl = 1 If $flag = 2 Or $flag = 4 Then $alt = 1 If $flag <> 1 Then $flag = 0;set the flag to the default function style $upper = StringSplit('~!@#$%^&*()_+|{}:"<>?ABCDEFGHIJKLMNOPQRSTUVWXYZ', "") If $flag <> 1 Then;don't replace special chars if it's raw mode ;replace {{} and {}} with +[ and +] so they will be displayed properly $string = StringReplace($string, "{{}", "+[") $string = StringReplace($string, "{}}", "+]") ;replace all special chars with Chr(5) ;add the special char to an array. each Chr(5) corresponds with an element Local $Chr5[StringLen($string) / 2 + 1] For $i = 1 To StringLen($string) $start = StringInStr($string, "{") If $start = 0 Then ExitLoop;no more open braces, so no more special chars $end = StringInStr($string, "}") If $end = 0 Then ExitLoop;no more close braces, so no more special chars ;parse inside of braces: $Chr5[$i] = StringMid($string, $start, $end - $start + 1) ;replace with Chr(5) leaving the rest of the string: $string = StringMid($string, 1, $start - 1) & Chr(5) & _ StringMid($string, $end + 1, StringLen($string)) Next ;take out any "!", "^", or "+" characters ;add them to the $Modifiers array to be used durring key sending Local $Modifiers[StringLen($string) + 1] For $i = 1 To StringLen($string) $char = StringMid($string, $i, 1) $and = 0 If $char = "+" Then $and = 1 ElseIf $char = "^" Then $and = 2 ElseIf $char = "!" Then $and = 4 ElseIf $char = "" Then ExitLoop EndIf If $and <> 0 Then $Modifiers[$i] = BitOR($Modifiers[$i], $and) $string = StringMid($string, 1, $i - 1) & _ StringMid($string, $i + 1, StringLen($string)) $i = $i - 1 EndIf Next Else;it is raw mode, so set up an all-0 modifier array Local $Modifiers[StringLen($string) + 1] EndIf ;now send the chars $Chr5Index = 1 For $i = 1 To StringLen($string) $char = StringMid($string, $i, 1) If $char = Chr(5) Then $char = $Chr5[$Chr5Index] $Chr5Index = $Chr5Index + 1 EndIf $isUpper = 0 For $j = 1 To UBound($upper) - 1 If $char == $upper[$j] Then $isUpper = 1 Next ;1 SHIFT, 2 CTRL, 4 ALT (programmer note to keep the bits straight) If $isUpper = 1 Or BitAND($Modifiers[$i], 1) = 1 Then Send("{SHIFTDOWN}") If BitAND($Modifiers[$i], 4) = 4 And Not $alt Then $char = "!" & $char If BitAND($Modifiers[$i], 2) = 2 And Not $ctrl Then $char = "^" & $char If BitAND($Modifiers[$i], 4) = 4 And $alt Then Send("{ALTDOWN}") If BitAND($Modifiers[$i], 2) = 2 And $ctrl Then Send("{CTRLDOWN}") $ret = ControlSend($title, $text, $className, $char, $flag) If BitAND($Modifiers[$i], 4) = 4 And $alt Then Send("{ALTUP}") If BitAND($Modifiers[$i], 2) = 2 And $ctrl Then Send("{CTRLUP}") If $isUpper = 1 Or BitAND($Modifiers[$i], 1) = 1 Then Send("{SHIFTUP}") If Not $ret Then Return 0;window or control not found Next Return 1 EndFunc ;==>ControlSendPlus If you can send text, and click to a window, it should be no problem. I don't know if this helps, but it's a snippet.
Azu Posted July 20, 2006 Author Posted July 20, 2006 I don't know what I'm doing wrong but it still doesn't seem to be working when I try it.. Is there some kind of simple command that works like mouseclick except I put in the name of the window for it to use? That would be very handy!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now