Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've created a autohotscript to quickly dump selected text into my jot file on the Desktop and I think I'm facing a timing error.

The script works like thus:

  1. Select text when reading a text file, browsing internet, reading PDF, etc.
  2. Hit Ctrl + J
  3. Contents of selected text is dumped into my jot file.

When I press Ctrl + J very quickly, it sometimes doesn't come up in my jot file and sometimes when I keep pressing Ctrl + J for a long time, many instances of the text appear.

Could somebody please point out what's wrong with this script and how I can improve it.

^j::

Clipboard := "" ; clear

Send, ^c ; simulate Ctrl+C (=selection in clipboard)

selection = %Clipboard% ; save the content of the clipboard

FileAppend, `n%selection%`n,C:\Users\jagrati\Desktop\jots.txt

return
share|improve this question

A few things to try:

  1. Change Send to SendInput. This is a faster input method.
  2. Add ClipWait, 2 under the ^c line. This will wait for new clipboard text (but won't wait for it longer than 2 seconds).
  3. Add Sleep 50 between commands. It's not the best solution, but it may help if the first two things don't.
share|improve this answer
2  
2) seems the most likely solution to me. Sometimes being too fast IS a bad thing. – Phoshi Jul 4 '10 at 19:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .