Jump to content

Recommended Posts

Posted (edited)

This question has bugged me for quite some time now.

If i use code like this will the script keep recalculating the line count or just calculate it once?

#Include <Array.au3>
#Include <File.au3>
Dim $Array[1]
$File = FileOpen("C:\Test.txt", 0)
For $X = 1 To _FileCountLines($File, "")
    _ArrayAdd($Array, FileReadLine($File))
Next
FileClose($File)
_ArrayToClip($Array, 1)

(Note:This was just an example to demonstate my point and serves no real purpose. :) )

Edited by SolidSnake
HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
Posted (edited)

seems only first time... as it should be... methinks

but, here is one that haunts me...

For $n = 1 to 10
   MsgBox(4096,"",$n)
   $n = $n + 1
Next

It makes sense, I guess... I first thought AutoIt would give an error saying that $n was readonly or something...

Lar.

<{POST_SNAPBACK}>

Yes. It appears this holds true for functions too , at least user defined ones. I just made a small script to test it.

Global $TestFuncTimes
For $X=1 to _TestFunc()
    ToolTip($X)
Next


Func _TestFunc()
    $TestFuncTimes=$TestFuncTimes+1
    MsgBox(32,"TestFunc.","Test Func has been executed " & $TestFuncTimes & " times.")
    Return 10
EndFunc

anyway thanks for the feedback Larry. :)

Edited by SolidSnake
HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

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
  • Recently Browsing   0 members

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