Jump to content

Trouble with ClipPut


diff
 Share

Recommended Posts

Hello,

still learning and trying to understand AutoIT but having problem in filling my PDF file.

 

So my code looks like similar to this:

Global $1 = "text text 44444444"
Global $2 = "texting2 texting2"
Global $3 = "newtext3 next3"


ShellExecute ("C:\Users\XXX\Desktop\myPDF.pdf")
WinWaitActive("MyPDF.pdf - Adobe Acrobat Reader DC")
Send ("{TAB}")
ClipPut($1)
Send ("^v")
Send ("{TAB 3}")
ClipPut($2)
Send("^v")
Send ("{TAB}")
ClipPut($3)
Send("^v")

So its fill my PDF form, the first field looks good, the code add the text text 4444, then second should be $2 with texting2 texting2 but for some reason the code uses for second and third field after TAB only variable $3.

So, I receive in $2 and $3 for some reason same newtext3 next3 in both, why its skipping the variable $2? Maybe there also much better solution for instant text? Because Send writes with delay by letters which I don't like.

Thanks!

Link to comment
Share on other sites

8 minutes ago, Danp2 said:

Also, have you considered dropping the use of ClipPut and just send the variable contents?

I do not have Acrobat Reader installed, but the approach from @Danp2 seems plausible to me.

Global $1 = "text text 44444444"
Global $2 = "texting2 texting2"
Global $3 = "newtext3 next3"

ShellExecute ("C:\Users\XXX\Desktop\myPDF.pdf")
WinWaitActive("MyPDF.pdf - Adobe Acrobat Reader DC")
Send ("{TAB}")
Send ($1)
Send ("{TAB 3}")
Send ($2)
Send ("{TAB}")
Send ($3)

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to comment
Share on other sites

6 hours ago, Danp2 said:

I've seen where you need a delay following ClipPut to give the item time to "appear" on the clipboard. Also, have you considered dropping the use of ClipPut and just send the variable contents?

You mean with Send()?

If yes, then it takes time while Send writes all the text and Opt SendKeyDownDelay, SendKeyDelay doesn't work here with 0 or 1 delay.

Link to comment
Share on other sites

44 minutes ago, diff said:

Opt SendKeyDownDelay, SendKeyDelay doesn't work here with 0 or 1 delay.

The value sets the time in milliseconds to pause (default=5)(0 removes the delay completely). It is not an on/off switch. Try to set the value to 50 or 100. For testing purposes you can also place Sleep(xxx) commands between the sends. Not the most elegant solution, but give it a try.

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to comment
Share on other sites

24 minutes ago, Musashi said:

The value sets the time in milliseconds to pause (default=5)(0 removes the delay completely). It is not an on/off switch. Try to set the value to 50 or 100. For testing purposes you can also place Sleep(xxx) commands between the sends. Not the most elegant solution, but give it a try.

Yeah I understand that it's not on/off, I tried random ms to set but it was still writing too long.

Looks like ClipPut works better if I add delay at least Sleep(200) about which was talking @Danp2. So, probably I solved my problem by adding everywhere Sleep(200) after ClipPut()

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...