 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
instantrunoff
Joined: 13 Jan 2008 Posts: 62
|
Posted: Sun Apr 27, 2008 10:58 pm Post subject: PasteBoard: Help Me Improve Its Reliability |
|
|
I made a script for automatically copying and pasting into a specific document (the "pasteboard"). The way it works is that in the document you want to paste into, you press Ctrl-Ins, and then whenever you select text anywhere and press Ins, that content will be appended to the pasteboard.
However, I had to increase the key delay to get it to work at all reliably on Vista (using SendInput didn't work well at all). If you have further suggestions, I'd love to know them.
| Code: |
SendMode Input
!Insert::Insert
^Insert::
WinGet, pasteboard, ID, A
ControlGetFocus, edit, A
WinGetTitle, pasteboardname, ahk_id %pasteboard%
TrayTip, PasteBoard, %pasteboardname%
Sleep 2000
Traytip
return
Insert:: ; copy and paste into rich file
If (pasteboard <> "")
{
gosub backupclip
ControlSend, %edit%, ^{end}, ahk_id %pasteboard%
ControlSend, %edit%, ^v, ahk_id %pasteboard%
ControlSend, %edit%, {enter 2}, ahk_id %pasteboard%
gosub restoreclip
}
else
{
Traytip, PasteBoard, No PasteBoard Selected
Sleep 2000
Traytip
}
return
backupclip:
ClipSaved := ClipboardAll ; Save the entire clipboard to a variable of your choice.
clipboard = ; empty clipboard
Send ^c
ClipWait, 1, 1
IfEqual, ErrorLevel, 0
return
else
{
gosub restoreclip
exit
}
restoreclip:
Clipboard := ClipSaved ; Restore the original clipboard. Note the use of Clipboard (not ClipboardAll).
ClipSaved = ; Free the memory in case the clipboard was very large.
return |
Update May 4, 2008: SendMode Input does work in Vista, but AHK has to run in XP SP2 compatibility mode.
Last edited by instantrunoff on Sun May 04, 2008 3:50 pm; edited 1 time in total |
|
| Back to top |
|
 |
widow Guest
|
Posted: Mon Apr 28, 2008 4:52 pm Post subject: |
|
|
| nice idea |
|
| Back to top |
|
 |
widow Guest
|
Posted: Mon Apr 28, 2008 4:54 pm Post subject: |
|
|
| but doesnt work in XP as it seems. |
|
| Back to top |
|
 |
instantrunoff
Joined: 13 Jan 2008 Posts: 62
|
Posted: Mon Apr 28, 2008 5:28 pm Post subject: |
|
|
| widow wrote: | | but doesnt work in XP as it seems. |
What exactly doesn't work in XP? |
|
| Back to top |
|
 |
widow Guest
|
Posted: Mon Apr 28, 2008 5:48 pm Post subject: |
|
|
| instantrunoff wrote: | | widow wrote: | | but doesnt work in XP as it seems. |
What exactly doesn't work in XP? | Sry, it didnt work with notepad. Another texteditor worked ok tough.
 |
|
| Back to top |
|
 |
instantrunoff
Joined: 13 Jan 2008 Posts: 62
|
Posted: Sun May 11, 2008 12:32 pm Post subject: |
|
|
| HP Smart Web Printing looks much better, so I've given up on Pasteboard for now. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|