Jump to content

Slowing down


 Share

Recommended Posts

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

Link to comment
Share on other sites

  • Developers

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}" )

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...