fu2m8 Posted September 22, 2006 Share Posted September 22, 2006 Hey Guys,I've come along way with the Webpage Printer Script i've been working on but was wondering if someone could give me a quick example on how to add to an array without using _ArrayAdd as for some reason when using it in my Case Else of my Select statement AutoIT crashes (if compiled or run from Scite -- and its one of those not very descriptive Windows errors, just ur typical program needed to end one's). The strange thing is i use it almost identically in all the other Case statements ?! The Case Else statement should be returning Printer Names from the web page that don't match the companies naming (or lack of...) standard...Parts of the the script i feel are relevant are shown below:expandcollapse popup#include <IE.au3> #include <Array.au3> Dim $ippPage1 = "http://192.168.125.119/ipp/pdisplay.htm" Dim $ippPage2 = "http://192.168.125.120/ipp/pdisplay.htm" Dim $ippPage3 = "http://192.168.125.121/ipp/pdisplay.htm" ;the following 4 vars set up the IE windows that contain the printer IPP addresses (3 are hidden, 1 is not) Dim $oIE1 = _IECreate ($ippPage1, 0, 0, 1, -1) Dim $oIE2 = _IECreate ($ippPage2, 0, 0, 1, -1) Dim $oIE3 = _IECreate ($ippPage3, 0, 0, 1, -1) Dim $oIE4 = _IECreate() ;these 3 vars should collect all the links that are on each of the printer pages Dim $oLinks1 = _IELinkGetCollection($oIE1) Dim $oLinks2 = _IELinkGetCollection($oIE2) Dim $oLinks3 = _IELinkGetCollection($oIE3) ;counters for info purposes Dim $level1Counter = 0 Dim $level2Counter = 0 Dim $level3Counter = 0 Dim $level4Counter = 0 ;etc.... ;arrays used for each of the floors printers Dim $lev1Array[1] Dim $lev2Array[1] Dim $lev3Array[1] Dim $lev4Array[1] ;etc.... Dim $miscArray[1] For $oLink In $oLinks1 Local $leftchr = StringLeft($oLink.outerText, 2) ;returns first 2 characters of the $oLink.outerText string Local $serverIP = "http://192.168.125.119/ipp/" Select Case $leftchr = "01" _ArrayAdd($lev1Array, '<TR><TD width="40%"><A href="' & $oLink.href & '"><IMG src="iprint.gif" border=0>' & $oLink.outerText & '</A></TD><TD align="right"><A href="' & $serverIP & $oLink.outerText & '" target=_blank><IMG src="info2.gif" border=0></A></TD></TR>' & @CRLF) Case $leftchr = "02" _ArrayAdd($lev2Array, '<TR><TD width="40%"><A href="' & $oLink.href & '"><IMG src="iprint.gif" border=0>' & $oLink.outerText & '</A></TD><TD align="right"><A href="' & $serverIP & $oLink.outerText & '" target=_blank><IMG src="info2.gif" border=0></A></TD></TR>' & @CRLF) Case $leftchr = "03" _ArrayAdd($lev3Array, '<TR><TD width="40%"><A href="' & $oLink.href & '"><IMG src="iprint.gif" border=0>' & $oLink.outerText & '</A></TD><TD align="right"><A href="' & $serverIP & $oLink.outerText & '" target=_blank><IMG src="info2.gif" border=0></A></TD></TR>' & @CRLF) Case $leftchr = "04" _ArrayAdd($lev4Array, '<TR><TD width="40%"><A href="' & $oLink.href & '"><IMG src="iprint.gif" border=0>' & $oLink.outerText & '</A></TD><TD align="right"><A href="' & $serverIP & $oLink.outerText & '" target=_blank><IMG src="info2.gif" border=0></A></TD></TR>' & @CRLF) ;etc................ ;...... ;.... Case Else If StringInStr($oLink.href, "http://192.168.125.119/ippdocs/isinstf.htm?ippPrinterURL=") Then _ArrayAdd($miscArray, '<TR><TD width="40%"><A href="' & $oLink.href & '"><IMG src="iprint.gif" border=0>' & $oLink.outerText & '</A></TD><TD align="right"><A href="' & $serverIP & $oLink.outerText & '" target=_blank><IMG src="info2.gif" border=0></A></TD></TR>' & @CRLF) EndIf EndSelect oÝ÷ Øâr§ëax ëk uú+¶jÇǢƲ²¶§X¤y«¢+Ø) ͱÍ(%MÑÉ¥¹%¹MÑÈ ÀÌØí½1¥¹¬¹¡É°ÅÕ½Ðí¡ÑÑÀè¼¼ÄäȸÄØà¸ÄÈÔ¸ÄÄä½¥ÁÁ½Ì½¥Í¥¹Íѹ¡Ñ´ý¥ÁÁAÉ¥¹ÑÉUI0ôÅÕ½Ðì¤Q¡¸(ÀÌØí½Ñ¡ÉÁÉ¥¹ÑÉÌôÀÌØí½Ñ¡ÉÁÉ¥¹ÑÉ̬Ä(¹%(¹M±Ð((then i can do a MsgBox later on displaying that variable which returns the expected number of printers that don't match the standard which is why i think its either something wrong with the _ArrayAdd function using it from Case Else or my coding (i'm thinking its me ).So... essentially what I think I'm after is if someone could show me how to add a value to my $miscArray whenever the Case Else statement thing is met or if anyone knows why the way i am using _ArrayAdd here is causing AutoIT to crash?!? Thanks in Advance Guys, P.S Full source is attached as well...Get_Printers_IP_From_iPrint_18.au3 Link to comment Share on other sites More sharing options...
fu2m8 Posted September 22, 2006 Author Share Posted September 22, 2006 Ahh didn't realise there was a new beta out already but i tried it with that and so far it seems to be working great... Just an FYI for any1 else that may have similar trouble i was originally using the AutoIt v3.2.0.1 Production version where the crashes were happening but am now using the autoit-v3.2.1.3-beta-setup.exe version and things seem to be ok... 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