Sign in to follow this  
Followers 0
Proph

StringRegExp limit

1 post in this topic

OK... I have some code that I think Smoke_n helped me put together a long time ago. Or I may have used some of his examples and combined them with mine.

Basically this function works like IniReadsection except it will get an array of the section even if it contains no = (equal signs). It produces a single array instead of a double array.

It use to work perfectly until recently there has been a limitation added to autoit.

http://www.autoitscript.com/forum/index.ph...00&hl=array

I was wondering if one of the expert coders here can help me figure out a way to get around this limitation while still keeping the speed that this used to have.

Here is the function plus example code:

test.au3

#include<Array.au3>
$test = IniReadSectionSingle(@Scriptdir & '\test.ini', 'FileMove')
_ArrayDisplay($test)

Func IniReadSectionSingle($secfile, $sec2read)
    $aArray = StringRegExp(FileRead($secfile), '(?s)(?i)\[' & $sec2read & ']\s*(.*?)\s*(\n\[|$)', 3)
    If IsArray($aArray) = 0 Then Return SetError(1, 0, '')
    Local $sHold = ''
    Local $aSplit = StringSplit(StringStripCR($aArray[0]), @LF)
    If IsArray($aSplit) Then
        _ArrayDisplay($aSplit, '$aSplit')
        If StringLeft($aSplit[1], 1) = '[' Then Return _ArrayCreate(1, '')
    EndIf
    For $iCC = 1 To UBound($aSplit) - 1
        If StringLeft(StringStripWS($aSplit[$iCC], 8), 1) <> ';' And _
            StringStripWS($aSplit[$iCC], 8) <> '' And _
            StringLeft(StringStripWS($aSplit[$iCC], 8), 1) <> '[' Then $sHold &= $aSplit[$iCC] & @LF
    Next
    If $sHold Then Return StringSplit(StringTrimRight($sHold, 1), @LF)
    Return SetError(2, 0, '')
EndFunc

Here is the test.ini contents to use for testing. Just place it in the same directory as test.au3:

[FileMove]
entries_access.txt,AddOnRestauration_access\entries_access.ini
optional.in_,optional\access\*
access.cp_,AddOnRestauration_access\*
accwiz.ex_,AddOnRestauration_access\*
access.hl_,AddOnRestauration_access\*
access.ch_,AddOnRestauration_access\*
arrow_r.cu_,AddOnRestauration_access\*
arrow_rl.cu_,AddOnRestauration_access\*
arrow_rm.cu_,AddOnRestauration_access\*
beam_r.cu_,AddOnRestauration_access\*
beam_rl.cu_,AddOnRestauration_access\*
beam_rm.cu_,AddOnRestauration_access\*
busy_r.cu_,AddOnRestauration_access\*
busy_rl.cu_,AddOnRestauration_access\*
busy_rm.cu_,AddOnRestauration_access\*
cross_r.cu_,AddOnRestauration_access\*
cross_rl.cu_,AddOnRestauration_access\*
cross_rm.cu_,AddOnRestauration_access\*
move_r.cu_,AddOnRestauration_access\*
move_rl.cu_,AddOnRestauration_access\*
move_rm.cu_,AddOnRestauration_access\*
no_r.cu_,AddOnRestauration_access\*
no_rl.cu_,AddOnRestauration_access\*
no_rm.cu_,AddOnRestauration_access\*
pen_r.cu_,AddOnRestauration_access\*
pen_rl.cu_,AddOnRestauration_access\*
pen_rm.cu_,AddOnRestauration_access\*
size1_r.cu_,AddOnRestauration_access\*
size1_rl.cu_,AddOnRestauration_access\*
size1_rm.cu_,AddOnRestauration_access\*
size2_r.cu_,AddOnRestauration_access\*
size2_rl.cu_,AddOnRestauration_access\*
size2_rm.cu_,AddOnRestauration_access\*
size3_r.cu_,AddOnRestauration_access\*
size3_rl.cu_,AddOnRestauration_access\*
size3_rm.cu_,AddOnRestauration_access\*
size4_r.cu_,AddOnRestauration_access\*
size4_rl.cu_,AddOnRestauration_access\*
size4_rm.cu_,AddOnRestauration_access\*
up_r.cu_,AddOnRestauration_access\*
up_rl.cu_,AddOnRestauration_access\*
up_rm.cu_,AddOnRestauration_access\*
wait_r.cu_,AddOnRestauration_access\*
wait_rl.cu_,AddOnRestauration_access\*
wait_rm.cu_,AddOnRestauration_access\*
arrow_i.cu_,AddOnRestauration_access\*
arrow_il.cu_,AddOnRestauration_access\*
arrow_im.cu_,AddOnRestauration_access\*
beam_i.cu_,AddOnRestauration_access\*
beam_il.cu_,AddOnRestauration_access\*
beam_im.cu_,AddOnRestauration_access\*
busy_i.cu_,AddOnRestauration_access\*
busy_il.cu_,AddOnRestauration_access\*
busy_im.cu_,AddOnRestauration_access\*
cross_i.cu_,AddOnRestauration_access\*
cross_il.cu_,AddOnRestauration_access\*
cross_im.cu_,AddOnRestauration_access\*
move_i.cu_,AddOnRestauration_access\*
move_il.cu_,AddOnRestauration_access\*
move_im.cu_,AddOnRestauration_access\*
no_i.cu_,AddOnRestauration_access\*
no_il.cu_,AddOnRestauration_access\*
no_im.cu_,AddOnRestauration_access\*
pen_i.cu_,AddOnRestauration_access\*
pen_il.cu_,AddOnRestauration_access\*
pen_im.cu_,AddOnRestauration_access\*
size1_i.cu_,AddOnRestauration_access\*
size1_il.cu_,AddOnRestauration_access\*
size1_im.cu_,AddOnRestauration_access\*
size2_i.cu_,AddOnRestauration_access\*
size2_il.cu_,AddOnRestauration_access\*
size2_im.cu_,AddOnRestauration_access\*
size3_i.cu_,AddOnRestauration_access\*
size3_il.cu_,AddOnRestauration_access\*
size3_im.cu_,AddOnRestauration_access\*
size4_i.cu_,AddOnRestauration_access\*
size4_il.cu_,AddOnRestauration_access\*
size4_im.cu_,AddOnRestauration_access\*
up_i.cu_,AddOnRestauration_access\*
up_il.cu_,AddOnRestauration_access\*
up_im.cu_,AddOnRestauration_access\*
wait_i.cu_,AddOnRestauration_access\*
wait_il.cu_,AddOnRestauration_access\*
wait_im.cu_,AddOnRestauration_access\*
arrow_l.cu_,AddOnRestauration_access\*
arrow_m.cu_,AddOnRestauration_access\*
beam_l.cu_,AddOnRestauration_access\*
beam_m.cu_,AddOnRestauration_access\*
busy_l.cu_,AddOnRestauration_access\*
busy_m.cu_,AddOnRestauration_access\*
cross_l.cu_,AddOnRestauration_access\*
cross_m.cu_,AddOnRestauration_access\*
move_l.cu_,AddOnRestauration_access\*
move_m.cu_,AddOnRestauration_access\*
no_l.cu_,AddOnRestauration_access\*
no_m.cu_,AddOnRestauration_access\*
pen_l.cu_,AddOnRestauration_access\*
pen_m.cu_,AddOnRestauration_access\*
size1_l.cu_,AddOnRestauration_access\*
size1_m.cu_,AddOnRestauration_access\*
size2_l.cu_,AddOnRestauration_access\*
size2_m.cu_,AddOnRestauration_access\*
size3_l.cu_,AddOnRestauration_access\*
size3_m.cu_,AddOnRestauration_access\*
size4_l.cu_,AddOnRestauration_access\*
size4_m.cu_,AddOnRestauration_access\*
up_l.cu_,AddOnRestauration_access\*
up_m.cu_,AddOnRestauration_access\*
wait_l.cu_,AddOnRestauration_access\*
wait_m.cu_,AddOnRestauration_access\*
narrator.ex_,AddOnRestauration_access\*
reader.ch_,AddOnRestauration_access\*
reader.hl_,AddOnRestauration_access\*
magnify.ex_,AddOnRestauration_access\*
magnify.ch_,AddOnRestauration_access\*
magnify.hl_,AddOnRestauration_access\*
osk.ex_,AddOnRestauration_access\*
osk.ch_,AddOnRestauration_access\*
osk.hl_,AddOnRestauration_access\*
utilman.ex_,AddOnRestauration_access\*
utilmgr.ch_,AddOnRestauration_access\*
utilmgr.hl_,AddOnRestauration_access\*

It will fail and not give an array. If you remove about 3 lines from the [FileMove] section then it will work.

this is a vital function I use in my program RVM Integrator. If it doesn't work then it causes a lot of problems in my code. :)

Please help me. Thanks.

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