ParoXsitiC 1 Posted September 12, 2007 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=0It 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) WEndI 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 Share this post Link to post Share on other sites
PsaltyDS 41 Posted September 12, 2007 The new current release version is 3.2.8.1 as of day-before-yesterday, and the fixes list some RegExp stuff specifically. I think you need to test against that version before going too far with your troubleshooting. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Share this post Link to post Share on other sites
ParoXsitiC 1 Posted September 12, 2007 The new current release version is 3.2.8.1 as of day-before-yesterday, and the fixes list some RegExp stuff specifically. I think you need to test against that version before going too far with your troubleshooting. I just checked it, it is plagued with the same problems. Share this post Link to post Share on other sites
ParoXsitiC 1 Posted September 13, 2007 This is an update for anyone else having the same problem I did. Here is the solution:$iNumChrsToRead = StringRegExp($sReturnStr, "(\d*?)(\#)(?:\$\[)", 1) $sReturnStr = StringTrimLeft($sReturnStr, $iNumChrsToRead[1])You first take note of whats to the left of the (\#), you will be using that later on. Now get rid of the (\#) so you're left with:$iNumChrsToRead = StringRegExp($sReturnStr, "(\d*?)(?:\$\[)", 1) $sReturnStr = StringTrimLeft($sReturnStr, $iNumChrsToRead[1])Now wherever you see $iNumChrsToRead[1] replace that with this:StringInStr($sReturnStr, StringBeforeThe\#) + StringLen ( StringBeforeThe\#) - 1Since our StringBeforeThe\# was (\d*?). We know that $iNumChrsToRead[0] will output the match. Therefore the whole thing turns into:$iNumChrsToRead = StringRegExp($sReturnStr, "(\d*?)(?:\$\[)", 1) $sReturnStr = StringTrimLeft($sReturnStr, StringInStr($iNumChrsToRead[0]) + StringLen ($iNumChrsToRead[0]) - 1) Share this post Link to post Share on other sites
randallc 0 Posted September 13, 2007 thanks! I'll try.. Randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Share this post Link to post Share on other sites