Sign in to follow this  
Followers 0
motormad

Button with array

13 posts in this topic

Hello,

I got 10 buttons called $DButton1-$DButton2,$DButton3 etc ...

i can make the 'while' function like this

While 1                                                                                             ; //Initialize loop
    $msg = GUIGetMsg()                                                                              ; //Recive Input
    Select
        Case $msg = $GUI_EVENT_CLOSE or $msg = $Exit                                                ; //If the Exit or Close button is clicked, close the app.
            MsgBox(0, "Terminate", "SALU")  
            ; //Say goodbye
    
            Exit                                                                                    ; //Exit the Application
        Case $msg = $OKbutton
            KlikOK()
            
        Case $msg = $DButton1
            Klik_DButton1() 
            
        Case $msg = $DButton2
            Klik_DButton2() 
            
        Case $msg = $DButton3
            Klik_DButton3() 
    
    EndSelect
WEnd

and then work them out like this

func Klik_DButton1()


GUICtrlSetData($STA1 ,GUICtrlRead($MonthCal1))

EndFunc ;--> Klik_DButton1()

    
func Klik_DButton2()


GUICtrlSetData($STA2 ,GUICtrlRead($MonthCal1))

EndFunc ;--> Klik_DButton2()

because i want to put the date in $STA1,$STA2,$STA3 etcc.

But this probebly can be done with array's

I like to know the best way to solve this.

Thanx verry much for your help so i can learn ;)

Share this post


Link to post
Share on other sites



First, use an array to store the controls:

Local $DButton[11]
Local $STA[11]

$DButton[1] = ...
$STA[1] = ...

Then loop through all the buttons in

While 1                                                                                             ; //Initialize loop
    $msg = GUIGetMsg()                                                                              ; //Recive Input
    Select
        Case $msg = $GUI_EVENT_CLOSE or $msg = $Exit                                                ; //If the Exit or Close button is clicked, close the app.
            MsgBox(0, "Terminate", "SALU")  
            ; //Say goodbye
    
            Exit                                                                                    ; //Exit the Application
        Case $msg = $OKbutton
            KlikOK()

        Case 0 ; No message (stops us having to loop through when there's nothing there.

        Case Else
            For $i = 1 to 10
                If $msg = $DButton[$i] Then GUICtrlSetData($STA[$i], GUICtrlRead($MonthCal1))
            Next
    
    EndSelect
WEnd

Mat

Share this post


Link to post
Share on other sites

Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded.

?

I only got 6 buttons and i putted

Local $DButton[10]

Local $STA[10]

after the 'include' statments

Share this post


Link to post
Share on other sites

Arrays start counting at 0, so "Local $DButton[10]" means you create an array with rows 0-9. Row 10 does not exist.

;Replace
Local $STA[10] ;10 is a static value you'd have to adjust to match the size of $DButton
;with
Local $STA[UBound($DButton)] ;Ubound gets the size of $DButton, so $STA will be the same size
;note: this isn't the part that gave you the error. You adjusted it correctly, but this way it's automatic.


;Replace
For $i = 1 to 10 ;10 is a static value. You should have adjusted this to 9, when you changed the size of $DButton and $STA.
;with
For $i = 1 to UBound($DButton) -1 ;Ubound gets the size of $DButton. The loop should stop when $i gets to the last row. This was causing the error.

I've posted a few things to keep in mind when using arrays here (in the spoiler tag), but make sure you read about them in the helpfile too.

Share this post


Link to post
Share on other sites

Display the array's index value just before the line where the error occurred. You can use either MsgBox or ConsoleWrite.


Hi ;)

Share this post


Link to post
Share on other sites

like MsgBox $STA

gives mre errors

Share this post


Link to post
Share on other sites

Have you applied the changes you suggested? If you still get errors with them, post the entire scrpt please.

Share this post


Link to post
Share on other sites

# Script Start - Add your code below here
#Region ### 
;;================================================================================
;;INCLUDES
;;================================================================================

#include<Date.au3>
#include <ButtonConstants.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

dim $DaAatUm
$DaAatUm = _NowDate()
Local $DButton[10]
Local $STA[10]



#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Motar8500\Bureaublad\Form1_1.kxf

$Form1_1 = GUICreate("ATI VERGUNNINGEN MAKEN", 643, 250, 207, 180)
$OKButton = GUICtrlCreateButton("GO", 424, 210, 97, 30, $WS_GROUP)
GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
$Label1 = GUICtrlCreateLabel("AANTAL", 70, 16, 50, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Label3 = GUICtrlCreateLabel("PERSONEN", 70, 32, 50, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Label4 = GUICtrlCreateLabel("AANTAL", 140, 16, 50, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Label5 = GUICtrlCreateLabel("PLOEGEN", 140, 32, 50, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("START", 210, 16, 50, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$MonthCal1 = GUICtrlCreateMonthCal("2010/10/21", 442, 50, 169, 158)
$Label6 = GUICtrlCreateLabel("DATUM", 210, 32, 50, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Label7 = GUICtrlCreateLabel("DATUM", 280, 32, 50, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Exit = GUICtrlCreateButton("Exit", 520, 210, 100, 30, $WS_GROUP)
$Label8 = GUICtrlCreateLabel("STOP", 280, 16, 50, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Label10 = GUICtrlCreateLabel("ACTIVATE", 336, 32, 66, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Group1 = GUICtrlCreateGroup("", 10, 46, 410, 35)
$AP1 = GUICtrlCreateInput("2", 70, 56, 50, 21)
$APL1 = GUICtrlCreateInput("3", 140, 56, 50, 21)
$STA1 = GUICtrlCreateInput("DaAatUm", 210, 56, 50, 21)
$STO1 = GUICtrlCreateInput("DaAatUm", 280, 56, 50, 21)
$Checkbox1 = GUICtrlCreateCheckbox("", 360, 56, 17, 25)
$Label9 = GUICtrlCreateLabel("DAG 1", 14, 60, 50, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$DButton1 = GUICtrlCreateButton("", 388, 54, 26, 26, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("", 10, 78, 410, 35)
$AP2 = GUICtrlCreateInput("2", 70, 88, 50, 21)
$APL2 = GUICtrlCreateInput("3", 140, 88, 50, 21)
$STA2 = GUICtrlCreateInput("DaAatUm", 210, 88, 50, 21)
$STO2 = GUICtrlCreateInput("DaAatUm", 280, 88, 50, 21)
$Checkbox2 = GUICtrlCreateCheckbox("", 360, 88, 17, 25)
GUICtrlSetState(-1, $GUI_CHECKED)
$Label11 = GUICtrlCreateLabel("DAG 2", 14, 92, 50, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$DButton2 = GUICtrlCreateButton("", 388, 86, 26, 26, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("", 10, 110, 410, 35)
$AP3 = GUICtrlCreateInput("2", 70, 120, 50, 21)
$APL3 = GUICtrlCreateInput("3", 140, 120, 50, 21)
$STA3 = GUICtrlCreateInput("DaAatUm", 210, 120, 50, 21)
$STO3 = GUICtrlCreateInput("DaAatUm", 280, 120, 50, 21)
$Checkbox3 = GUICtrlCreateCheckbox("", 360, 120, 17, 25)
GUICtrlSetState(-1, $GUI_CHECKED)
$Label12 = GUICtrlCreateLabel("DAG 3", 14, 124, 50, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$DButton3 = GUICtrlCreateButton("", 388, 118, 26, 26, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group4 = GUICtrlCreateGroup("", 10, 142, 410, 35)
$AP4 = GUICtrlCreateInput("2", 70, 152, 50, 21)
$APL4 = GUICtrlCreateInput("3", 140, 152, 50, 21)
$STA4 = GUICtrlCreateInput("DaAatUm", 210, 152, 50, 21)
$STO4 = GUICtrlCreateInput("DaAatUm", 280, 152, 50, 21)
$Checkbox4 = GUICtrlCreateCheckbox("", 360, 152, 17, 25)
GUICtrlSetState(-1, $GUI_CHECKED)
$Label13 = GUICtrlCreateLabel("DAG 4", 14, 156, 50, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$DButton4 = GUICtrlCreateButton("", 388, 149, 26, 26, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group5 = GUICtrlCreateGroup("", 10, 174, 410, 35)
$AP5 = GUICtrlCreateInput("2", 70, 184, 50, 21)
$APL5 = GUICtrlCreateInput("3", 140, 184, 50, 21)
$STA5 = GUICtrlCreateInput("DaAatUm", 210, 184, 50, 21)
$STO5 = GUICtrlCreateInput("DaAatUm", 280, 184, 50, 21)
$Checkbox5 = GUICtrlCreateCheckbox("", 360, 184, 17, 25)
GUICtrlSetState(-1, $GUI_CHECKED)
$Label14 = GUICtrlCreateLabel("DAG 5", 14, 188, 50, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$DButton5 = GUICtrlCreateButton("", 388, 181, 26, 26, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group6 = GUICtrlCreateGroup("", 10, 206, 410, 35)
$AP6 = GUICtrlCreateInput("2", 70, 216, 50, 21)
$APL6 = GUICtrlCreateInput("3", 140, 216, 50, 21)
$STA6 = GUICtrlCreateInput("DaAatUm", 210, 216, 50, 21)
$STO6 = GUICtrlCreateInput("DaAatUm", 280, 216, 50, 21)
$Checkbox6 = GUICtrlCreateCheckbox("", 360, 216, 17, 25)
$Label15 = GUICtrlCreateLabel("DAG 6", 14, 220, 50, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$DButton6 = GUICtrlCreateButton("", 388, 215, 26, 26, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$TestButton = GUICtrlCreateButton("Test", 475, 10, 100, 30, $WS_GROUP)
GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

#Region ### 
;;================================================================================
;;GET DATA LOOP
;;================================================================================
While 1()                                                                              ; //Recive Input
    MsgBox $STA
    
    Select
        Case $msg = $GUI_EVENT_CLOSE or $msg = $Exit                                                ; //If the Exit or Close button is clicked, close the app.
            MsgBox(0, "Terminate", "SALU")  
            ; //Say goodbye
    
            Exit                                                                                    ; //Exit the Application
        Case $msg = $OKbutton
            KlikOK()

        Case 0 ; No message (stops us having to loop through when there's nothing there.

        Case Else
            For $i = 1 to 10
                If $msg = $DButton[$i] Then GUICtrlSetData($STA[$i], GUICtrlRead($MonthCal1))
            Next
    
    EndSelect
WEnd
#EndRegion ###

func Klik_DButton2()


GUICtrlSetData($STA2 ,GUICtrlRead($MonthCal1))

EndFunc ;--> Klik_DButton2()

func KlikOK()

;;read all input
$Checkboxx1 = GUICtrlRead($Checkbox1)   
$APV1 = GUICtrlRead($AP1)   
$APLV1 = GUICtrlRead($APL1) 
$STAV1 = GUICtrlRead($STA1) 
$STOV1 = GUICtrlRead($STO1) 

$Checkboxx2 = GUICtrlRead($Checkbox2)   
$APV2 = GUICtrlRead($AP2)   
$APLV2 = GUICtrlRead($APL2) 
$STAV2 = GUICtrlRead($STA2) 
$STOV2 = GUICtrlRead($STO2)

$Checkboxx3 = GUICtrlRead($Checkbox3)   
$APV3 = GUICtrlRead($AP3)   
$APLV3 = GUICtrlRead($APL3) 
$STAV3 = GUICtrlRead($STA3) 
$STOV3 = GUICtrlRead($STO3)

$Checkboxx4 = GUICtrlRead($Checkbox4)   
$APV4 = GUICtrlRead($AP4)   
$APLV4 = GUICtrlRead($APL4) 
$STAV4 = GUICtrlRead($STA4) 
$STOV4 = GUICtrlRead($STO4)

$Checkboxx5 = GUICtrlRead($Checkbox5)   
$APV5 = GUICtrlRead($AP5)   
$APLV5 = GUICtrlRead($APL5) 
$STAV5 = GUICtrlRead($STA5) 
$STOV5 = GUICtrlRead($STO5)

$Checkboxx6 = GUICtrlRead($Checkbox6)   
$APV6 = GUICtrlRead($AP6)   
$APLV6 = GUICtrlRead($APL6) 
$STAV6 = GUICtrlRead($STA6) 
$STOV6 = GUICtrlRead($STO6)
    
;;read all input




if $Checkboxx1 = 1 then
    For $i = 1 to $aplv1 Step 1
        WinWaitActive("[CLASS:TFrmAskBV]")

        MouseClick("left", 568, 486, 1)
        WinWaitActive("[CLASS:TFrmBV]")
        send($APV1)
        send("{TAB}")
        send($STAV1)
        send("{TAB}")
        send("{TAB}")
        send($STOV1)
        send("{TAB}")
        send("{TAB}")
        send("ZIE BIJGEVOEGDE LIJST")
        MouseClick("left", 158, 90, 1)
    Next
endif   
    
    
if $Checkboxx2 = 1 then
    For $i = 1 to $aplv2 Step 1
        WinWaitActive("[CLASS:TFrmAskBV]")

        MouseClick("left", 568, 486, 1)
        WinWaitActive("[CLASS:TFrmBV]")
        send($APV2)
        send("{TAB}")
        send($STAV2)
        send("{TAB}")
        send("{TAB}")
        send($STOV2)
        send("{TAB}")
        send("{TAB}")
        send("ZIE BIJGEVOEGDE LIJST")
        MouseClick("left", 158, 90, 1)
    Next
endif   
    

if $Checkboxx3 = 1 then
    For $i = 1 to $aplv3 Step 1
        WinWaitActive("[CLASS:TFrmAskBV]")

        MouseClick("left", 568, 486, 1)
        WinWaitActive("[CLASS:TFrmBV]")
        send($APV3)
        send("{TAB}")
        send($STAV3)
        send("{TAB}")
        send("{TAB}")
        send($STOV3)
        send("{TAB}")
        send("{TAB}")
        send("ZIE BIJGEVOEGDE LIJST")
        MouseClick("left", 158, 90, 1)
    Next
endif   
    
if $Checkboxx4 = 1 then
    For $i = 1 to $aplv4 Step 1
        WinWaitActive("[CLASS:TFrmAskBV]")

        MouseClick("left", 568, 486, 1)
        WinWaitActive("[CLASS:TFrmBV]")
        send($APV4)
        send("{TAB}")
        send($STAV4)
        send("{TAB}")
        send("{TAB}")
        send($STOV4)
        send("{TAB}")
        send("{TAB}")
        send("ZIE BIJGEVOEGDE LIJST")
        MouseClick("left", 158, 90, 1)
    Next
endif   

if $Checkboxx5 = 1 then 
    For $i = 1 to $aplv5 Step 1
        WinWaitActive("[CLASS:TFrmAskBV]")

        MouseClick("left", 568, 486, 1)
        WinWaitActive("[CLASS:TFrmBV]")
        send($APV5)
        send("{TAB}")
        send($STAV5)
        send("{TAB}")
        send("{TAB}")
        send($STOV5)
        send("{TAB}")
        send("{TAB}")
        send("ZIE BIJGEVOEGDE LIJST")
        MouseClick("left", 158, 90, 1)
    Next
endif   

if $Checkboxx6 = 1 then
    For $i = 1 to $aplv6 Step 1
        WinWaitActive("[CLASS:TFrmAskBV]")

        MouseClick("left", 568, 486, 1)
        WinWaitActive("[CLASS:TFrmBV]")
        send($APV6)
        send("{TAB}")
        send($STAV6)
        send("{TAB}")
        send("{TAB}")
        send($STOV6)
        send("{TAB}")
        send("{TAB}")
        send("ZIE BIJGEVOEGDE LIJST")
        MouseClick("left", 158, 90, 1)
    Next
endif   

EndFunc ;--> KlikOK(()

;)

Share this post


Link to post
Share on other sites

Well I asked for it didn't I?

This might seem a little complicated at first and I don't have time to add more comments now, but it should do what you want and if you are wondering how something works just ask.

One warning: You won't be able to use KODA on this anymore.

Basically I've put all the parts of the script that kept returning for each of the six groups into for loops and stored all the associated variables into arrays. I've used the same variable names, with the exception of removing the number and adding an "a" for "array" at the front.

As a nice side effect you can now change the number of rows by changing the value for $iRows and nothing else.

If I where you I would have another look at the function KlikOK. If the application allows it you'd be much better off using ControlSend and ControlClick, instead of Send and MouseClick.

Anyways this is how I suggest you change your script.

#include <Date.au3>
#include <ButtonConstants.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>


Global Const $iRows = 6 ;;You can change this to change the number of groups.

Global $DaAatUm = _NowDate()
Global $Form1_1, $OKButton, $MonthCal1, $Exit, $TestButton ;control vars
Global $aGroup[$iRows], $aAP[$iRows], $aAPL[$iRows], $aSTA[$iRows], $aSTO[$iRows], $aCheckbox[$iRows], $aLabel[$iRows], $aDButton[$iRows] ;control arrays


GUICreate("ATI VERGUNNINGEN MAKEN", 643, 58+($iRows*32), 207, 180)
$OKButton = GUICtrlCreateButton("GO", 424, 210, 97, 30, $WS_GROUP)
GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")

GUICtrlCreateLabel("AANTAL", 70, 16, 50, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlCreateLabel("PERSONEN", 70, 32, 50, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlCreateLabel("AANTAL", 140, 16, 50, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlCreateLabel("PLOEGEN", 140, 32, 50, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlCreateLabel("START", 210, 16, 50, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlCreateLabel("DATUM", 210, 32, 50, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlCreateLabel("DATUM", 280, 32, 50, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlCreateLabel("STOP", 280, 16, 50, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlCreateLabel("ACTIVATE", 336, 32, 66, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")

$MonthCal1 = GUICtrlCreateMonthCal("2010/10/21", 442, 50, 169, 158)

$Exit = GUICtrlCreateButton("Exit", 520, 210, 100, 30, $WS_GROUP)

For $i = 0 To $iRows - 1 ;Each time this loops it creates a group with all the controls in it.
    $aGroup[$i] = GUICtrlCreateGroup("", 10, 46 + ($i * 32), 410, 35)
    $aAP[$i] = GUICtrlCreateInput("2", 70, 56 + ($i * 32), 50, 21)
    $aAPL[$i] = GUICtrlCreateInput("3", 140, 56 + ($i * 32), 50, 21)
    $aSTA[$i] = GUICtrlCreateInput("DaAatUm", 210, 56 + ($i * 32), 50, 21)
    $aSTO[$i] = GUICtrlCreateInput("DaAatUm", 280, 56 + ($i * 32), 50, 21)
    $aCheckbox[$i] = GUICtrlCreateCheckbox("", 360, 56 + ($i * 32), 17, 25)
    $aLabel[$i] = GUICtrlCreateLabel("DAG " & $i + 1, 14, 60 + ($i * 32), 50, 17)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $aDButton[$i] = GUICtrlCreateButton("", 388, 54 + ($i * 32), 26, 26, $WS_GROUP)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
Next

$TestButton = GUICtrlCreateButton("Test", 475, 10, 100, 30, $WS_GROUP)
GUISetState(@SW_SHOW)

;;================================================================================
;;GET DATA LOOP
;;================================================================================
While 1
    $msg = GUIGetMsg()
    Select
        Case 0
            ContinueLoop
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $Exit
            MsgBox(0, "Terminate", "SALU")
            Exit
        Case $msg = $OKButton
            KlikOK()
        Case Else
            For $i = 0 To $iRows - 1
                If $msg = $aDButton[$i] Then GUICtrlSetData($aSTA[$i], GUICtrlRead($MonthCal1))
            Next
    EndSelect
WEnd

Func KlikOK()
    Local $aCheckboxx[$iRows], $aAPV[$iRows], $aAPLV[$iRows], $aSTAV[$iRows], $aSTOV[$iRows]
    ;;read all input
    For $i = 0 To $iRows - 1
        $aCheckboxx[$i] = GUICtrlRead($aCheckbox[$i])
        $aAPV[$i] = GUICtrlRead($aAP[$i])
        $aAPLV[$i] = GUICtrlRead($aAPL[$i])
        $aSTAV[$i] = GUICtrlRead($aSTA[$i])
        $aSTOV[$i] = GUICtrlRead($aSTO[$i])
    Next

    For $i = 0 To $iRows - 1
        If $aCheckboxx[$i] <> 1 Then ContinueLoop
        For $i0 = 1 To $aAPLV[$i] ;You want to do the exact same thing multiple times?
            ;try to replace this entire part with controlsends
            WinWaitActive("[CLASS:TFrmAskBV]")
            MouseClick("left", 568, 486, 1)
            WinWaitActive("[CLASS:TFrmBV]")
            Send($aAPV[$i])
            Send("{TAB}")
            Send($aSTAV[$i])
            Send("{TAB}")
            Send("{TAB}")
            Send($aSTOV[$i])
            Send("{TAB}")
            Send("{TAB}")
            Send("ZIE BIJGEVOEGDE LIJST")
            MouseClick("left", 158, 90, 1)
        Next
    Next
EndFunc

I gotta go now. Hope it works.

Share this post


Link to post
Share on other sites

Thanx ;)

Why use ControlSend and ControlClick, instead of Send ?

Thanks a lot for your help :)

Share this post


Link to post
Share on other sites

Actually ControlSetText and ControlClick are probably the ones usefull for you.

With ControlSetText you can set text in a control without having to activate the window and without having to navigate to the control using Clicks, or by sending Tabs. With ControlClick you can click controls even if the window isn't active. (or even if the window is hidden)

In short they are more reliable, less easily disrupted by user interaction and faster.

To use them you will need some way to identify the controls though and not all controls can easily be identified. But if you can, it's worth using them.

Since you're already using a window class in there I assume you'll be able to find something to identify the controls with, but feel free to ask.

Share this post


Link to post
Share on other sites

thanx Tvern

ill try tomorrow

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
Sign in to follow this  
Followers 0