Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
I have a (mostly) working macro that types the clipboard to the frontmost window. I am looking to improve it so that it works in all cases and perhaps without the click.
Here it is:
The click is there because the window loses focus when the macro is activated.
I have searched the forums multiple times and this is the best I have come up with. Hopefully someone could give me some tips on how to make this work better.
copy and past the xml data below into your configuration tree. right click on the computer in the tree and click on paste.
copy some text into your clipboard. and then open up notepad. go back to eg and run the macro by right clicking on it and clicking on execute. and see if the text you copied gets pasted into notepad.
This should work regardless of the window being in the front or not.
Yes your macro works but your example is not at all what I am going for.
I can not use ctrl+v in all cases so the clipboard must be entered via Send Keystrokes or similar.
I don't know ahead of time what program I want the clipboard entered into so I have the frontmost window targeted (no FindWindow = frontmost)
Hold up this was a simple test to make sure that it works properly.
we can capture the clipboard and pass it very easily.
I am assuming you are doing this with text that is the format of the data I am requesting from the clipboard. if the data in the clipboard is not text it will do nothing. so you will need to ley me know what kind of data it is you are trying to capture and send to your application. but give the code below a test run and see if it is up to snuff for you. There is another way to go about going it. But is more complicated. If the amount of information you have is going to be large then the use of sending keystrokes is not going to be a good solution. and I will have to grab the actual control from the windows and open the control up and set the value directly.
and not knowing where to send the information complicates things. not so much if it's not large amounts of data. But I can locate the foremost window no problems there. but give the above example a test and see if the speed is going to be good enough for you.
the other thing is that when you select the foremost window the ter window is not what you think it is.. every single control inside of a "frame" (what most people call a window) and the frame it's self is derived from the window class and I want to make it clear to you that text can be sent to anything derived from the window class. not that the actual control you are sending it to will know what to do with it. so you will have to make sure that the actual control that you want to send the data to is in focus or selected. because when i grab the foremost window it is going to grab the control that has the focus. and if the control that is in focus is not the one that you want to send it to, the outcome could be ugly to say the least.
If you like the work I have been doing then feel free to