I'm trying to use AutoHotKey to automate some of my work. When corresponding to customers, I have a template I use. I've created the template and copied it to the clipboard and saved it to a file using an AutoHotKey script - this part worked fine. I now want to save off whatever is in the clipboard, load the pre-saved file, paste it into my Outlook Message window and then restore the saved clipboard back to the clipboard. I've tried this several ways without success - normally, what gets copied to Outlook is whatever is in the clipboard originally. Here are the scripts I've attempted:
^F5::
ClipSaved := ClipboardAll ; Save the entire clipboard to ClipSaved (Not just text)
Clipboard = ; Clear the clipboard
FileRead, Clipboard, *c <fullpath to saved file like c:\dir\file.clip>
MyErr = %ErrorLevel%
if MyErr >= 1
{
MsgBox, Unable to read case_format.clip!
}
ClipWait, 5
SendInput, ^v
Clipboard := ClipSaved ; Restore the clipboard we saved
ClipSaved = ; Free the memory in case the clipboard was very large
Return
I've also tried using the WinClipApi and it won't work either. It copies nothing and I end up with a 'beep' from windows:
^F5::
WinClip.Snap( ClipSaved )
WinClip.Clear()
WinClip.Load( <full path to file like "c:\dir\file.clip"> )
ClipWait,5,
WinClip.Paste()
WinClip.Restore( ClipSaved )
Return
I've tried mixing and matching pieces (like using the FileRead AHK command in the WinClip example, substituting 'SendInput, ^v' for WinClip.Paste() and so on) but nothing seems to work. Any suggestions?
Clipboard := ClipSaved
, notClipboard = ClipSaved
– Jim U