Sign in to follow this  
Followers 0
Jos

Standard UDF library

142 posts in this topic

Do we need to update scite or something to get these?

:P

I really have no clue about this whole thing.

AND WHAT ABOUT MY LITTLE COLLECTION OF INCLUDES!!! THANX FOR PUTTING THAT ONE.

wht's idiot.gif for?

Share this post


Link to post
Share on other sites



#102 ·  Posted (edited)

wht's idiot.gif for?

What about not resurrecting a post from Dec 2004 ?

And for your info: The idiot is gone ... banned for live ... and beyond

Edited by JdeB

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

Share this post


Link to post
Share on other sites

Just wondering if my Word Automation Library would be worth adding to the Standard UDF Library?

It was wrote to standard from the beginning so there shouldn't be any problems there, and now with over 1100 downloads and very few if any reported bugs I think it's stable.

Share this post


Link to post
Share on other sites

Anyone have any thoughts on this? For it or against it your not going to upset me!

Share this post


Link to post
Share on other sites

I think it would be fantastic.


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

#106 ·  Posted (edited)

Hi,

I have tried to get the TailRW udf up to standard; for fast writing, reading/ deleting lines from the end of huge log files etc. [and for redaing, / writing binary parts of files...]

main funcs are;

;apitry2.au3

#include "APITailRW.au3"

Local $sDeskFile = @DesktopDir & "\Rhododendron.bmp", $s_File = @WindowsDir & "\Rhododendron.bmp"

Local $i_FileSize = FileGetSize($s_File), $iMod = $i_FileSize - 4 * Int($i_FileSize / 4)

;======Read parts or tail of binary file =====in any order as Demo =================================

$h_File = _FileOpenAPI ($s_File) ;_APIFileOpen

$s_data2 = _FileReadAPI ($h_File, Int($i_FileSize / 4), 1 * Int($i_FileSize / 4), 1) ; read 2nd quarter file

$s_data1 = _FileReadAPI ($h_File, Int($i_FileSize / 4), 0 * Int($i_FileSize / 4), 1) ; read 1st quarter file

$s_data4 = _FileReadAPI ($h_File, Int($i_FileSize / 4) + $iMod, 3 * Int($i_FileSize / 4), 1) ; read 4th quarter file

$s_data3 = _FileReadAPI ($h_File, Int($i_FileSize / 4), 2 * Int($i_FileSize / 4), 1) ; read 3rd quarter file

$s_data = $s_data1 & $s_data2 & $s_data3 & $s_data4 ; concatenate in correct order

_FileCloseAPI ($h_File);_APIFileClose

;======Save binary file to desktop and open==========in any order as Demo ==================================

Local $iDel=FileDelete($sDeskFile), $hb_File = _FileOpenAPI ($sDeskFile) ;_FileOpenAPI

;======Set End of file related to $FileSize=================================

_FileSetPosAPI ($hb_File, $i_FileSize)

_FileSetEndAPI ($hb_File)

;======Set Data pieces================in any order as Demo ======================

_FileWriteAPI ($hb_File, $s_data3, 2 * Int($i_FileSize / 4), 1);_APIFileWrite($hFile, $szData, $i_FileSetPosAPI = -1, $Option = 0)

_FileWriteAPI ($hb_File, $s_data1, 0 * Int($i_FileSize / 4), 1);_APIFileWrite($hFile, $szData, $i_FileSetPosAPI = -1, $Option = 0)

_FileWriteAPI ($hb_File, $s_data4, 3 * Int($i_FileSize / 4), 1);_APIFileWrite($hFile, $szData, $i_FileSetPosAPI = -1, $Option = 0)

_FileWriteAPI ($hb_File, $s_data2, 1 * Int($i_FileSize / 4), 1);_APIFileWrite($hFile, $szData, $i_FileSetPosAPI = -1, $Option = 0)

_FileCloseAPI ($hb_File);_FileCloseAPI

ShellExecuteWait($sDeskFile)

FileDelete($sDeskFile)

Can someone plesae tell me if they might be wanted; and if so, what more neds be done?

Thanks, Randall

[EDIT] - new file posted, new names planned; BinaryTailRead added

APITailRW.zip

Edited by randallc

Share this post


Link to post
Share on other sites

#107 ·  Posted

Hi,

Here is an attempt to get fast GUI ListView sort to standard UDF;

please let e know if wanted;/ any more work needed [did I see help files can be generated automatically form udf doc now?]

Best, Randall

; Function Name: _GUICtrlCreateListView()

; Description: Creates a ListView control for the GUI, to us ethe faster associated sort routines

; Faster than orig autoIt sort [20-50x] and [12-15x] as fast as GUIRegister sort [unless icons; same] due to

; 1. maintaining arrays of text and LV objects in memory as 1D arrays

; 2. sorting them via fast VBS sort [main speed saving is the VBS change to 2D and back to sort; instead of AutoIt]

; 3. refilling the LV objects by SetData, so no re-creation of objects

Share this post


Link to post
Share on other sites

#108 ·  Posted (edited)

I sent this to JdeB awhile back, but we never really wrapped it up, and I never posted it here as an official submission. And I've added another new parameter since then.

I made a replacement _ArraySearch. There are two new parameters, $iFlag and $fMultiReturn.

$iFlag (optional) describes where and how to search for $vWhat2Find. Possible Values:

0 = (Default) Exact match.

1 = match at beginning of element.

2 = match at end of element.

3 = anywhere in element.

4 = Regular Expression (if used, $iCaseSense is ignored).

$fMultiReturn (optional) is a boolean value. If true, it returns an array listing the elements in which the search string was found. If false, returns the first element it finds. False by default.

I realize that there is already an improved version included, but I think that mine adds much more functionality and flexibility.

it's rather long, but hey, it works.

;===============================================================================
;
; Description:      Finds an entry within a one-dimensional array. (Similar to _ArrayBinarySearch() except the array does not need to be sorted.)
; Syntax:           _ArraySearch($avArray, $vWhat2Find, $iStart = 0, $iEnd = 0,$iCaseSense=0)
;
; Parameter(s):      $avArray               = The array to search
;                    $vWhat2Find            = What to search $avArray for
;                    $iStart (Optional)     = Start array index for search, normally set to 0 or 1. If omitted it is set to 0
;                    $iEnd  (Optional)      = End array index for search. If omitted or set to 0 it is set to Ubound($AvArray)-
;                    $iCaseSense (Optional) = If set to 1 then search is case sensitive
;                    $iFlag (Optional)      = How to match the search string.
;                       Possible Values:
;                         0  -  (Default) Exact match
;                         1  -  match at beginning of element
;                         2  -  match at end of element
;                         3  -  anywhere in element
;                         4  -  Regular Expression (if used, $iCaseSense is ignored)
;                    $fMultiReturn          = if 1 or true, returns an array containing all matches. $Array[0] = number of matches
; Requirement(s):   None
;
; Return Value(s):  On Success - Returns the position of an item in an array.
;                   On Failure - Returns an -1 if $vWhat2Find is not found
;                        @Error=1 $avArray is not an array
;                        @Error=2 $iStart is greater than UBound($AvArray)-1
;                        @Error=3 $iEnd is greater than UBound($AvArray)-1
;                        @Error=4 $iStart is greater than $iEnd
;                   @Error=5 $iCaseSense was invalid. (Must be 0 or 1)
;                   @Error=6 $vWhat2Find was not found in $avArray
;                   @Error=7 Invalid $iFlag parameter
;
; Author(s):        SolidSnake <MetalGearX91 at Hotmail dot com>; theguy0000 <theguy0000 at gmail dot com>
; Note(s):          This might be slower than _ArrayBinarySearch() but is useful when the array's order can't be altered.
;===============================================================================
Func _ArraySearch(Const ByRef $avArray, $vWhat2Find, $iStart = 0, $iEnd = 0, $iCaseSense = 0, $iFlag = 0, $fMultiReturn = False)
    Local $iCurrentPos, $iUBound
    Dim $avMatches[UBound($avArray)+1]
    $avMatches[0] = 0
    If Not IsArray($avArray) Then
        SetError(1)
        Return -1
    EndIf
    $iUBound = UBound($avArray) - 1
    If $iEnd = 0 Then $iEnd = $iUBound
    If $iStart > $iUBound Then
        SetError(2)
        Return -1
    EndIf
    If $iEnd > $iUBound Then
        SetError(3)
        Return -1
    EndIf
    If $iStart > $iEnd Then
        SetError(4)
        Return -1
    EndIf
    If Not ($iCaseSense = 0 Or $iCaseSense = 1) Then
        SetError(5)
        Return -1
    EndIf
    If $iFlag < 0 Or $iFlag > 4 Then
        SetError (7)
        Return -1
    EndIf
    For $iCurrentPos = $iStart To $iEnd
        Select
            Case $iCaseSense = 0
                Switch $iFlag
                    Case 0
                        If $avArray[$iCurrentPos] = $vWhat2Find Then
                            SetError(0)
                            If $fMultiReturn Then
                                $avMatches[0] += 1
                                $iNum = $avMatches[0]
                                $avMatches[$iNum] = $iCurrentPos
                            Else
                                Return $iCurrentPos
                            EndIf
                        EndIf
                    Case 1
                        If StringLeft ($avArray[$iCurrentPos], StringLen($vWhat2Find)) = $vWhat2Find Then
                            SetError (0)
                            If $fMultiReturn Then
                                $avMatches[0] += 1
                                $iNum = $avMatches[0]
                                $avMatches[$iNum] = $iCurrentPos
                            Else
                                Return $iCurrentPos
                            EndIf
                        EndIf
                    Case 2
                        If StringRight ($avArray[$iCurrentPos], StringLen($vWhat2Find)) = $vWhat2Find Then
                            SetError (0)
                            If $fMultiReturn Then
                                $avMatches[0] += 1
                                $iNum = $avMatches[0]
                                $avMatches[$iNum] = $iCurrentPos
                            Else
                                Return $iCurrentPos
                            EndIf
                        EndIf
                    Case 3
                        If StringInStr ($avArray[$iCurrentPos], $vWhat2Find) Then
                            SetError (0)
                            If $fMultiReturn Then
                                $avMatches[0] += 1
                                $iNum = $avMatches[0]
                                $avMatches[$iNum] = $iCurrentPos
                            Else
                                Return $iCurrentPos
                            EndIf
                        EndIf
                    Case 4
                        If StringRegExp ($avArray[$iCurrentPos], $vWhat2Find) Then
                            SetError (0)
                            If $fMultiReturn Then
                                $avMatches[0] += 1
                                $iNum = $avMatches[0]
                                $avMatches[$iNum] = $iCurrentPos
                            Else
                                Return $iCurrentPos
                            EndIf
                        EndIf
                EndSwitch
            Case $iCaseSense = 1
                Switch $iFlag
                    Case 0
                        If $avArray[$iCurrentPos] == $vWhat2Find Then
                            SetError(0)
                            If $fMultiReturn Then
                                $avMatches[0] += 1
                                $iNum = $avMatches[0]
                                $avMatches[$iNum] = $iCurrentPos
                            Else
                                Return $iCurrentPos
                            EndIf
                        EndIf
                    Case 1
                        If StringLeft ($avArray[$iCurrentPos], StringLen($vWhat2Find)) == $vWhat2Find Then
                            SetError (0)
                            If $fMultiReturn Then
                                $avMatches[0] += 1
                                $iNum = $avMatches[0]
                                $avMatches[$iNum] = $iCurrentPos
                            Else
                                Return $iCurrentPos
                            EndIf
                        EndIf
                    Case 2
                        If StringRight ($avArray[$iCurrentPos], StringLen($vWhat2Find)) == $vWhat2Find Then
                            SetError (0)
                            If $fMultiReturn Then
                                $avMatches[0] += 1
                                $iNum = $avMatches[0]
                                $avMatches[$iNum] = $iCurrentPos
                            Else
                                Return $iCurrentPos
                            EndIf
                        EndIf
                    Case 3
                        If StringInStr ($avArray[$iCurrentPos], $vWhat2Find, 1) Then
                            SetError (0)
                            If $fMultiReturn Then
                                $avMatches[0] += 1
                                $iNum = $avMatches[0]
                                $avMatches[$iNum] = $iCurrentPos
                            Else
                                Return $iCurrentPos
                            EndIf
                        EndIf
                    Case 4
                        If StringRegExp ($avArray[$iCurrentPos], $vWhat2Find) Then
                            SetError (0)
                            If $fMultiReturn Then
                                $avMatches[0] += 1
                                $iNum = $avMatches[0]
                                $avMatches[$iNum] = $iCurrentPos
                            Else
                                Return $iCurrentPos
                            EndIf
                        EndIf
                EndSwitch
        EndSelect
    Next
    If $fMultiReturn Then
        For $i = $avMatches[0]+1 To UBound($avMatches)-1
            _ArrayDelete ($avMatches, $i)
        Next
        Return $avMatches
    Else
        SetError(6)
        Return -1
    EndIf
EndFunc   ;==>_ArraySearch

Hope you like it!

Edited by theguy0000

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

#109 ·  Posted

?????

Any body have anything at all to say?

I thought it was a pretty good function...


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

#110 ·  Posted

I'd like to suggest a function to go in the Date Management UDF...

_DateToMonth works very much like _DateDayOfWeek (in fact I even formatted it almost identically to it) in that it takes a month number and returns the month. (e.g. 1 = January, 12 = December).

We have a function to convert the weekday number to the actual day, but not one for months and I think this would be useful to include in the standard UDF library.

DateToMonth.au3

Share this post


Link to post
Share on other sites

Hello?? Why can't I at least get a reply? I met all the standards and everything, I think...


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

Hello?? Why can't I at least get a reply? I met all the standards and everything, I think...

It seems to work fine, but you could shorten it up like this...

;===============================================================================
;
; Description:      Finds an entry within a one-dimensional array. (Similar to _ArrayBinarySearch() except the array does not need to be sorted.)
; Syntax:           _ArraySearch($avArray, $vWhat2Find, $iStart = 0, $iEnd = 0,$fCaseSense=0)
;
; Parameter(s):      $avArray               = The array to search
;                    $vWhat2Find            = What to search $avArray for
;                    $iStart (Optional)     = Start array index for search, normally set to 0 or 1. If omitted it is set to 0
;                    $iEnd  (Optional)      = End array index for search. If omitted or set to 0 it is set to Ubound($AvArray)-
;                    $fCaseSense (Optional) = If set to True (1) then search is case sensitive
;                    $iFlag (Optional)      = How to match the search string.
;                       Possible Values:
;                         0  -  (Default) Exact match
;                         1  -  match at beginning of element
;                         2  -  match at end of element
;                         3  -  anywhere in element
;                         4  -  Regular Expression (if used, $fCaseSense is ignored)
;                    $fMultiReturn          = if 1 or true, returns an array containing all matches. $Array[0] = number of matches
; Requirement(s):   None
;
; Return Value(s):  On Success - Returns the position of an item in an array.
;                   On Failure - Returns an -1 if $vWhat2Find is not found
;                        @Error=1 $avArray is not an array
;                        @Error=2 $iStart is greater than UBound($AvArray)-1
;                        @Error=3 $iEnd is greater than UBound($AvArray)-1
;                        @Error=4 $iStart is greater than $iEnd
;                   @Error=5 $fCaseSense was invalid. (Must be 0 or 1)
;                   @Error=6 $vWhat2Find was not found in $avArray
;                   @Error=7 Invalid $iFlag parameter
;
; Author(s):        SolidSnake <MetalGearX91 at Hotmail dot com>; theguy0000 <theguy0000 at gmail dot com>
; Note(s):          This might be slower than _ArrayBinarySearch() but is useful when the array's order can't be altered.
;===============================================================================
Func _ArraySearch(Const ByRef $avArray, $vWhat2Find, $iStart = 0, $iEnd = 0, $fCaseSense = False, $iFlag = 0, $fMultiReturn = False)
    If Not IsArray($avArray) Then
        SetError(1)
        Return -1
    EndIf

    Local $i, $iUBound, $fMatch
    Dim $avMatches[1] = [0]
    $iUBound = UBound($avArray) - 1
    If Not $iEnd Then $iEnd = $iUBound
    If $iStart > $iUBound Then
        SetError(2)
        Return -1
    EndIf
    If $iEnd > $iUBound Then
        SetError(3)
        Return -1
    EndIf
    If $iStart > $iEnd Then
        SetError(4)
        Return -1
    EndIf
    For $i = $iStart To $iEnd
        $fMatch = False
        Switch $fCaseSense
            Case False
                Switch $iFlag
                    Case 0
                        If $avArray[$i] = $vWhat2Find Then
                            $fMatch = True
                        EndIf
                    Case 1
                        If StringLeft($avArray[$i], StringLen($vWhat2Find)) = $vWhat2Find Then
                            $fMatch = True
                        EndIf
                    Case 2
                        If StringRight($avArray[$i], StringLen($vWhat2Find)) = $vWhat2Find Then
                            $fMatch = True
                        EndIf
                    Case 3
                        If StringInStr($avArray[$i], $vWhat2Find) Then
                            $fMatch = True
                        EndIf
                    Case 4
                        If StringRegExp($avArray[$i], $vWhat2Find) Then
                            $fMatch = True
                        EndIf
                    Case Else
                        SetError(7)
                        Return -1
                EndSwitch
            Case True
                Switch $iFlag
                    Case 0
                        If $avArray[$i] == $vWhat2Find Then
                            $fMatch = True
                        EndIf
                    Case 1
                        If StringLeft($avArray[$i], StringLen($vWhat2Find)) == $vWhat2Find Then
                            $fMatch = True
                        EndIf
                    Case 2
                        If StringRight($avArray[$i], StringLen($vWhat2Find)) == $vWhat2Find Then
                            $fMatch = True
                        EndIf
                    Case 3
                        If StringInStr($avArray[$i], $vWhat2Find, 1) Then
                            $fMatch = True
                        EndIf
                    Case 4
                        If StringRegExp($avArray[$i], $vWhat2Find) Then
                            $fMatch = True
                        EndIf
                EndSwitch
            Case Else
                SetError(5)
                Return -1
        EndSwitch
        If Not $fMatch Then ContinueLoop
        If Not $fMultiReturn Then
            SetError(0)
            Return $i
        EndIf
        _ArrayAdd($avMatches, $i)
        $avMatches[0] += 1
    Next
    If $avMatches[0] Then
        SetError(0)
        Return $avMatches
    EndIf
    SetError(6)
    Return -1
EndFunc   ;==>_ArraySearch

Share this post


Link to post
Share on other sites

heh...much better...thanks Big Daddy


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

Hello?? Why can't I at least get a reply? I met all the standards and everything, I think...

I have not much time to test UDF's myself...

So I still welcome updates to UDF's but expect they are well tested and shared with the forum community so people can have a look at them and comment on them.

I am also reluctant to just replace a UDF submitted by somebody else unless the original creator of the UDF looked at it (assuming he's still around :) ).

Fair enough ?


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

Share this post


Link to post
Share on other sites

I have not much time to test UDF's myself...

So I still welcome updates to UDF's but expect they are well tested and shared with the forum community so people can have a look at them and comment on them.

I am also reluctant to just replace a UDF submitted by somebody else unless the original creator of the UDF looked at it (assuming he's still around :rolleyes: ).

Fair enough ?

heh...fair enough...I don't think I had the right to get mad or anything...

1. I can assure it has been tested

2. http://www.autoitscript.com/forum/index.php?showtopic=37247 but that was the old version of mine, similar but without $fMultiReturn

3. this space intentionally left blank.


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

Could anyone post me "Page containing all info needed to qualify for inclusion of a UDF.", because it's real site seems to be down.

Share this post


Link to post
Share on other sites

Could anyone post me "Page containing all info needed to qualify for inclusion of a UDF.", because it's real site seems to be down.

Fixed the link on the first page.

:rolleyes:


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

Share this post


Link to post
Share on other sites

And for your info: The idiot is gone ... banned for live ... and beyond

Sorry for late on this post but all I wanted to say is "halelujah and his 6 ban-evading nicknames either :rolleyes:". Just doing a little search via forums :rambo:

Fixed the link on the first page.

:x

cool now it works.

I can do signature me.

Share this post


Link to post
Share on other sites

I'd like to suggest a function to go in the Date Management UDF...

_DateToMonth works very much like _DateDayOfWeek (in fact I even formatted it almost identically to it) in that it takes a month number and returns the month. (e.g. 1 = January, 12 = December).

We have a function to convert the weekday number to the actual day, but not one for months and I think this would be useful to include in the standard UDF library.

DateToMonth.au3

Any input from you super cool people (like JdeB)?

Share this post


Link to post
Share on other sites

#120 ·  Posted (edited)

Any input from you super cool people (like JdeB)?

Sure ...

why not follow the same concept as _DateDayOfWeek () and also make it possible to return the abbreviated Month name?

you can also fill the arrray like:

Local $aMonthNumber[13] = ["January","February","March"] etc

After that just sent it to me with all required files and I will include it.

Edited by JdeB

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

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  
Followers 0