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

In a application I am using, I want to
1. Create a new record (Ctrl+n)
2. Paste value from clip board (Ctrl+v)
3. Save record (Ctrl+s)
when I just press "q", seems like creation of new record takes some time, so I have tried adding both SetKeyDelay and sleep, but in both the cases the script is trying to save the record before the value is pasted, am I missing something?

Q::Send, ^n SetKeyDelay, 100 ^v^s

share|improve this question
up vote 1 down vote accepted

If the process takes some time, I would suggest putting some Sleep times in there like so:

    ;SetKeyDelay, 100 ; Not needed in this example, but this is where it would go
    Send ^n
    Sleep 50
    Send ^v       
    Sleep 50
    Send ^s
share|improve this answer
Thanks Elliot, but the script is trying to save the record before the value is pasted in the field. Is there any thing else I am missing? – Kiranshell Dec 4 '12 at 20:02
Are you certain your clipboard contains something? If so, is your caret somewhere that text can be entered? – Elliot DeNolf Dec 5 '12 at 15:54
Yes Elliot, if I do the same steps manually it is working – Kiranshell Dec 5 '12 at 22:23
With the information given, the only other suggestion I have for you is to perform either a ControlFocus or a MouseClick to ensure your caret is in the correct location. Programmatically, my answer is sound and answered the original question for the syntax of SetKeyDelay. Please mark it accepted if it helped you out. – Elliot DeNolf Dec 6 '12 at 15:17
Script worked perfectly with ControlFocus, thanks a lot Elliot. – Kiranshell Dec 6 '12 at 18:20

You must log in to answer this question.

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