クリックボードに複写はダメですか。
Exe名:WinApp.exe / VBScriptファイル:同一フォルダ
VB.net
1Public Class Form1
2Private Sub Form1_FormClosed(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed
3 My.Computer.Clipboard.SetText("This is a test Copy " & Format(Now, "HH:mm:ss"))
4 Dim rt1 As Integer = 1234567
5 Environment.Exit(rt1)
6End Sub
VBScript
1dim Result
2dim fso
3dim FolderName
4dim ExitName
5
6set fso = createObject("Scripting.FileSystemObject")
7FolderName = fso.getParentFolderName(WScript.ScriptFullName)
8ExitName = FolderName & "\" & "WinApp.exe"
9
10Set WshShell = CreateObject("WScript.Shell")
11Set WshEnv=WshShell.Environment
12Set WshExec = WshShell.Exec(ExitName)
13
14Do While WshExec.Status = 0
15 WScript.Sleep 100
16Loop
17
18Set objIE = CreateObject("InternetExplorer.Application")
19objIE.Navigate("about:blank")
20strText = objIE.document.parentWindow.clipboardData.GetData( "Text" )
21
22Result = ""
23Result = Result & "Status : " & WshExec.Status & VBLF
24Result = Result & "ExitCode: " & WshExec.ExitCode & VBLF
25Result = Result & "Text : " & strText
26WScript.Echo Result
IEセキュリティ設定でスクリプトによる貼り付け処理の許可を有効にする必要あり。