#153999 - 2005-12-23 01:58 PM
RFC on possible new UDF
|
Gargoyle
MM club member
   
Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
|
Created this as I had a specific need.
Please comment, and should this be an UDF after all comments are done?
Code:
;FUNCTION Convert2array ; ;ACTION Take a plain text file and convert it into an array ; that allows for use of includes ; ;AUTHOR Gargoyle ; ;CONTRIBUTORS Many for the suggestions on how to create this ; so that you can then tokenize the data and still ; "include". ; ;VERSION 1.0.1 ; ;DATE CREATED 12.23.05 ; ;DATE MODIFIED 12.23.05 ; ;KIXTART Only tested with 4.51 ; ;SYNTAX Convert2array(FileToConvert,FileToSave,ArrayName) ; ;PARAMETERS ; File to Convert ; Name of the input file, if not in the scriptdirectory ; specify full path name ; ; File to Save ; Name of the output file, if you don't want it in the ; script directory specify the full path. ; ; Array Name ; What name to you want to assign to the created array elements ; ;RETURNS Nothing ; ;REMARKS ; ;DEPENDENCIES ; ;KIXTART BBS ; ;
Function Convert2Array($IN,$Out,$Name) SetOption ("NoVarsInStrings", ON) Dim $Read, $Count, $FH, $In, $Out, $Name, $Array[] $FH = FreeFileHandle() $Count = 0 If Open($FH,$IN,2) = 0 $Read = ReadLine($FH) While @ERROR = 0 ReDim Preserve $Array[$Count] $Array[$Count] = $Read $Count = $Count + 1 $Read = ReadLine($FH) Loop Close($FH) Else $ = MessageBox("Error opening File" + @CRLF + @SERROR,"Warning",16) Exit @Error EndIf
If Open($FH,$OUt,5) = 0 For $ = 0 to Ubound($Array) WriteLine($FH,"$"+$Name+"["+$+"] = '" + $Array[$] + "'"+@CRLF) Next Close($FH) Else $ = MessageBox("Error opening File" + @CRLF + @SERROR,"Warning",16) EndIf EndFunction
Edited by Gargoyle (2005-12-23 03:38 PM)
_________________________
Today is the tomorrow you worried about yesterday.
|
|
Top
|
|
|
|
#154001 - 2005-12-23 02:09 PM
Re: RFC on possible new UDF
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
Have you seen ReadFile() and WriteFile() UDFs
|
|
Top
|
|
|
|
#154007 - 2005-12-23 04:17 PM
Re: RFC on possible new UDF
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
no... general topics
File & Disk String & Array Math etc...
Like SL's UDF Lib
|
|
Top
|
|
|
|
#154015 - 2006-01-03 07:57 PM
Re: RFC on possible new UDF
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11629
Loc: CA
|
The idea is good Gargoyle, however as Jochen and others say the implementation and continued management is a LONG thankless task that I doubt anyone wants to spend that much time on. Many of these UDFs could/would possibly fit into multiple categories so then what? An arbitration council? Then each one of those in question would possibly take from a day to a week to agree upon (if at all) so if say 100 UDFs fell into that category it could potentially takes months to even get to an agreement point for all of them.
ScriptLogic doesn't have that issue because from what I can tell there is one person in charge so it goes where he says and he is PAID to do it
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 895 anonymous users online.
|
|
|