Jump to content

help.. cant find commands!


Recommended Posts

ClickInControl()

_MouseClickPlus()

ControlSendPlus()

can someone tell me where i can find these commands or give me the info on them..

if you give info can you please make it look like this :whistle:

ControlClick- Sends a mouse click command to a given control.

ControlClick ( "title", "text", controlID [, button] [, clicks]] )

Parameters

Title - the title of the window to access.

Text - the text of the window to access.

ControlID - the control to ineract with. (put link if one).

Button - [optional] The button to click, "left", "right" or "middle". Default is the left button.

Clicks - [optional] The number of times to click the mouse. Default is 1.

Edited by Golbez
Link to comment
Share on other sites

and how do u to the <include> function to work properly?

Take the UDFs and put them in this folder (Default autoit beta install)

C:\Program Files\Autoit3\Beta\Include

then in your script, say

#Include <Name_Of_File.au3>

I'm wondering about the Scite thing too

Edited by Paulie
Link to comment
Share on other sites

  • Moderators

is there a special place i should save them on my computer so when i type it in SciTE it will show up with the help tip.

and how do u to the <include> function to work properly?

#include "C:\FolderLocation\UDF.au3"

Or put them in your standard #include folder in the AutoIt3 folder and just put #include <UDF.au3>

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.

Link to comment
Share on other sites

Opt ("WinTitleMatchMode", 4 )
Opt ("MouseCoordMode", 0)

;===============================================================================
;
; Function Name:  _MouseClickPlus()
; Version added:  0.1
; Description:  Sends a click to window, not entirely accurate, but works
;                minimized.
; Parameter(s):   $Window    =  Title of the window to send click to
;                $Button     =  "left" or "right" mouse button
;                $X       =  X coordinate
;                $Y       =  Y coordinate
;                $Clicks     =  Number of clicks to send
; Remarks:      You MUST be in "MouseCoordMode" 0 to use this without bugs.
; Author(s):      Insolence <insolence_9@yahoo.com>
;
;===============================================================================
Func _MouseClickPlus($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


;===============================================================================
;
; Function Name:  ClickInControl("button", "Title", "Text", ControlID, x, y)
; Version added:  
; Description:  Sends a click to window, not entirely accurate, but works
;                minimized.
; Parameter(s):   Button     =  "left" or "right" mouse button
;                 Title      =  The title of the window to access.
;                 Text       =  The text of the window to access.
;                ControlID   =  The control to interact with. See Controls.
;                X        =  X coordinate
;                Y        =  Y coordinate
; Remarks:      You MUST be in "WinTitleMatchMode" 4 to use this without bugs.
; Author(s):     
;
;===============================================================================
Func ClickInControl( $szLR, $szTitle, $szText, $szControl, $nX, $nY )
  If $szLR <> "left" And $szLR <> "right" Then Return 0
  $hWnd = ControlGetHandle( $szTitle, $szText, $szControl )
  If @error Then Return 0
  $hWndDad = WinGetHandle( $szTitle, $szText )
  If @error Then Return 0
  $me = DLLCall( "kernel32.dll", "long", "GetCurrentThreadId" )
  $you = DLLCall( "user32.dll", "long", "GetWindowThreadProcessId", "hwnd", $hWndDad, "long_ptr", 0)
  $coord = _MakeLong( $nX, $nY )
  If $szLR = "left" Then
     $msg1 = 0x0201;WM_LBUTTONDOWN
     $msg2 = 0x0202;WM_LBUTTONUP
     $i = 0x0001;MK_LBUTTON
  Else
     $msg1 = 0x0204;WM_RBUTTONDOWN
     $msg2 = 0x0205;WM_RBUTTONUP
     $i = 0x0002;MK_RBUTTON
  EndIf
  $ret = DLLCall("user32.dll","int","AttachThreadInput","long",$me[0],"long",$you[0],"int",1)
  If $ret[0] = 0 Then Return 0
  $ret = DLLCall("user32.dll","long","PostMessage","hwnd",$hWnd,"int",$msg1,"int",$i,"int",$coord)
  If $ret[0] = 0 Then Return 0
  Sleep(100)
  $ret = DLLCall("user32.dll","long","PostMessage","hwnd",$hWnd,"int",$msg2,"int",0,"int",$coord)
  If $ret[0] = 0 Then Return 0
  DLLCall("user32.dll","int","AttachThreadInput","long",$me[0],"long",$you[0],"int",0)
  If $ret[0] = 0 Then Return 0
  Return 1
EndFunc

;===============================================================================
;
; Function Name:  ControlSendPlus("title", "text", "classnameNN", "string", flag) 
; Version added:  2.03 
; Description:  This function is designed to replace the built-in ControlSend function. 
;                 It will correctly handle the shift state (using the global state to
;                  send the required keys) as well as the control and alt key modifiers.
; Parameter(s):   Title - the title of the window to access.
;                 Text - the text of the window to access.
;                 ControlID - the control to ineract with. (put link if one).
;                 Button - [optional] The button to click, "left", "right" or "middle". Default is the left button.
;                 Clicks - [optional] The number of times to click the mouse. Default is 1.
;  The 'flag' parameter is a bit different. Consult the table below. Note that in
;   all of these modes the global shift state is used to properly send
;   characters.
;   0 - Default behavior. Special characters like {ENTER} and {UP} are sent to
;     the control. The '!', '^', and '+' are alt, control, and shift
;     accordingly. All modifier keys are sent LOCALLY.
;   1 - Raw mode. Keys are sent as they appear in the "string" parameter.
;   2 - Global mode. Identical to mode 0, but the control and alt keystrokes are
;     sent globally. See NOTE 1 below.
;   3 - Global Ctrl mode.  Identical to mode 0, but control keystrokes are sent
;     globally (alt keystrokes are local.) See NOTE 1 below.
;   4 - Global Alt mode.  Identical to mode 0, but alt keystrokes are sent
;     globally (control keystrokes are local.) 
; NOTE 1: Some applications will not properly use the local alt and/ or control;
;           keystroke. This is why the additional 3 flags were added. To discover the
;           proper flag to use for you particular application, you will have to try out
;           the different flags. Sometimes both local and global mode work, and other
;           times only one will.
; Author(s):      pekster
;
;===============================================================================

#include-once
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

Func Terminate()
    Exit 0
EndFunc

Func _MakeLong($LoWord,$HiWord)
  Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF))
EndFunc

i put this here for other noobies that go looken 4 it :whistle:

Link to comment
Share on other sites

I'm wondering about the Scite thing too

i think i might habe found a away 2 put it into SciTE. not sure tho.

http://www.autoitscript.com/autoit3/scite/downloads.php

i started looken around and i found this:

au3.keyword.properties 5/18/2005 AutoIt v3.1.1.0 keyword definitions for SciTE.

au3.api 5/18/2005 AutoIt v3.1.1.0 AutoComplete definitions for SciTE.

well when i opened it i found it gave all the definitions..

not sure how 2 edit it tho. i think if i just put what i want there it would work but im not sure.

Edit1: well when i tried add my own command into these files i got it to go in the drop box.

file1: C:\Program Files\AutoIt3\SciTE\api\au3.api

file2: C:\Program Files\AutoIt3\SciTE\au3.keywords.properties

going to try 2 find out how to make it so it shows the info now

Edit2: yup this is the way. i plan on puting all new functions into this for everyone :whistle:

Edit3: you just have to edit the au3.api, but if you want it to find the command in the help file you have to edit both.

Edited by Golbez
Link to comment
Share on other sites

  • Developers

i think i might habe found a away 2 put it into SciTE. not sure tho.

http://www.autoitscript.com/autoit3/scite/downloads.php

i started looken around and i found this:

well when i opened it i found it gave all the definitions..

not sure how 2 edit it tho. i think if i just put what i want there it would work but im not sure.

Edit1: well when i tried add my own command into these files i got it to go in the drop box.

file1: C:\Program Files\AutoIt3\SciTE\api\au3.api

file2: C:\Program Files\AutoIt3\SciTE\au3.keywords.properties

going to try 2 find out how to make it so it shows the info now

Have you looked at "User CallTips" ?

By the way, if you update those 2 files you will loose all your changes with the next time you update ...

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Have you looked at "User CallTips" ?

By the way, if you update those 2 files you will loose all your changes with the next time you update ...

i love u :):whistle:

edit: is there a away so i dont have to inclue anything? (like put the commands i want in the place where the others are.) {my friends dont have autoit and i want 2 make programs for them, but they wont install autoit so i need a way 2 put it in with out putting the function in the program}

Edited by Golbez
Link to comment
Share on other sites

  • Developers

edit: is there a away so i dont have to inclue anything? (like put the commands i want in the place where the others are.) {my friends dont have autoit and i want 2 make programs for them, but they wont install autoit so i need a way 2 put it in with out putting the function in the program}

No idea what you are talking about.

If your friend doesn't have AutoIt3 I assume you compile your script ...right ?

If so..Included files are emm .. included.

:whistle:

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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...