| 1. |
Solve : How to change the focus back to original window via a Batch File Command? |
|
Answer» Good evening, All - ...WSH engines include various implementations for the REXX, BASIC, Perl, Ruby, Tcl, PHP, JavaScript, Delphi, Python, XSLT, and other languages.On this forum the preference seems to be using VbScript with batch to go into some things that would need more control. Such as forms. One advantage of WSH is, let's say, somebody in you group might be more handy with Python. He could write some good code and it can be started in batch. Then the batch might chge some detail and finish the job. Back to VBS, VBScript: Using VBScript to Fill Out a Web Form Is that he kind of thing you want? More examples are available. If you want the easy route for this, if the text is always in the same location on the display, I'd go with creating a Keyboard/Mouse macro with a tool like Jitbits Macro Creator. I bought this software years ago and use it for making a stand alone exe to run on other systems or same system. * To work on other systems, display resolution has to be the same and placement of trigger point ( desktop icons etc ) have to match up for exact X,Y location. A macro to complete this could be made in as little as 3 minutes. Thats why I like it so much is because OTHERWISE your spending hours writing code and debugging to get it right. This tool you can just say start recording the process. And then every movement, mouse click, and keyboard action is recorded in realtime until you select to end the recording. You can then play it back and it will perform exactly what you did. You can then either compile it into an EXE to share with other systems, or you can go in and look at the macro instruction list and edit it to change time delays to make it run faster if you want it to get to an icon and point and click to trigger it faster than your initial recorded motion of your hand to mouse etc, as well as you can add a loop instruction in it with a counter if you want to get advanced and customize it to run X-many times, or infinite loop to run non stop until an abort key is entered ending the macro. This program was some of the best spent money of programs I have readily available to me: https://www.jitbit.com/macro-recorder/Thank you Geek After Dark! I'll check out the links/info. We don't have an internal IT department...I'm as close as it gets, and I'm just not afraid to try things...but I am NOT a programmer. I AM a good 'monkey'...meaning I can take/adjust existing things to suit our needs . Not necessarily the 'cleanest' or 'prettiest', but usually (with luck) functional. So, I try to go with fairly 'low tech' solutions, so others can copy/adjust as needed without much tech knowledge. In other words, if I can document with images/text, then perhaps someone else can do it, as well. I appreciate your ideas!Thank you, Dave Lembke. The location of the text is NOT always in the same spot on the screen, so I don't think that this will work for this situation, but it is DEFINITELY an interesting little piece of software and one that I will ABSOLUTELY check out (but for other challenges). I LOVE the idea of quickly scripting keystrokes and have needed this tool often, so I'm sure that I'll need it again! I'm still trying to solve THIS issue, but now I know that I have a solution for some other issues!As DaveLembke said , a macro keystroke recorder might help in some cases. Some other things for future reference. There are a number of ways surrogate programs will imitate the typing of a real person. This is useful of applications that only take input from the keyboard. For more on this idea see: Auto Hotkey, Keyboard shortcut, Macro, Modifier key, Shortcut key. Or look here: 10 AutoHotkey Alternatives To Create Your Own Macros and ... And there is more... but this is enough for now. would it not work to have the launched command prompt start minimized? start "" /MIN "cmd.exe /c clip < c:\transfers\test.txt" I also don't think the /k switch makes sense for your usage- I swapped it for /c here. Thank you, Geek! I'll check those out. BC_Programmer...thanks for the idea (not sure what switch does what, so I tried your version), but it makes no difference...identical behavior. I end up on the same page/form/window, but the focus is lost. You have to click to return the focus and do the paste.Still not certain of the objective. How to Automatically Fill in Repetitive Web Forms Is a topic in Google search. Also called Autofill. Both Chrome and Firefox can do this. Here is one of many finds in a search. http://www.makeuseof.com/tag/kill-the-tedium-of-online-forms-with-these-10-great-autofill-tools/ Quote What Does It Mean To “Autofill” Online Forms? Your original topic was about keyboard focus. I think that has to be done at a different level, like maybe in C# or some other tool like that. https://msdn.microsoft.com/en-us/library/system.windows.input.keyboard.focus%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396 The above does not seem to apply to a batch file. Thanks, Geek! I appreciate it. My original idea of the web form as an example was a bad one because you are right, autofill exists...and I'm not looking to use this feature for that. I was just trying to find a very simply example (and I chose wrong). The issue is all about keyboard focus...thanks for the thoughts on C#...if we have to go to that level, we'll probably just have to click to regain the focus . None of us are "real" programmers!A number of articles on 'keyboard focus' can be found. These almost use sopme language other than pure batch. Batch, be default, steals keyboard focus unless it CAM run in the background. Here is how I work. I have a whole lot of words and phrases that I can use to write e-mail, fill in forms, remember passwords and do almost anything that is repetitive,. I have to. Whit my vision problem I can not see the print on the screen, unless Iuse the magnifier, which is awkward. Here is how it works. I get to a document, e-mail, web form or whatever where the keyboard focus is on a field. I already know what it is from prior use. So I hit control 1 and a little windows pops up and gives me a choice of 26 items, labeled A -Z. If what I want is not in that lost, I can go to another list until I find what I need. When I find what I want, I just press a single key and the keyboard focus goes back to where is was and the phrase I needed is slowly typed into the flied. This can even include the TAB key to advance to the next field. But I did not write the program. This is a form of 'keyboard automation' and uses a very simple script that most can understand. So I did not have to do anything about keyboard focus. The program does that by itself. But it is not a batch program. It is what at one time was can a TSR,a background task that monitors the keyboard for hot-keys and responds to commands in a script. In short, it is a kind of 'Hot Key' tool that does almost anything a user would do at the keyboard. It remembers where the cursor was and comes back there to do its job after you start a preset action. Put another way, the cursor position has to be remembered before anything else. So it should be part of the hot key thing. Let me know if this is anything like you want. I would imagine that there might h be some way to preserve the keyboard focus in a batch file, but I don't know how. THANK YOU, Geek!!! That's terrific information (and you're confirming what I'm figuring out through my research). Yes, we may have to go that direction. I truly appreciate all your information and guidance. I know just enough to be dangerous OK, now we will be on the lookout , now we know you are dangerous. The tool I use is called KetText and I paid for it to get all the features.' Here is the documentation. http://www.mjmsoft.com/ktext.pdf I recommend reading the manual before trying. |
|