I'm writing a script to be used in DiaDem. The scrip uses WshShell to copy some data to the clipboard. Then an Alt TAB, then paste. Right now i have a wait function. Sometimes this fails. I want a way to wait on the window to become active before pasting.
I have tried WinWait but have not gotten it work correctly.
Sub SetClip(sContents)
Dim WshShell: Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "cmd.exe /c echo " & sContents & " | clip", 0, TRUE
WshShell.SendKeys "%{TAB}",True
Call Pause(.1) 'This is my current method of waiting on the window.
WshShell.SendKeys "^v"
WshShell.Run "cmd.exe /c echo off | clip", 0, TRUE 'clear clipboard
Set WshShell = nothing
End Sub
I have not been able to get any of the code i have tried to work. The code is written in the scripting environment of DiaDem.