Jump to content



Photo

from au3 script trying to controling UI in delphi application


  • Please log in to reply
No replies to this topic

#1 mpechner

mpechner

    Seeker

  • New Members
  • 1 posts

Posted 11 April 2008 - 12:52 AM

I have been racking my brains out trying to query a checkbox and possibly set the value of the checkbox.
I first tried to no avail:


;state global set to "Check" or "UnCheck"
Func flipCheckbox($controlId)
ControlFocus($title, "", $controlId); Shows me the correct control is being queried
sleep(250)
ControlCommand($title, "", $controlId, $state, "")
ConsoleWrite($controlId&" state"&$state&@CRLF);

$ctlstate = ControlCommand($title, "", $controlId, "IsChecked", "")
ConsoleWrite($controlId&" state"&$state&" cur st:"&$ctlstate&@CRLF);
If $state == "Check" And Not $ctlstate == 1 Then
ConsoleWrite("Could turn on flip:"&$controlId)
Cleanup($LOGFILE, "Could turn on flip:"&$controlId);

ElseIf $state == "Uncheck" And Not $ctlstate == 0 Then
ConsoleWrite("Could turn off flip:"&$controlId)
Cleanup($LOGFILE, "Could turn off flip:"&$controlId)
EndIf

EndFunc




Now I am trying things at a lower level:
Chandle returns the same value as autoit info.

$chandle = ControlGetHandle($title, "", "TResTeCheckBox6");
;MsgBox(0, "hh", $chandle);
flipCheckbox("[Class:TResTeCheckBox;Instance:6]")
$BM_GETCHECK = 0x00F0
$BM_SETCHECK = 0x00F1
$BM_GETSTATE = 0x00F2
$BM_SETSTATE = 0x00F3
$BM_CLICK = 0x00F5

$BST_UNCHECKED = 0x0000
$BST_CHECKED = 0x0001
$BST_INDETERMINATE = 0x0002


;
; Final attempt
;

ConsoleWrite("check"&@CRLF);
DllCall("user32.dll","uint", "SendMessage","hwnd", $chandle, "uint", $BM_CLICK, "wparam", 0, "lparam", 0 )
sleep(4000)
ConsoleWrite("check"&@CRLF);
DllCall("user32.dll","uint", "SendMessage","hwnd", $chandle, "uint", $BM_CLICK, "wparam", 0, "lparam", 0 )
sleep(4000)
ConsoleWrite("check"&@CRLF);
DllCall("user32.dll","uint", "SendMessage","hwnd", $chandle, "uint", $BM_CLICK, "wparam", 0, "lparam", 0 )
sleep(4000)


;
;Next to last attempt
;

;ConsoleWrite("check"&@CRLF);
;DllCall("user32.dll","uint", "SendMessage","hwnd", $chandle, "uint", $BM_SETCHECK, "wparam", $BST_CHECKED, "lparam", 0 )
;sleep(4000)
;ConsoleWrite("uncheck"&@CRLF);
;DllCall("user32.dll","uint", "SendMessage","hwnd", $chandle, "uint", $BM_SETCHECK, "wparam", $BST_UNCHECKED, "lparam", 0 )
;sleep(4000)
;ConsoleWrite("check"&@CRLF);
;DllCall("user32.dll","uint", "SendMessage","hwnd", $chandle, "uint", $BM_SETCHECK, "wparam", $BST_CHECKED, "lparam", 0 )
;sleep(4000)



What am I doing wrong?









0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users