Jump to content
Sign in to follow this  
Scottswan

Slowing down

Recommended Posts

Scottswan

I wanted to make a text file about 1.75meg big, so I made a quick script to type a line of text over and over fairly fast into notepad....

;Set type speed to fast!.
Opt("SendKeyDelay", 1)
; Run Notepad.
Run("notepad.exe")
; Wait for Notepad to become active.
WinWaitActive("Untitled - ")
; Define the count integer.
$count = 0
; Start the loop and specify how many counts to do.
While $count < 50000
; Count 1 on each pass
    $count = $count + 1
; Send some text to notepad on each pass.
    Send("Hey, this is a new line of text.    ")
; After the number of counts is done, end the loop.
Wend
Exit

It starts out screaming fast and does about 100 lines then it gradually slows down to a crawl.

Ok, lets try something else....

; Run Notepad.
Run("notepad.exe")
; Wait for Notepad become active.
WinWaitActive("Untitled - ")
; Define the count integer.
$count = 0
; Send some text to the clipboard.
    ClipPut("Hey, this is a new line of text.    ")
; Start the loop and specify how many counts to do.
While $count < 50000
; Count 1 on each pass
    $count = $count + 1
; Paste the text.
    Send("^v")
    Sleep(100)
; After the number of counts is done, end the loop.
Wend
Exit

This one does the same thing, starts off fast and slows down to a crawl.

It's not critical that I solve this or anything, but I was wondering if anyone could come up with a reason as to why it slows down?

Running on win98se, PIII 1ghz, 384meg ram

-Scott

Share this post


Link to post
Share on other sites
Jos

guess its the Notepad wordwrap logic, because you are creating one line.

Try it with this statement:

Send("Hey, this is a new line of text.    {ENTER}" )

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Scottswan

guess its the Notepad wordwrap logic, because you are creating one line.

<{POST_SNAPBACK}>

Ha! Now it's screamin....

; Run Notepad.
Run("notepad.exe")
; Wait for Notepad become active.
WinWaitActive("Untitled - ")
; Define the count integer.
$count = 0
; Send some text and 2 carrige returns to notepad on each pass.
    ClipPut("Thou shalt not deceive others.   ")
; Start the loop and specify how many counts to do.
While $count < 50000
; Count 1 on each pass
    $count = $count + 1
    Send("^v")
;   Sleep(5)
    Send("{Enter}")
; After the number of counts is done, end the loop.
Wend
Exit

I did turn wordwrap on/off, but only while the script was running.... so I mistakenly ruled that out.

Thanks

-Scott

Share this post


Link to post
Share on other sites
Wolvereness

Why don't you use FileWrite()?

$file = FileOpen($file, 2)
$string = 'Hey, this is a new line of text.' & @CRLF
$string = $string & $string & $string & $string & $string
For $x = 1 to 10000
FileWrite($file, $string)
Next
FileClose($file);this saves the file

Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]

Share this post


Link to post
Share on other sites
Scottswan

Why don't you use FileWrite()?

<{POST_SNAPBACK}>

Oh yea, there is a number of ways to do that, I was just wondering why the slowdown occurred. I thought it might be a 'governor' built into AutoIt that I ran into.

Thats the way it acted.

Or a memory glitch with Win98, which would not shock me.

-Scott

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  

×