Tips:
1, every time you have to jump out of the window in 1.8 seconds after this action, and is only sent once the action, sent after the next window to wait to jump out of the cycle.
2, each loop will only send a CTRL + V after the stop, rather than always send
When you see the problem, start writing the test code immediately, and the problem occurs:
When the InputBox window pops up, the VBS is paused, waits for user input, clicks OK or cancels,
So the Wshshell.sendkeys "^v" behind it will not execute,
If you click OK or Cancel before the InputBox window pops up, then CTRL + + will not be able to paste the contents of the Clipboard into the InputBox window, if the Wshshell.sendkeys "^v" before the InputBox, also not, because For InputBox has not yet bounced out, Ctrl + V can not implement paste content to InputBox,
To convert the idea, we write InputBox and sendkey two files so that they do not conflict with each other, the final resolution code is as follows:
Copy Code code as follows:
Set wshshell=wscript.createobject ("Wscript.Shell")
Wscript.Sleep 2000
Set fso=wscript.createobject ("Scripting.FileSystemObject")
Set F=fso.opentextfile ("Sendkey.vbs", 2,true)
F.write ("Set wshshell=wscript.createobject (" & Chr () & "Wscript.Shell" & Chr (+) & ")"
F.writeblanklines (1)
F.write ("Wscript.Sleep 1800")
F.writeblanklines (1)
F.write ("Wshshell.appactivate" & Chr () & "Tips" & Chr (34))
F.writeblanklines (1)
F.write ("Wshshell.sendkeys" & Chr () & "^v" & Chr (34))
F.writeblanklines (1)
F.close
Wshshell.run ("Sendkey.vbs")
InputBox "Please enter", "Prompt", "" "
Fso. DeleteFile ("Sendkey.vbs")
The code first writes Sendkey.vbs and executes, waits 1.8 seconds to send Ctrl + V, then pops up the InputBox, then InputBox bounces out, Sendkey.vbs waits 1.8 seconds to execute CTRL + V Paste the content into the InputBox input box. Problem solving
Summary: In the face of some problems, can not be a dead man, change the train of thought, in fact, not difficult to solve!