tagging release
[dasher.git] / trunk / Utils / Win32 / DasherAutoPaste / DasherPaste.vbs
blob64e370f776b68b828de9d9a640e49fe42a78731a
1 ' For the user:
2 ' 1/ Create a shortcut to this script on your startmenu with the shortcut key of your choice.
3 ' 2/ From within your application press your shortcut - any selected text will hopefully appear in Dasher.
4 ' 3/ When you've finished with Dasher, simply close it. The Window last active before Dasher will receive
5 ' your text.
7 ' This script uses the Windows clipboard, so any contents will be lost. If stage 3/ fails, your text will hopefully
8 ' be in the clipboard anyway. Try increasing the number after WScript.Sleep.
10 ' Requires Windows Scripting Host 2. This comes with Windows 2000
11 ' If you don't have it, see: http://www.microsoft.com/msdownload/vbscript/scripting.asp
13 ' For the developer:
14 ' This is very hacky. Other approaches:
15 ' - Could send WM_COPY / WM_PASTE messages from Dasher, but doesn't work with Word, IE fields, etc.
16 ' - Could send WM_KEYDOWN, WM_KEYUP events. Very fiddly to get working. This works better.
17 ' - Could use a keyboard journal playback hook to send keys (even more fiddly but still error prone).
18 ' - Could use one of various interfaces to MS Word or application X. Then it would only work with application X.
19 ' - Could make Dasher some sort of proper Windows input device like the Japanese IME. That sounds good.
20 ' It also sounds like it would take more than six lines of code, so if you have the time, please go ahead...
22 set ShellObject = WScript.CreateObject("WScript.Shell")
23 ShellObject.Run "EmptyClipboard.exe", 0, true
24 ShellObject.SendKeys "^c", true
25 'ShellObject.Run "dasher.exe --final-clipboard", 1, true
26 ShellObject.Run "calc", 1, true
27 WScript.Sleep 500
28 ShellObject.SendKeys "^v", true