I want to open Notepad from Silverlight and then paste some text into it. I was able to use the clipboard method to move the text I want to the clipboard. Then I use shell to open notepad. The final step is to paste the contents of the clipboard into notepad. This can be done by the user pressing Ctrl-V or Edit – Paste
However, this is an unsatisfactory solution. I’d like to automate the last step, pasting the clipboard into notepad.
Here is my code:
System.Windows.Clipboard.SetText(l_StringBuilder.ToString)
' next open notepad
OpenShell("notepad.exe")
System.Windows.Clipboard.GetText() ‘ this does not work
Private Sub OpenShell(p_Program As String)
Try
If (AutomationFactory.IsAvailable) Then
Dim shell = AutomationFactory.CreateObject("Shell.Application")
shell.ShellExecute(p_Program) 'Open notepad
End If
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub
I got the answer in another forum. Here is the link to it:
http://social.msdn.microsoft.com/Forums/en-US/silverlightnet/thread/b787244d-a0a9-4aea-8858-e94644742ff0/#05ca684e-1d22-4bca-a207-9c422a7cf5d6