Jump to content
Sign in to follow this  
langthang084

send problem on slow computer

Recommended Posts

langthang084

my script like this: 

send(......)
send(............................)
send(.........)
 

But my CPU is Intel Celeron 2Ghz, DDR RAM 512Mb, so when i use some send a long character string, it runs incorrectly

So, is there anyway to use sleep(time) to make script stop until the send complete, then run the next send code (i dont want use time is number to avoid waste time)

Share this post


Link to post
Share on other sites
jdelaney

Don't use sends then.  Use controlsettext.

  • Like 1

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites
langthang084

i want to use with "Find and Replace" in Word. 

send("aaaaaaaaaaaaaaaaaaaaaaaaaaa")
    sleep(1000)
    send("{tab}")
    sleep(300)
    send("bbbbbbbbbbbbbbbbbbbbbbbbb")
    sleep(1000)
    send("!a")
    sleep(300)

then the result is "aaaaaaaaaaaaabbbb" and i dont know how to use ControlSetText with "find and replace" :|

Share this post


Link to post
Share on other sites
somdcomputerguy

Using ControlSetText will prove to be much more reliable than using Send. The AutoIt Window Info Tool can be used to obtain the Control ID and other information that you will need to use that function.

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
jdelaney

This may or may not work on your version.

I'm unable to get the buttons.  Probably need UI automation for that, but most is done:

; initate the find-replace window...then execute this script
$hFindReplace = WinWait("Find and Replace")
WinActivate($hFindReplace)
$hFind = ControlGetHandle($hFindReplace,"",1024)
$hReplace = ControlGetHandle($hFindReplace,"",1026)

ControlSetText($hFindReplace, "", $hFind, "searchstring")
ControlSetText($hFindReplace, "", $hReplace, "replacestring")

ControlSend($hFindReplace, "", "","!a")

WinWaitClose($hFindReplace)

ConsoleWrite("done" & @CRLF)
  • Like 1

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites
Muzaiyan

i think you was looking for this

Opt('SendAttachMode', 1)            ; 0 = Don't attach, 1 = Attach.
Opt('SendCapslockMode', 0)      ; 1 = Store and restore, 0 = Don't store/restore.
Opt('SendKeyDelay', 5)          ; ? = 5 milliseconds.
Opt('SendKeyDownDelay', 1)      ; ? = 1 millisecond.

if you are still not satisfied then make a udf like this

Func _Send($character,$sleep)
Send($character)
Sleep($sleep)
EndFunc

and send your string character by character using a loop :):D:P

  • Like 1

Share this post


Link to post
Share on other sites
jdelaney

Seems like putting makeup on a pig (just an opinion)


IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites
Muzaiyan

i was replying to this

 is there anyway to use sleep(time) to make script stop until the send complete, then run the next send code

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  

×