Jump to content

Setting date in a DTPicker20WndClass control


Recommended Posts

I am trying to set the date in a DTPicker date control. I have tried a few different options but I can't seem to get it to work.

ControlSend("InfoStore Client", "", "[CLASS:DTPicker20WndClass; INSTANCE:1]", "07/21/2010 07:00")

ControlCommand("InfoStore Client", "", "[CLASS:DTPicker20WndClass; INSTANCE:1]", "SelectString", "07/21/2010 07:00")

Any direction on how to accomplish this?

Link to comment
Share on other sites

Did you try _GUICtrlDTP_SetSystemTime()? See help file.

:blink:

That would seem to work with controls created within Autoit, but in my case I am trying to set the DTPicker control value in a Windows application I an trying to script.

Take Care

Link to comment
Share on other sites

That would seem to work with controls created within Autoit, but in my case I am trying to set the DTPicker control value in a Windows application I an trying to script.

So... that's a NO?

:blink:

The _GuiCtrl* functions are Windows API functions taking advantage of standard WinAPI DLL calls. They are not intended only for use on native AutoIt controls.

;)

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

So... that's a NO?

:blink:

The _GuiCtrl* functions are Windows API functions taking advantage of standard WinAPI DLL calls. They are not intended only for use on native AutoIt controls.

;)

Sorry. I couldn't figure out how to get the handle for the control to pass to _GUICtrl... as the example uses a Autoit Control. How do I get the handle of the control to pass to _GUICtrl...?

Appreciate the help.

Link to comment
Share on other sites

I think I located the call I need but

$handle = ControlGetHandle("Infostore Client", "", "[CLASS:ThunderRT6Frame; INSTANCE:1]")

or

$handle = ControlGetHandle("Infostore Client", "", "[CLASS:DTPicker20WndClass; INSTANCE:1]")

doesn't return the handle to the control.

Edited by ijourneaux
Link to comment
Share on other sites

You got the right idea. Post the full contents of the Summary tab on the AutoIt Window Info tool (AU3Info.exe) while pointing at this control. Maybe we can figure out why you aren't matching it.

:blink:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

You got the right idea. Post the full contents of the Summary tab on the AutoIt Window Info tool (AU3Info.exe) while pointing at this control. Maybe we can figure out why you aren't matching it.

:blink:

Here are the contents of the summary page.

>>>> Window <<<<

Title: InfoStore Client - [sENA Scrolling 3D: OMC6712 C1S BoneDry Weight]

Class: ThunderRT6MDIForm

Position: -4, -4

Size: 808, 578

Style: 0x17CF0000

ExStyle: 0x00040100

Handle: 0x001F027C

>>>> Control <<<<

Class: DTPicker20WndClass

Instance: 1

ClassnameNN: DTPicker20WndClass1

Name:

Advanced (Class): [CLASS:DTPicker20WndClass; INSTANCE:1]

ID:

Text:

Position: 683, 91

Size: 107, 17

ControlClick Coords: 68, 4

Style: 0x54000000

ExStyle: 0x00000200

Handle: 0x003603B6

>>>> Mouse <<<<

Position: 751, 133

Cursor ID: 0

Color: 0xFFFFFF

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<

SENA Scrolling 3D: OMC6712 C1S BoneDry Weight

Avg: 67.95 2S: 1.17 Scan Avg: 67.77 Scan 2S: 1.02

Space Reels

1

1

1K0G220700+ GUS 80

Gray Scale

Legend

C1S BoneDry Weight

C1S BoneDry Weight

OMC6712

OMC6712

1

Scans

Scans

Scan: 327 Avg: 67.765

Current

End Time

Start Time

Grade ID

Grade Name

July 23,2010 08:37

MD De-Trend

Pocket: 134 (55.34") Scan: 327 Value: 67.72

#327: 07/23/2010 06:34:26

2

Set

%

Units

Reset

Reel

Reel

X

Any

Any

>>>> Hidden Text <<<<

Summary

Reel

Link to comment
Share on other sites

Is the window title match mode set to 1?

AutoItSetOption("WinTitleMatchMode", 1)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

You shouldn't need any special modes set. Just try this from SciTE and post the result:

; >>>> Window <<<<
; Title: InfoStore Client - [SENA Scrolling 3D: OMC6712 C1S BoneDry Weight]
; Class: ThunderRT6MDIForm
;
; >>>> Control <<<<
; Class: DTPicker20WndClass
; Instance: 1

$hWin = WinGetHandle("[CLASS:ThunderRT6MDIForm; TITLE:InfoStore Client]", "")
If $hWin Then
    ConsoleWrite("Got window handle = " & $hWin & @LF)
    $hCtrl = ControlGetHandle($hWin, "", "[CLASS:DTPicker20WndClass; INSTANCE:1")
    If $hCtrl Then
        ConsoleWrite("Got control handle = " & $hCtrl & @LF)
    Else
        ConsoleWrite("Failed to get control handle" & @LF)
    EndIf
Else
    ConsoleWrite("Failed to get window handle" & @LF)
EndIf

:blink:

Edit: Fixed copy/paste error as below.

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\u02304\My Documents\Projects\AutoIt Projects\test.au3"

Got window handle = 0x00020FF6

Failed to get control handle

>Exit code: 0 Time: 0.230

I just changed the one consolewrite statement to the it says "Failed to get control handle"

$hWin = WinGetHandle("[CLASS:ThunderRT6MDIForm; TITLE:InfoStore Client]", "")

If $hWin Then

ConsoleWrite("Got window handle = " & $hWin & @LF)

$hCtrl = ControlGetHandle($hWin, "", "[CLASS:DTPicker20WndClass; INSTANCE:1")

If $hCtrl Then

ConsoleWrite("Got control handle = " & $hCtrl & @LF)

Else

ConsoleWrite("Failed to get control handle" & @LF)

EndIf

Else

ConsoleWrite("Failed to get window handle" & @LF)

EndIf

Link to comment
Share on other sites

I have no idea why that matches the window correctly but doesn't match the control.

:blink:

I'm curious, where did you get "[CLASS:ThunderRT6Frame; INSTANCE:1]" from earlier?

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

I appreciate you taking the time to look at it.

The "[CLASS:ThunderRT6Frame; INSTANCE:1]" is the frame around the date control and the list below it.

If you have any other ideas, I would love to try them. The date control sets the start of the data in the color blanket display. I need it to start at 7am. Right now I approximate that by running the report at 7am. I would like to be able to create the report at anytime during the day.

Take Care

PS On another note. I was wondering if you might be able to point me to a resource on best practices for creating robust automation scripts. The script I have written works most of the time but not good enough. I ahve gone in and added checks to confirm the window is infact, for instance, in focus, before I try to do something with it but I still fails some of the time. What I have done seems kludgy to me and I am wondering if there is a better way. I ma working of a machine that is dedicated to this script so there isn't anything hapening that would interput the script some how

Link to comment
Share on other sites

I appreciate you taking the time to look at it.

The "[CLASS:ThunderRT6Frame; INSTANCE:1]" is the frame around the date control and the list below it.

If you have any other ideas, I would love to try them. The date control sets the start of the data in the color blanket display. I need it to start at 7am. Right now I approximate that by running the report at 7am. I would like to be able to create the report at anytime during the day.

Just for giggles, you might try:
$hControl = ControlGetHandle("[CLASS:ThunderRT6Frame; INSTANCE:1]", "", "[CLASS:DTPicker20WndClass; INSTANCE:1")

PS On another note. I was wondering if you might be able to point me to a resource on best practices for creating robust automation scripts. The script I have written works most of the time but not good enough. I ahve gone in and added checks to confirm the window is infact, for instance, in focus, before I try to do something with it but I still fails some of the time. What I have done seems kludgy to me and I am wondering if there is a better way. I ma working of a machine that is dedicated to this script so there isn't anything hapening that would interput the script some how

The basics are ControlSend() instead of Send(), and don't assume thing happen instantly (like trying to use the window immediately after the Run() that creates it). You might see if the app has its own scheduling or scripting environment included in it.

:blink:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...