Hi zusammen, ich hoffe jemand kann mir sagen wie das ganze funktioniert. Von einem Source Code brauche ich mehrere Informationen.
<td><a href="index.php?id=6543&screen=view">Test (12-34)</a></td>
<td>12154</td>
<td>asdf</td>
Dieser Code steht auf drei verschiedenen Zeilen. Ich würde gerne die ID (6543) der angezeigt Namen (Test (12-34)) und der Preis 12154 zurückbekommen. Wie kann ich dies mit AutoIt und Regex lösen?
Teilweise ist dieser Code bis zu 1000 mal auf der Webseite vorhanden.
Bisher habe ich es mit einer eigenen SearchAndCut Funktion gelöst (Weiter unten), jedoch dauert das auslesen so bis zu einer Minute..
Gruss
AutoIt: SearchAndCut
Func SearchAndCut($string1, $string2, $string3, $string4, $string5)
$tempPos1 = ''
$tempPos2 = ''
$tempPos3 = ''
$tempPos4 = ''
$tempPosEnd = ''
$source = _IEDocReadHTML($oIE)
If $string3 = '' And $string4 = '' And $string5 = '' Then
$tempPos1 = StringInStr($source, $string1)
$tempPosEnd = StringInStr($source, $string2, 0, 1, $tempPos1+StringLen($string1))
$ReturnString = StringMid($source, $tempPos1+StringLen($string1), $tempPosEnd-($tempPos1+StringLen($string1)))
ElseIf $string4 = '' And $string5 = '' Then
$tempPos1 = StringInStr($source, $string1)
$tempPos2 = StringInStr($source, $string2, 0, 1, $tempPos1)
$tempPosEnd = StringInStr($source, $string3, 0, 1, $tempPos2+StringLen($string2))
$ReturnString = StringMid($source, $tempPos2+StringLen($string2), $tempPosEnd-($tempPos2+StringLen($string2)))
ElseIf $string5 = '' Then
$tempPos1 = StringInStr($source, $string1)
$tempPos2 = StringInStr($source, $string2, 0, 1, $tempPos1+StringLen($string1))
$tempPos3 = StringInStr($source, $string3, 0, 1, $tempPos2+StringLen($string2))
$tempPosEnd = StringInStr($source, $string4, 0, 1, $tempPos3+StringLen($string3))
$ReturnString = StringMid($source, $tempPos3+StringLen($string3), $tempPosEnd-($tempPos3+StringLen($string3)))
Else
$tempPos1 = StringInStr($source, $string1)
$tempPos2 = StringInStr($source, $string2, 0, 1, $tempPos1+StringLen($string1))
$tempPos3 = StringInStr($source, $string3, 0, 1, $tempPos2+StringLen($string2))
$tempPos4 = StringInStr($source, $string4, 0, 1, $tempPos3+StringLen($string3))
$tempPosEnd = StringInStr($source, $string5, 0, 1, $tempPos4+StringLen($string4))
$ReturnString = StringMid($source, $tempPos4+StringLen($string4), $tempPosEnd-($tempPos4+StringLen($string4)))
EndIf
Return $ReturnString
EndFunc
Alles anzeigen
Die SearchAndCut Funktion kann so mit mehreren Parametern aufgerufen werden..