Jump to content

The most useless UDF ever.


w0uter
 Share

Recommended Posts

LOL.

Well done!

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

Amazing, that's perfect! Exactly what I needed!

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

Or maybe even:

Func Useless()
EndFunc
"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

at least it returns an expected result... but, this is useless

Func CurrentTime()
   Return Random()
EndFunc

<{POST_SNAPBACK}>

lol... :(

I could see it now: "EDIT: added UDF _Ret" in the dev section :(

FootbaG
Link to comment
Share on other sites

Hmmm, this function is worse than useless:

Func _Ret($v_return)
    Local $result = $v_return
    SetError(@error)
        For $j = 1 to 10000
            For $i = 1 to 100000
                $A = StringSplit(Random(), "")
            Next
        Next
    Return $result
EndFunc

The inner loop takes ~6 seconds, so maybe the outer loop will take 60000 secs which is over 16 hrs? What fun!

BlueBearr

BlueBearrOddly enough, this is what I do for fun.
Link to comment
Share on other sites

  • 2 months later...

Hmmm, this function is worse than useless:

...

The inner loop takes ~6 seconds, so maybe the outer loop will take 60000 secs which is over 16 hrs?  What fun!

BlueBearr

<{POST_SNAPBACK}>

I think Bluebearr had the right idea, but what that script really needed was a way to keep the user from killing it. You need to use the progress bar with percent display include with this one, but it displays a progress bar where every percent takes longer than the previous one.

Func _Ret($v_return)
    Local $result = $v_return
    SetError(@error)
    
    If Not IsDeclared('Dark_Green') Then Dim $Dark_Green = 0x006400
    If Not IsDeclared('Red') Then Dim $Red = 0xff0000
    If Not IsDeclared('Yellow') Then Dim $Yellow = 0xffff00

    GUICreate("Processing - Please Wait", 220, 50, 100, 100)

;~ _Progress_Create (left, top, width, height[,style[,backcolor[,progressbar color[,text color[,invert text color]]]]]) Returns Control Id for Progress Bar
    Dim $h_progress[1]

    $h_progress[UBound($h_progress) - 1] = _Progress_Create (10, 10, 200, 20, -1, -1, $Red, -1, $Yellow)

    Local $outerloop = 10000, $innerloop = 100000
    Local $iterations = $outerloop * $innerloop
    Local $progress[100], $complete = 0
    
    $progress[99] = $iterations
    For $i = 98 to 0 Step -1
        $progress[$i] = $progress[$i + 1] / 1.3
    Next
    
    $iterations = 0
    GUISetState()
    
        For $j = 1 to $outerloop
            For $i = 1 to $innerloop
                $A = StringSplit(Random(), "")
                $iterations += 1
                If $iterations > $progress[ $complete ] Then
                    $complete += 1
                    _Progress_Update ($h_progress[0], $complete)
                EndIf
            Next
        Next
    Return $result
EndFunc
Edited by mother9987
Link to comment
Share on other sites

Or maybe even:

Func Useless()
EndFunc

<{POST_SNAPBACK}>

Not useless. Off the top of my head, I can see that calling that function does at least three things:

Clears @Error

Clears @Extended

Verifies that AutoIt is not at it's maximum recursion level

Link to comment
Share on other sites

Not useless.  Off the top of my head, I can see that calling that function does at least three things:

Clears @Error

Clears @Extended

Verifies that AutoIt is not at it's maximum recursion level

<{POST_SNAPBACK}>

And if you're still using v3.1.1.0, this will clear the return value which is a bug (Fixed in beta). For example, if you returned a large array (Bad idea, always work on arrays ByRef to avoid copying), then there would be two copies of the large array in memory; one in the variable holding the array and one erroneously sitll stored in the internal variable that holds the Return value. Calling an empty function would clear that return value and free the memory.

Again, that only affects v3.1.1.0 and older; its fixed in the beta.

Link to comment
Share on other sites

The inner loop takes ~6 seconds, so maybe the outer loop will take 60000 secs which is over 16 hrs?  What fun!

Not exactly useless, just a really inefficient "Pause" function... :)
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
Share on other sites

I changed mine a little bit.

$progress[99] = $iterations
    For $i = 98 to 0 Step -1
        $progress[$i] = $progress[$i + 1] / 1.15
    Next

1.15 seems to make me hate life a lot more than 1.3. I'm convinced that a lot of installers are using this kind of exponential for their progress bars already. :)

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...