Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

up vote 1 down vote accepted

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

Q::
    ;SetKeyDelay, 100 ; Not needed in this example, but this is where it would go
    Send ^n
    Sleep 50
    Send ^v       
    Sleep 50
    Send ^s
    Return        
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.