Jump to content

problem with ControlSend to datefield


Recommended Posts

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?

Link to comment
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")
Link to comment
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

Link to comment
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))
Link to comment
Share on other sites

Link to comment
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)

Link to comment
Share on other sites

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