Set date with SysDateTimePick32?

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
rullbandspelare
Pro Scripter
Posts: 149
Joined: Tue Mar 23, 2004 9:11 pm

Set date with SysDateTimePick32?

Post by rullbandspelare » Thu May 01, 2008 6:25 pm

How do I set the corect date from a Date picker?
This will not work:

SetControlText>Edit new,SysDateTimePick32,1,2006-01-01

Year-month-day is the date format on my sytem and the format that is presented in the dialog.

Thanks!

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu May 01, 2008 7:02 pm

Will this work?

Code: Select all

Let>RP_Windowmode=0
Run>cmd /c date 2006-01-01

rullbandspelare
Pro Scripter
Posts: 149
Joined: Tue Mar 23, 2004 9:11 pm

Post by rullbandspelare » Thu May 01, 2008 8:28 pm

Sorry , It is not the systems today's date. It is a dialog asking for a birth date. And I wish to set the correct birth date there using SetControlText>

The SysDateTimePick32 is a dropdown that produces a klickable calendar when chosen.

Thanks

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu May 01, 2008 10:43 pm

SetControlText Help wrote:SetControlText>WindowTitle,ClassName,Instance,NewText
You have checked the window using "View System Windows" or some other similar tool and you know that the "ClassName" is "SysDateTimePick32"?

rullbandspelare
Pro Scripter
Posts: 149
Joined: Tue Mar 23, 2004 9:11 pm

Post by rullbandspelare » Thu May 01, 2008 11:30 pm

Yes it's ClassName is SysDateTimePick32 and it is the first and only on in that window.
Like this one:
http://www.powerbasic.com/support/quick ... tetime.gif

There are also a bunch of "Edit" fields wich I can populate without any problem.

rullbandspelare
Pro Scripter
Posts: 149
Joined: Tue Mar 23, 2004 9:11 pm

Post by rullbandspelare » Fri May 02, 2008 5:17 am

GetControlText>Edit new,SysDateTimePick32,1,TheDate

Gives me:
TheDate=2008-05-13

But
SetControlText>Edit new,SysDateTimePick32,1,2006-01-01
does nothing.

??

Thanks!

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Fri May 02, 2008 5:19 am

I think I'm out of ideas.

I have ERP software that I'm unable to update using SetControlText>. Speaking with the software vendor I was told that it fails because the software performs validation on the information in each of the fields. The validation doesn't allow the text to be set at the classname level. Perhaps because this is a date you're inputting, which probably requires some sort of validation, you are also experiencing a validation issue.

Can you get a date from the object using GetControlText>? If you can and yet you can't set the date using the same classname and instance values with SetControlText>, I might guess that you won't be able to use SetControlText> in this case.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri May 02, 2008 6:28 am

I expect SysDateTimePIc32 is exposing the date in it's caption property for convenience, but it doesn't surprise me that you can't just set it's caption text the other way. I doubt the developers of the control ever imagined anyone would want to set the date that way.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Fri May 02, 2008 12:33 pm

Is it possible for you to alter the data in a more direct manner such as file manipulation or by using the new database functions rather than through the date picker?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri May 02, 2008 1:10 pm

Or perhaps you can type into it, but only in a specif way - can you type into it at all manually? Can that not be simulated, or must it be done with the mouse?

If it must be controlled via the mouse perhaps use text capture or image recognition to find the appropriate buttons ...
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

rullbandspelare
Pro Scripter
Posts: 149
Joined: Tue Mar 23, 2004 9:11 pm

Post by rullbandspelare » Sun May 04, 2008 8:49 am

Yes, it is possible to type into. But I like the SetControlText> way. It is so error freee. Using send text.. doesnt guarantee that You are typin in the right place.

My approach now is:

SetFocus>Edit new
Send Character/Text>
press Right
Send Character/Text>1966
press Right
Send Character/Text>05
press Right
Send Character/Text>19
press tab

But How can I know what field I am on. I would perfeer not to use image recognition. I dont trust it to get the right field 100%

Thanks

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts