Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SendKeys on Client Machine

Status
Not open for further replies.

BBousman1

Programmer
Apr 16, 2008
27
US
We have an ASP.Net webpage built and need to make it so when we click a button it will send a string value to another program on the client's desktop. We need to search for the title of the program, set focus to it, and then send it the string data. I have a dll that will do this if the code is ran on the client PC but since ASP.Net is server-side, this doesn't work.

Does anyone have a way to find an open window, set focus to it, and then send it a string value?

Thanks in advance!
 
when you say "another program" and then "find open window" what are you talking about exactly, as these are 2 different ideas.

another program refers to a different application (Word, Excel, Adobe, etc). If that's the case, this can't be done with strait js/html. you would need software installed on the client for this to work. either activeX or SilverLight, so something along those lines.

find open window refers to the same web browser with multiple windows open. This is possible using js. google and forum216 are your best places for help with the javascript aspect.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
I mean another program, it's an HIS (Health Information System) Program that our pharmacists use. What we want it to do is when they click a button on the ASP .NET page, it will send a patient's 12 character account number to the HIS program and then hit the Enter/Return key to submit it. I've been looking for ActiveX controls to do this but haven't came across any. Think you could point me in the right direction?

Thanks!

Brett
 
there won't be an activeX that does this out of the box. you will need to design it. I haven't worked with either activeX or SliverLight. All I know is they are the tools for the this kind of user interaction.

If I was required to do something like this I would use sliverlight (although it is more presentation based at the surface level). activeX is vba or vb5 or something like that. I have no idea how to gain focus of user controls form outside the application.

i'm assuming HIS is 3rd party software that you cannot modify.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Yeah, we currently have this project outsourced but they're not finding anything as of yet so I was trying to do research on my own. I haven't worked much with ActiveX or Silverlight so that's why I'm at a loss.

You're correct that the HIS software is 3rd party and cannot be modified.
 
i would approach it this way
1. determine if sliverlight can do more than just presentation. I think it does, but i'm not sure. if it cannot activeX is your next option

there is still a fundamental problem though. the code needs to determine:
1. is the app running? yes: get instance, no: launch
2. is the form open? no: open it (menu strip command?)
3. is the form active? no: set focus
4. find text box. which is a rendered graphic, i think
5. insert text.
6. find button. which is a rendered graphic, i think
7. "push" the button

if 4 and 6 are possible I would start by googling activeX locate button on external application. Maybe shell commands are required. if so that would get very ugly.

this next bit probably is not possible, but arguably the better option as it appropriately separates concerns.
1. have an activeX/sliverlight client app execute a console application with the string as an argument.
2. this would call the core application and process the request.
3. the gui would already have an even handler to handle "system updates" (like the one preformed by the console app). the handler would then repopulate itself.

in this model the GUI wouldn't change and there would be no need for finding controls or that mess. but being a 3rd party app this extension point probably does not exist.


Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Some of that may not be necessary. Currently, here is what we do:

*Check to see if the application is open, if it is then set focus to that application, if not alert the user to open the application

*Once the application has focus, by default the Patient Account Number textbox has focus so all we need to do is copy the account number from the ASP .NET page to the program and hit Enter.

*Hitting enter will automatically submit the data in the HIS system.

Right now everything that's in our ASP .Net page is currently ran from Office as Add-on buttons so we have a DLL that will do all this because it's all client-side communication.

Do you think if we made a small program that used that dll and had an ActiveX object call that small program that would work?
 
Right now everything that's in our ASP .Net page is currently ran from Office as Add-on buttons so we have a DLL that will do all this because it's all client-side communication.
do you mean you have an add-in for office that launches a browser to access the web application? the web application does some processing and then you want to webpage to set the value for HIS?

if so, how much, if any, user interaction is needed for the web application? if no user interaction is required between the time the add-in is run and the patient id is returned, then you might be able to do this via the add-in, not the asp.net.

ok, assuming there is no user interaction on the webpage (in other words, the add-in opens a specific url and the patient id is displayed on screen, for copy/paste or whatever).
then you could change the web page (aspx) to a webservice (asmx) and have the addin get the value from the response of the webservice. then have the add-in populate the HIS system and hit return for you.

this would eliminate the need to open an instance of the browser altogether and stream line the user experience.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Sorry, let me better explain this.

The ASP .Net webpage is going to replace what Office does. Right now we have to install software every time we update the program and we don't want to do it so we're changing the system to run as an ASP .Net webpage instead of Office Add-ons. Everything that Office does will now be done in the ASP .Net browser.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top