-
Posts
333 -
Joined
-
Last visited
Everything posted by Allow2010
-
sorry, i just wanted to share my additions, please just delete the post(s) if you want/can.
-
Here are some small changes: smtpmailer.zip
-
need help parsing some html
Allow2010 replied to Allow2010's topic in AutoIt General Help and Support
no way...my head is starting to spin 🙂 -
need help parsing some html
Allow2010 replied to Allow2010's topic in AutoIt General Help and Support
Thanks to all who worked on this problem. I am still struggling to completely understand with the regexp parts, but it is getting clearer 🙂 -
need help parsing some html
Allow2010 replied to Allow2010's topic in AutoIt General Help and Support
Thanks a lot, it seems to do the job nicely. Do i understand this correct: ($j = 1 ? ($aRes[5 * $i + $j] = "checked") : $aRes[5 * $i + $j]) is it like If $j = 1 Then If $aRes[5 * $i + $j] = "checked" Then $a_staticroutes[$i][$j] = True Else $a_staticroutes[$i][$j] = False EndIf Else $a_staticroutes[$i][$j] = $aRes[5 * $i + $j] EndIf ? -
need help parsing some html
Allow2010 replied to Allow2010's topic in AutoIt General Help and Support
you are right, but i just hated the solution i came up with. -
need help parsing some html
Allow2010 replied to Allow2010's topic in AutoIt General Help and Support
@jos Thanks for giving me the opportunity to give more details. I have a working solution, but it is really ugly and i was reluctant to post it. If it helps as a starting point, here it is: #include <Array.au3> Dim $a_staticroutes[0][5] $examplelines = '<input type="checkbox" id="route0" name="route0" checked></td><td>1.1.1.1</td><td>2.2.2.2</td><td>3.3.3.3</td>' & _ '<input type="checkbox" id="route1" name="route1" ></td><td>4.4.4.4</td><td>5.5.5.5</td><td>6.6.6.6</td>' & _ '<input type="checkbox" id="route2" name="route2" checked></td><td>7.7.7.7</td><td>8.8.8.8</td><td>9.9.9.9</td>' $counter = 0 While 1 ConsoleWrite("---------------" & @crlf) $name = TextBetween($examplelines, 'id="route', '" name="route', 0, 1+1*$counter, 0, 1+1*$counter) If @error then ExitLoop ConsoleWrite("Name: " & $name & @CRLF) $checked = TextBetween($examplelines, 'name="route' & $name & '" ', '></td><td>', 0, 1, 0, 1+1*$counter) If $checked = "checked" Then $checked = True Else $checked = False EndIf ConsoleWrite("Checked: " & $checked & @CRLF) $ip = TextBetween($examplelines, '></td><td>', '</td><td>', 0, 1+1*$counter, 0, 2+$counter*3) If @error then ExitLoop ConsoleWrite("IP: " & $ip & @CRLF) $mask = TextBetween($examplelines, '</td><td>', '</td><td>', 0, 2+3*$counter, 0, 2+3*$counter+1) If @error then ExitLoop ConsoleWrite("Mask: " & $mask & @CRLF) $gateway = TextBetween($examplelines, '</td><td>', '</td><input ', 0, 3+3*$counter, 0, 1+1*$counter) If @error then ExitLoop ConsoleWrite("GW: " & $gateway & @CRLF) Local $aFill[1][5] = [[$name,$checked,$ip,$mask,$gateway]] _ArrayAdd($a_staticroutes,$aFill) $counter=$counter+1 WEnd _ArrayDisplay($a_staticroutes) Func TextBetween($text, $starttag, $endtag, $casesensebegin = 0, $occurencebegin = 1, $casesenseend = 0, $occurenceend = -1) If StringInStr($text, $starttag, $casesensebegin, $occurencebegin) And StringInStr($text, $endtag, $casesenseend, $occurenceend) Then $begin = StringInStr($text, $starttag, $casesensebegin, $occurencebegin) $begin = $begin + StringLen($starttag) $end = StringInStr($text, $endtag, $casesenseend, $occurenceend) If $end > $begin Then $text = StringMid($text, $begin, $end - $begin) Return $text Else SetError(1) ;begin not > end Return "" EndIf Else SetError(2) ;tags not found Return "" EndIf EndFunc ;==>TextBetween Edit: I should mention, that in some cases i will have to process hundreds of lines and performance might also be a problem with this code -
Hello, i have a router staus page (static routes) which looks like this (there may be hundreds in some cases): <input type="checkbox" id="route0" name="route0" checked></td><td>7.7.9.9</td><td>255.255.255.255</td><td>192.168.0.0</td> <input type="checkbox" id="route0" name="route0" ></td><td>7.7.9.9</td><td>255.255.255.255</td><td>192.168.0.0</td> I would like to generate an array with the following content stateofcheckbox name IP subnet gateway for X lines like in the example above. The array needs to store this info: stateofcheckbox true name route0 IP 7.7.9.9 subnet 255.255.255.255 gateway 192.168.0.0 and for line 2 stateofcheckbox false name route0 IP 7.7.9.9 subnet 255.255.255.255 gateway 192.168.0.0 and so on. Can anyone help me with parsing the html and also with constructing the array? All ideas welcome 🙂 Thanks!
-
Hi, i made some additions to the UDF. They may not be perfect, but they seem to work ok for me. So i decided to upload my version here, just in case someone might need this: SmtpMailerExample.au3 SmtpMailer.au3
-
How to do this for X attachments?
Allow2010 replied to Allow2010's topic in AutoIt General Help and Support
Ah, forget it, it does work...i just misinterpreted the syntax, i thought i had to create the varibale name to call it... -
How to do this for X attachments?
Allow2010 replied to Allow2010's topic in AutoIt General Help and Support
yes, but i can not just use $oEmail.Attachments($i).Fields.Item("urn:schemas:mailheader:content-disposition") = "attachment" as this is some kind of variable name 🙂 At least i think so .-) -
Hello, i need to do something like this: $oEmail.Attachments(1).Fields.Item("urn:schemas:mailheader:content-disposition") = "attachment" $oEmail.Attachments(1).Fields.Item("urn:schemas:mailheader:content-transfer-encoding") = "base64" $oEmail.Attachments(1).Fields.Update $oEmail.Attachments(2).Fields.Item("urn:schemas:mailheader:content-disposition") = "attachment" $oEmail.Attachments(2).Fields.Item("urn:schemas:mailheader:content-transfer-encoding") = "base64" $oEmail.Attachments(2).Fields.Update As i do not know how many attachments are needed, i will have to do it for every added attachment. $oEmail.Attachments(X).Fields.Item("urn:schemas:mailheader:content-disposition") = "attachment" Is there a way to do this? Thanks for your ideas and hints 🙂
-
Can I hide a trayitem like i hide a button?
Allow2010 replied to Allow2010's topic in AutoIt General Help and Support
I want to hide one TrayItem, not the complete trayIcon Compared to a normal GUI: I want to hide one button, not the complete GUI :-) When my Tray Menu has the following options Option1 Option2 Option3 Exit I would like to be able to hide some of the options like i can hide a button on a gui -
Can I hide a trayitem like i hide a button?
Allow2010 replied to Allow2010's topic in AutoIt General Help and Support
So i assume this is a NO :-) -
oh yes, very different from my solution, thanks...
-
Very good point, thank you!
-
Thank you, nice way to do it, learned something new.-)
-
Fast delete collumns from big array
Allow2010 replied to Allow2010's topic in AutoIt General Help and Support
yes, but in this case i can not change the query, i just have to live with the reslt...but thank you .-) -
OK, here it comes, but beware, i know it is ugly .-) Different from the discription in post #1 the example uses phone numbers only, but that is ok, i need it that way. In the original code all the different bad request cases are used for differen error messages, i just removed them here to make it more readable. $badrequest = 0 $fax = "" $phone = "" $mobile = "" $sRequest = "/function?fax=12345&phone=67890&mobile=0123456" $tempreq = StringReplace($sRequest, "/function?", "") $afirstsplit = StringSplit($tempreq, "&") ;better some regexp? If IsArray($afirstsplit) Then If $afirstsplit[0] = 3 Then For $i = 1 To 3 If $badrequest = 1 Then ExitLoop $asecondsplit = StringSplit($afirstsplit[$i], "=") If IsArray($asecondsplit) Then If $asecondsplit[0] = 2 Then If $asecondsplit[1] = "fax" Then If $fax = "" Then $fax = StringRegExpReplace($asecondsplit[2], "[D]", "") ;i want numbers only Else $badrequest = 1 ExitLoop EndIf ElseIf $asecondsplit[1] = "phone" Then If $mobile = "" Then $mobile = StringRegExpReplace($asecondsplit[2], "[D]", "") Else $badrequest = 1 ExitLoop EndIf ElseIf $asecondsplit[1] = "mobile" Then If $phone = "" Then $phone = StringRegExpReplace($asecondsplit[2], "[D]", "") Else $badrequest = 1 ExitLoop EndIf Else $badrequest = 1 ExitLoop EndIf Else $badrequest = 1 EndIf Else $badrequest = 1 EndIf Next Else $badrequest = 1 EndIf Else $badrequest = 1 EndIf If $badrequest = 0 Then ConsoleWrite("Phone:" & $phone & @CRLF) ConsoleWrite("Phone:" & $fax & @CRLF) ConsoleWrite("Phone:" & $mobile & @CRLF) Else ConsoleWrite("Bad request" & @CRLF) EndIf
-
Hello, i need to get some info from an URL. The end of the URL looks similar to this: /mycommand?name=Tester&phone=12345&mobile=544567 in my script i have variables $name, $phone and $mobile and i need the values from the url in the correct variables, even when the order of the parameters (the part after the ?) in the url is changed. I made some ugly code to do that and it works fine, i would just like to find a better way. Can anyone come up with a good idea here? Thank you!
-
Fast delete collumns from big array
Allow2010 replied to Allow2010's topic in AutoIt General Help and Support
Hello, as the array is the result of an sql request, i can not keep the array smaller (at least not in a simple way). the redim method works very good for me, but _ArryExtract is also a good option. Thanks for the help! -
Fast delete collumns from big array
Allow2010 replied to Allow2010's topic in AutoIt General Help and Support
oh yes, never needed it before :-) Thanks a lot! -
Hello, i have a very big array (3000+ rows and 158 cols). From this array only cols 1-19 are needed. In order to save some memory, i would like to delete unneeded info. I tried For $i = 158 To 20 Step -1 _ArrayColDelete($localdb, $i) Next and this seems to work fine, but it takes more than 20 seconds. Is there a faster way? All ideas welcome :-)
-
How to get number of elements of a scrollbox
Allow2010 replied to Allow2010's topic in AutoIt General Help and Support
i found a way that works for me. The tscrollbox1 contains elements named TEmployeeButton1 to TEmployeeButtonX. I can check if an element exists by ControlGetHandle("[CLASS:Panelname]", "", "[CLASSNN:TEmployeeButton" & $i & "]") I just count the elements that exist. Not beautiful, but works.