Mooner Posted March 10, 2011 Share Posted March 10, 2011 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 More sharing options...
KaFu Posted March 10, 2011 Share Posted March 10, 2011 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") OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Mooner Posted March 10, 2011 Author Share Posted March 10, 2011 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 More sharing options...
KaFu Posted March 10, 2011 Share Posted March 10, 2011 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)) OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Mooner Posted March 10, 2011 Author Share Posted March 10, 2011 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) Link to comment Share on other sites More sharing options...
KaFu Posted March 10, 2011 Share Posted March 10, 2011 And... what's the result if you're trying the code snippet above ? OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Mooner Posted March 10, 2011 Author Share Posted March 10, 2011 sorry.. the result > 32/21/97 Link to comment Share on other sites More sharing options...
KaFu Posted March 10, 2011 Share Posted March 10, 2011 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? OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Mooner Posted March 10, 2011 Author Share Posted March 10, 2011 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 More sharing options...
KaFu Posted March 10, 2011 Share Posted March 10, 2011 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')) OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Mooner Posted March 10, 2011 Author Share Posted March 10, 2011 admire your enthusiasm:) result -> 97/9/1 Link to comment Share on other sites More sharing options...
KaFu Posted March 10, 2011 Share Posted March 10, 2011 (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 March 10, 2011 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Mooner Posted March 10, 2011 Author Share Posted March 10, 2011 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 Link to comment Share on other sites More sharing options...
Mooner Posted March 10, 2011 Author Share Posted March 10, 2011 (edited) AHA! Eureka... Correct syntax: ControlSetText("Patiënt","","[CLASS:Edit; INSTANCE:18]","10/11/1979") Thanks KaFU!! Edited March 10, 2011 by Mooner Link to comment Share on other sites More sharing options...
KaFu Posted March 10, 2011 Share Posted March 10, 2011 Puuuh, that was a hard birth , glad it works now. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now