Sign in to follow this  
Followers 0
ParoXsitiC

\# with StringRegExp

1 post in this topic

#1 ·  Posted (edited)

I am trying to update a UDF to work with the current version of AutoIT. It is a multithread UDF located here: http://www.autoitscript.com/forum/index.ph...outine&st=0

It is mostly not working because of the many changes to StringRegExp in the past year or so. One of the biggest difficulties I am coming to is the use of \#. Is there anyway to emulate this in the newer StringRegExp?

For those who are not familiar with what \# use to do, here is a line from the old help file:

\# Position. Record the current character location in the test string into the returned content array.

Here are some examples of the UDF using it:

$sReturnStr = StdoutRead($iPID)
        $iNumChrsToRead = StringRegExp($sReturnStr, "(\d*?)(\#)(?:\$\[)", 1)
        $sReturnStr = StringTrimLeft($sReturnStr, $iNumChrsToRead[1])
        While StringLen($sReturnStr) < $iNumChrsToRead[0]
            $sReturnStr &= StdoutRead($iPID)
        WEnd

I attempted to fix it with this code, but it doesnt always work for everything:

$sReturnStr = StdoutRead($iPID)
        $iNumChrs = StringRegExp($sReturnStr, "(\d*?)(?:\$\[)", 1)
        $iNumChrsToRead = StringLen($iNumChrs[0])
        $sReturnStr = StringTrimLeft($sReturnStr, $iNumChrsToRead)
        While StringLen($sReturnStr) < $iNumChrs[0]
            $sReturnStr &= StdoutRead($iPID)
        WEnd
Edited by ParoXsitiC

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