Jump to content
Sign in to follow this  
kats

Paste Vs. Send

Recommended Posts

kats

The sample I made below illustrates the way that AutoIt performs the send function. I used to use another program that would allow the macro to paste the given variable instead of typing it out which can be kind of slow (kind of looks like someone is actually typing it out). An example would be your basic cut and paste, when you paste it its there you dont have to wait for it to be typed out. I tried using a variable instead of typing it out in the send, but its still the same slow typing result. When I write scripts to fill out long boring repitive forms I need it to fill them out quickly so I dont have to wait so long. If you have any simple solutions great, if not dont worry about it, just thought someone might.

$gi="Testing one two three four five six seven eight nine ten"

Run("notepad.exe")

sleep(3000)

send($gi)

send("{enter}")

sleep(1000)

send("Testing one two three four five six seven eight nine ten {enter}")

sleep(1000)

send($gi)

send("{enter}")

sleep(1000)

send("Testing one two three four five six seven eight nine ten {enter}")

sleep(1000)

send($gi)

send("{enter}")

sleep(1000)

send("Testing one two three four five six seven eight nine ten {enter}")

sleep(1000)


Kats

Share this post


Link to post
Share on other sites
cartman380

Something like this should do it.

$gi="Testing one two three four five six seven eight nine ten"
ClipPut($gi)
Run("notepad.exe")
sleep(3000)
Send("^v" & @CR)
sleep(1000)
Send("^v"& @CR)
sleep(1000)
Send("^v"& @CR)
sleep(1000)
Send("^v"& @CR)
sleep(1000)
Send("^v"& @CR)
sleep(1000)
Send("^v"& @CR)
sleep(1000)

Share this post


Link to post
Share on other sites
spudw2k

You could use something like this, but it removes any text in the "control"

$txt = "Text Here"
Run("notepad.exe")
WinWait("Untitled -")
$txt = ControlGetText("Untitled -", "", "Edit1") & $txt
ControlSetText("Untitled -", "", "Edit1", $txt)

edit: corrected example

Edited by spudw2k

Share this post


Link to post
Share on other sites
kats

I honestly appreciate your help, your solution worked great!

Have a nice weekend,


Kats

Share this post


Link to post
Share on other sites
kats

What if you wanted to clipput an address ie. without an {enter} requirement? Using just one variable for the entire address $gi

7111 93rd Terrace

Williamsport, VA

33772-1766


Kats

Share this post


Link to post
Share on other sites
trancexx

What if you wanted to clipput an address ie. without an {enter} requirement? Using just one variable for the entire address $gi

7111 93rd Terrace

Williamsport, VA

33772-1766

Use @CRLF

btw, I hate Send()


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
cartman380

What if you wanted to clipput an address ie. without an {enter} requirement? Using just one variable for the entire address $gi

7111 93rd Terrace

Williamsport, VA

33772-1766

If you're getting square boxes you might just need to use @CRLF

if I understand the question right

$gi="7111 93rd Terrace" & @CRLF & "Williamsport, VA" & @CRLF & "33772-1766"

Share this post


Link to post
Share on other sites
komalo

also a nice example using spudw2k script to show the fastness of ControlSetText

#NoTrayIcon
$TestText = "Testing one two three four five six seven eight nine ten"

Run("notepad.exe")
$hWin = WinGetHandle("Untitled -")
WinWaitActive($hWin)
$hCtrl = ControlGetHandle($hWin, "", 15)

For $i = 1 To 10
    $TestText = ControlGetText("Untitled -", "", "Edit1") & $TestText
    ControlSetText($hWin, "", $hCtrl, $TestText & @CRLF)
Next

[font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font]

Share this post


Link to post
Share on other sites
trancexx

WinWait() is very important


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
komalo

you are right

#NoTrayIcon
$TestText = "Testing one two three four five six seven eight nine ten"

Run("notepad.exe")
WinWaitActive("Untitled -")
$hWin = WinGetHandle("Untitled -")
$hCtrl = ControlGetHandle($hWin, "", 15)

For $i = 1 To 10
    $TestText = ControlGetText("Untitled -", "", "Edit1") & $TestText
    ControlSetText($hWin, "", $hCtrl, $TestText & @CRLF)
Next

Edited by komalo

[font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font]

Share this post


Link to post
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
Sign in to follow this  

×