AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

PasteBoard: Help Me Improve Its Reliability

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
instantrunoff



Joined: 13 Jan 2008
Posts: 62

PostPosted: Sun Apr 27, 2008 10:58 pm    Post subject: PasteBoard: Help Me Improve Its Reliability Reply with quote

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
View user's profile Send private message Visit poster's website
widow
Guest





PostPosted: Mon Apr 28, 2008 4:52 pm    Post subject: Reply with quote

nice idea
Back to top
widow
Guest





PostPosted: Mon Apr 28, 2008 4:54 pm    Post subject: Reply with quote

widow wrote:
nice idea
but doesnt work in XP as it seems.
Back to top
instantrunoff



Joined: 13 Jan 2008
Posts: 62

PostPosted: Mon Apr 28, 2008 5:28 pm    Post subject: Reply with quote

widow wrote:
widow wrote:
nice idea
but doesnt work in XP as it seems.

What exactly doesn't work in XP?
Back to top
View user's profile Send private message Visit poster's website
widow
Guest





PostPosted: Mon Apr 28, 2008 5:48 pm    Post subject: Reply with quote

instantrunoff wrote:
widow wrote:
widow wrote:
nice idea
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.
Smile
Back to top
instantrunoff



Joined: 13 Jan 2008
Posts: 62

PostPosted: Sun May 11, 2008 12:32 pm    Post subject: Reply with quote

HP Smart Web Printing looks much better, so I've given up on Pasteboard for now.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group