need a little help with SetControlText

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

need a little help with SetControlText

Post by pgriffin » Tue Apr 19, 2005 2:26 am

I am continuing to attempt to get it right, but if anyone can clarify the proper syntax sooner, please do!

here is one of the controls for which I want to set the text as copied from View System Windows.

2229084 - Centura:Ch:Column "Cost Code"

obviously,, I want to fit the right bits into:

SetControlText>Window Title,ClassName,Instance,NewText

Thank you.

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

wrong info?

Post by pgriffin » Tue Apr 19, 2005 2:57 am

I believe gave the information for the column heading instead of the edit box for the heading.

it appears the edit boxes for several headings are located in a Centura:ChildTable""

I cannot rely on the column's location, width, etc to be constant. I think SetControlText is my only hope (short of buying a bit of VBScript, if that would work)

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Apr 19, 2005 8:07 am

Classname is "Centura:Ch:Column" (without quotes).

WindowName I don't know - you should know this from the title of the window. Instance - depends on how many there are and this one's sequence. May need trial and error.
MJT Net Support
[email protected]

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

instance

Post by pgriffin » Tue Apr 19, 2005 12:45 pm

ok. instance of that column? instance of that WindowTitle? of All such columns?

I'll try them all, but...

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Apr 19, 2005 1:17 pm

Instance of "Centura:Ch:Column" object.
MJT Net Support
[email protected]

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

instances

Post by pgriffin » Tue Apr 19, 2005 2:21 pm

how am I to be sure that a numeric constant like 'instance' will be the same each time? is this something for which I should create a variable to programmatically populate? Is it reliable to use the same instance number for that object each time?

I'll test, but would like your opinion

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Apr 19, 2005 2:24 pm

It depends. It may not be reliable. Depends on the application in question. Take toolbars for example. They can be moved around by the user and the user can decide which ones show and where they are. They may therefore be created in a different sequence each time and so the instance number is unreliable. Instance 2 may be a different toolbar the next time the app is open and probably different on a different machine.

Static controls will be more reliable. Buttons and text fields for example will be created in pretty much the same order each time.
MJT Net Support
[email protected]

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

instances

Post by pgriffin » Tue Apr 19, 2005 2:45 pm

Thank you. Then on a window where users are allowed to change the order of columns, instance would definitely be unreliable. Any chance of having a VB guru solve this? maybe read the system windows, find the first occurence of these edit boxes AFTER the occurrence of the parent window, then return the instance correctly to MacroScheduler? This has to do with entering Cost data for a prospect, so quite critical. If I am successful, they will be required to purchase several copies of MS to run these processes.

thank you, again.

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Apr 19, 2005 3:31 pm

Hi,

I doubt VB would be capable of doing that. But some Win32 API might help. Would need a copy of the application you are automating to be able to offer any real help. Which application is it?

Can you not just enter the data via keyboard simulation (SetFocus, Press Tab ... Send>whatever ...)?
MJT Net Support
[email protected]

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

via keyboard

Post by pgriffin » Tue Apr 19, 2005 4:22 pm

keyboard is what I am currently doing, but I've learned that if a user re-orders the columns, my keystrokes will hit he wrong columns. So I wanted to try SetControlText, which I am glad has happened because I now love that command and will use it extensively where it applies.

My next route will be to do what I have named 'fingerprinting'....I'll get a scatter-shot of pixels from the column heading to determine what the heading must be, then click below that (by some number of pixels) and send>whatever.....by fingerprinting I mean check 10 pixels on each heading which will be certain to lead to a fail-proof identification. I've used it on other apps with perfect results. Sort of a subset of GetRectCheckSum.....and a bit faster.

btw, great product, run and rewarding to work with....I have an idea for another 'add-on'.....I'll keep you informed....

Skunk.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Tue Apr 19, 2005 9:13 pm

Since a user can reposition the columns, etc. that means that you can do that also.

Can't you make a macro to change the existing format into the format you want for your process. Then close the original document withoug saving and the user's specs would be retained?

I have done things like that in Excel, using some conditional if statements and column positions and column titles. Make the Excel formating macros, and then have Macro Scheduler call them.

I know this is not Excel, but thought the concept might be transferable.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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