Avatar of smithmrk
smithmrkFlag for United States of America

asked on 

VB.net 2005 - Set Focus on Control (External Program)!

Hello Experts!

OK so I'm trying to write a program that will simulate an operator's key strokes because we have a program that we would like to run overnight, but we don't have an operator available to start the program at midnight.  So I've been able to execute the program and set focus on it...but I need to set focus on a specific control within the program...how can I do this?

I need the focus to be on the checkbox of the external program so I can uncheck the box then click OK.
I can't seem to get the focus on the checkbox...how can I get the checkbox name and set focus on it then use sendkeys to uncheck the box?

Thanks,
Mark
Visual Basic.NET

Avatar of undefined
Last Comment
smithmrk
Avatar of Ammar Gaffar
Ammar Gaffar
Flag of United Arab Emirates image

You can simulate user behavior by activating the external application and send the keys pragmatically.
Check this post it might help you:
http://www.codeproject.com/Tips/232649/Setting-Focus-on-an-External-application

In this link you can find the keys code:
http://www.developerfusion.com/article/57/sendkeys-command/

Good Luck
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

It's certainly possibly with VB.Net, but I'd recommend simply using something that can do this out of the box like AutoIT:
https://www.autoitscript.com/site/autoit/
Avatar of smithmrk
smithmrk
Flag of United States of America image

ASKER

Thanks to both of you...however I have the ability to set focus on the external program, and I've been sending keys just fine...but I want to grab window information from labels and checkboxes.

I want to be able to read the text of a checkbox or label.

For example if the checkbox says "Delete Batches" I want to grab the words "Delete Batches" from that checkbox label.

Thanks,
Mark
Avatar of Ammar Gaffar
Ammar Gaffar
Flag of United Arab Emirates image

I am really confused about your requirements,   if you have an operator,  he needs to make a decision based on something or just do some clicks so you program will start execute?
Avatar of smithmrk
smithmrk
Flag of United States of America image

ASKER

OK, so once I get to the point of clicking the Button on the external program it brings up a popup box that is asking the operator if it is OK to delete the batches from a certain date I want to be able to pull that date off the popup box and verify it is correct before I sendkeys (Enter).

Thanks,
Mark
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of smithmrk
smithmrk
Flag of United States of America image

ASKER

OK, Thanks!
I'll take a look and play with the code after the holidays.

Hope ALL of you have a great Holiday to you and your families.

Mark
Avatar of smithmrk
smithmrk
Flag of United States of America image

ASKER

OK, I have a NEW Problem now!
When the workstation is NOT logged in the schedule job to run the program doesn't work because it won't do the SendKeys commands.

How can I get around logging into the computer to do the SendKey commands?

By the way the logon needs CNTL/ALT/DELETE and is Novel Logon.

Thanks,
Mark
Avatar of smithmrk
smithmrk
Flag of United States of America image

ASKER

I had to abandon this program as I couldn't get around the Novel Login Screen.

Thanks for your help!

Mark
Visual Basic.NET
Visual Basic.NET

Visual Basic .NET (VB.NET) is an object-oriented programming language implemented on the .NET framework, but also supported on other platforms such as Mono and Silverlight. Microsoft launched VB.NET as the successor to the Visual Basic language. Though it is similar in syntax to Visual Basic pre-2002, it is not the same technology,

96K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo