Sign in to follow this  
Followers 0
Mooner

problem with ControlSend to datefield

15 posts in this topic

Hi All,

I've a application where i want to fill in a datafield.

The application is written in Centura (dont know if that is relevant info)

I like to have a value in this edit field in the following structure 23/12/1979.

I tried already a couple of combination without any success..

I use the following command:

ControlSend("Patiënt","", "[CLASS:Edit; INSTANCE:18]", "23/12/1979")

result > 97/9/1

it looks like i have to send my chars backwards

ControlSend("Patiënt","", "[CLASS:Edit; INSTANCE:18]", "9791/21/32")

result > 23/12/19

than it looks like the i have to delete the /

ControlSend("Patiënt","", "[CLASS:Edit; INSTANCE:18]", "97912132")

result > 23/1/2

So that also doesn't look good...

WindowInfo from this field:

Basic Window Info

Title: Patient

Class: Centura:AccFrame

Advanced(class) [CLASS:Edit; INSTANCE:18]

Style 0x50830080

ExStyle 0x00000200

Handle 0x00150410

Anybody who can help me on this?

Share this post


Link to post
Share on other sites



Maybe something like this works?

#include <SendMessage.au3>
Global Const $DTM_SETFORMAT_ = 0x1032
Global Const $sDateStyle = "dd/MM/yyyy"
$hWnd_Ctrl = ControlGetHandle("Patiënt","", "[CLASS:Edit; INSTANCE:18]")
_SendMessage($hWnd_Ctrl,$DTM_SETFORMAT_,0, $sDateStyle)
ControlSend("Patiënt","", "[CLASS:Edit; INSTANCE:18]", "23/12/1979")

Share this post


Link to post
Share on other sites

Maybe something like this works?

#include <SendMessage.au3>
Global Const $DTM_SETFORMAT_ = 0x1032
Global Const $sDateStyle = "dd/MM/yyyy"
$hWnd_Ctrl = ControlGetHandle("Patiënt","", "[CLASS:Edit; INSTANCE:18]")
_SendMessage($hWnd_Ctrl,$DTM_SETFORMAT_,0, $sDateStyle)
ControlSend("Patiënt","", "[CLASS:Edit; INSTANCE:18]", "23/12/1979")

KaFu, Thx for the try... but the result was:

97/9/1

Share this post


Link to post
Share on other sites

Do you really need to re-adjust the control, or might re-formatting the input string be enough?

$s_DateString = "23/12/1979"
ControlSend("Patiënt", "", "[CLASS:Edit; INSTANCE:18]", StringTrimLeft(StringRegExpReplace($s_DateString, '(\d{2})/(\d{2})/(\d{4})', '$3/$2/$1'), 2))

Share this post


Link to post
Share on other sites

thats the same for me...

I just need to insert as new date in this field :s

the way how i insert this doesn't matter (at this moment)

Share this post


Link to post
Share on other sites

sorry..

the result > 32/21/97

Share this post


Link to post
Share on other sites

If you manually enter the desiered date, is it really displayed in the format 23/12/1979? Seems more like dd/MM/YY to me. What's the exact format if you use these letters?

Share this post


Link to post
Share on other sites

Sorry.. the correct format is MM/dd/YYYY

if i click in this field and enter the following number

'1' '2' '2' '3' '1' '9' '7' '9'

I get the following date filled in this edit-field

12/23/1979 (23 dec 1979)

Share this post


Link to post
Share on other sites

So how about this one?

$s_DateString = "23/12/1979"
ControlSend("Patiënt", "", "[CLASS:Edit; INSTANCE:18]", StringRegExpReplace($s_DateString, '(\d{2})/(\d{2})/(\d{4})', '$2$1$3'))

Share this post


Link to post
Share on other sites

admire your enthusiasm:)

result -> 97/9/1

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Last try for me :)...

$s_DateString = "23/12/1979"
ControlSetText("Patiënt", "", "[CLASS:Edit; INSTANCE:18]", StringRegExpReplace($s_DateString, '(\d{2})/(\d{2})/(\d{4})', '$2$1$3'), 1)
Edited by KaFu

Share this post


Link to post
Share on other sites

Last try for me :)...

$s_DateString = "23/12/1979"
ControlSetText("Patiënt", "", "[CLASS:Edit; INSTANCE:18]", StringRegExpReplace($s_DateString, '(\d{2})/(\d{2})/(\d{4})', '$2$1$3'), 1)

Ok Thanks.. but now i get some very strange results.. edit-field is grayed out :s

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

AHA! Eureka...

Correct syntax:

ControlSetText("Patiënt","","[CLASS:Edit; INSTANCE:18]","10/11/1979")

Thanks KaFU!!

Edited by Mooner

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