gcue Posted August 11, 2011 Share Posted August 11, 2011 from several lines of html code, i am trying to get a link (ipp://PRINTERS/ipp/S-IV1-HP4350PS) based on a print queue name (S-IV1-HP4350PS) </TR><TR><TD width='40%'><A href="isinstf.htm?ippPrinterURL=ipp://PRINTERS/ipp/S-IV1-HP4350PS&onInstalled=alert&onNotInstalled=install"><IMG SRC='/ippdocs/images/iprint.gif' BORDER=0>S-IV1-HP4350PS</A></TD> i have a tried a few things to no avail $uri = StringRegExp($aTableData[0][$x], "(?<=PrinterURL" & $printer_queue_name & " )[^\v]+", 1) thanks in advance Link to comment Share on other sites More sharing options...
PowerCat Posted August 11, 2011 Share Posted August 11, 2011 Dirty, but it works! $str='</TR><TR><TD width=40%><A href="isinstf.htm?ippPrinterURL=ipp://PRINTERS/ipp/S-IV1-HP4350PS&onInstalled=alert&onNotInstalled=install"><IMG SRC=/ippdocs/images/iprint.gif BORDER=0>S-IV1-HP4350PS</A></TD>' $pos1 = StringInStr($str, "ipp:", 0, 1) $pos2 = StringInStr($str, "&on", 0, 1, $pos1) $str1 = StringMid($str, $pos1, $pos2 - $pos1) ConsoleWrite($str1 & @CRLF) Link to comment Share on other sites More sharing options...
gcue Posted August 11, 2011 Author Share Posted August 11, 2011 (edited) thanks powercat but it doesnt work.. maybe because the string is 781 lines =) and theres other instances ipp: and &on but for different printers Edited August 11, 2011 by gcue Link to comment Share on other sites More sharing options...
GEOSoft Posted August 11, 2011 Share Posted August 11, 2011 What does $aTableData[0][$x] look like? If it's the (sloppy html) code you posted above then try $s_String = "</TR><TR><TD width='40%'><A href="isinstf.htm?ippPrinterURL=ipp://PRINTERS/ipp/S-IV1-HP4350PS&onInstalled=alert&onNotInstalled=install"><IMG SRC='/ippdocs/images/iprint.gif' BORDER=0>S-IV1-HP4350PS</A></TD> $s_Printer = "S-IV1-HP4350PS" $uri = StringRegExpReplace($s_String, "(?i).+?<a href=.+?url=(.+?/" & $s_Printer & ").*", "$1") George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
gcue Posted August 11, 2011 Author Share Posted August 11, 2011 (edited) in this case $aTableData[0][$x] = S-IV1-HP4350PS i ran what you gave me and it captures S-IV1-HP4350PS i am trying to get ipp://PRINTERS/ipp/S-IV1-HP4350PS getting close!! thanks GEO for your help Edited August 11, 2011 by gcue Link to comment Share on other sites More sharing options...
GEOSoft Posted August 11, 2011 Share Posted August 11, 2011 (edited) I had the input string messed up but the expression should be correct. Run this code as is and see what you get.$s_String = "</TR><TR><TD width='40%'>" & '<A href="' & 'isinstf.htm?ippPrinterURL=ipp://PRINTERS/ipp/S-IV1-HP4350PS&onInstalled=alert&onNotInstalled=install">' & "<IMG SRC='/ippdocs/images/iprint.gif' BORDER=0>S-IV1-HP4350PS</A></TD>" $s_Printer = "S-IV1-HP4350PS" ;; Change this to $aTableData[0][$x] in a loop $uri = StringRegExpReplace($s_String, "(?i).+?<a href=.+?url=(.+?/" & $s_Printer & ").*", "$1") MsgBox(0, "Result", $uri) ;ClipPut($uri)I get "ipp://PRINTERS/ipp/S-IV1-HP4350PS"If that's not giving you the correct result then I suspect something else in the html is causing it. A line break perhaps? Edited August 11, 2011 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
gcue Posted August 11, 2011 Author Share Posted August 11, 2011 looks good =) many thanks GEO! Link to comment Share on other sites More sharing options...
GEOSoft Posted August 11, 2011 Share Posted August 11, 2011 No problem. Glad it worked out George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now