Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/07/2015 in all areas

  1. [NEW RELEASE] - 11 Jan 15 Added: A new function (_GUITreeViewEx_SaveTV) to save the current TreeView (and checkbox state). Changed: A number of function names have been altered to reflect that at present the UDF is mainly oriented towards checkbox management (but stick around... ). This is script breaking so please do look at the new names if you have already used the UDF in a script. New zip below. A recent thread dealt with getting TreeViews with checkboxes to automatically check/clear associated items when a checkbox was actioned. It seemed like a good idea for a UDF and so here it is. I think the examples are pretty self-explanatory: initialise a TreeView once it is filled, register the UDF NOTIFY handler and then check/clear some checkboxes! Additional functionalities are the ability to check/clear ALL checkboxes in the TreeView and to stop the UDF acting on a previously initialised TreeView. There are also functions to fill/save a TreeView using a text string to define the item titles and the levels at which they should be created which has no link to the other UDF functions but seemeduseful to add. Here is a zip containing the UDF and examples in both MessageLoop & OnEvent mode: GUITreeViewEx.zip As always, comments, compliments and criticisms welcomed. M23
    1 point
  2. Example with xml dom: #include <Array.au3> $stbl='<table border="1">\n<caption>Recent Major Volcanic Eruptions in the Pacific Northwest\n</caption>\n<tr>\n<th>Volcano Name\n</th>\n<th>Location\n</th>\n<th>Last Major Eruption\n</th>\n<th>Type of Eruption\n' & _ '</th></tr>\n<tr>\n<td>Mt. Lassen\n</td>\n\n<td>California\n\n</td>\n<td>1914-17\n</td>\n<td>Explosive Eruption\n</td></tr>\n<tr>\n<td>Mt. Hood\n</td>\n<td>Oregon\n</td>\n<td>1790s\n</td>\n<td>Pyroclastic flows and Mudflows' & _ '</td></tr>\n<tr>\n<td>Mt. St. Helens\n</td>\n<td>Washington\n</td>\n<td>1980\n</td>\n<td>Explosive Eruption\n</td></tr></table>' $oXML = ObjCreate("Microsoft.XMLDOM") $oXML.loadxml($stbl) $oRows = $oXML.selectNodes("//tr") Local $a[$oRows.length][1] $i = 0 $j = 0 For $oRow In $oRows $oCells = $oRow.selectNodes("./td|./th") If UBound($a,2) < $oCells.Length Then ReDim $a[UBound($a)][$oCells.Length] For $oCell In $oCells $a[$i][$j] = $oCell.text $j+=1 Next $i+=1 $j=0 Next _ArrayDisplay($a) * note: it doesn't remove html encodings.
    1 point
  3. Here is an example of a regex, working with your code : #include <Array.au3> $stbl='<table border="1">\n<caption>Recent Major Volcanic Eruptions in the Pacific Northwest\n</caption>\n<tr>\n<th>Volcano Name\n</th>\n<th>Location\n</th>\n<th>Last Major Eruption\n</th>\n<th>Type of Eruption\n' & _ '</th></tr>\n<tr>\n<td>Mt. Lassen\n</td>\n\n<td>California\n\n</td>\n<td>1914-17\n</td>\n<td>Explosive Eruption\n</td></tr>\n<tr>\n<td>Mt. Hood\n</td>\n<td>Oregon\n</td>\n<td>1790s\n</td>\n<td>Pyroclastic flows and Mudflows' & _ '</td></tr>\n<tr>\n<td>Mt. St. Helens\n</td>\n<td>Washington\n</td>\n<td>1980\n</td>\n<td>Explosive Eruption\n</td></tr></table>' $aTest = StringRegExp($stbl, "(?s)<tr>.*?<td[^>]*>(.*?)(?:\\|</td>).*?<td.*?<td[^>]*>(.*?)(?:\\|</td>)", 3) If IsArray($aTest) Then Local $aResult[ UBound($aTest) / 2][2] For $i = 0 To UBound($aTest) - 1 Step 2 $aResult[$i / 2][0] = $aTest[$i] $aResult[$i / 2][1] = $aTest[$i + 1] Next _ArrayDisplay($aResult) EndIf
    1 point
  4. Here are two methods that appear to work. #include <IE.au3> #include <Array.au3> Local $sHTML = '<table border="1">\n<caption>Recent Major Volcanic Eruptions in the Pacific Northwest\n</caption>\n<tr>\n<th>Volcano Name\n</th>\n<th>Location\n</th>\n<th>Last Major Eruption\n</th>\n<th>Type of Eruption\n' & _ '</th></tr>\n<tr>\n<td>Mt. Lassen\n</td>\n\n<td>California\n\n</td>\n<td>1914-17\n</td>\n<td>Explosive Eruption\n</td></tr>\n<tr>\n<td>Mt. Hood\n</td>\n<td>Oregon\n</td>\n<td>1790s\n</td>\n<td>Pyroclastic flows and Mudflows' & _ '</td></tr>\n<tr>\n<td>Mt. St. Helens\n</td>\n<td>Washington\n</td>\n<td>1980\n</td>\n<td>Explosive Eruption\n</td></tr></table>' $sHTML = StringReplace($sHTML, "\n", "") ;ConsoleWrite($sHTML & @LF) ; ------- Using the _IE functions ------------------------------ Local $aArray = _IE_InnerhtmlTableToArray($sHTML) _ArrayDisplay($aArray) _ArrayDelete($aArray, "1;3") _ArrayTranspose($aArray) _ArrayDisplay($aArray) ;Or ; ---------------- RE Method --------------- Local $aArray1 = StringRegExp($sHTML, "<tr>(.+?)</tr>", 3) For $i = 0 To UBound($aArray1) - 1 $aTemp = StringRegExp($aArray1[$i], "<t.>(.+?)<", 3) If $i = 0 Then Local $aArray2[UBound($aArray)][UBound($aTemp)] For $j = 0 To UBound($aTemp) - 1 $aArray2[$i][$j] = $aTemp[$j] Next Next _ArrayDisplay($aArray2) _ArrayTranspose($aArray2) _ArrayDelete($aArray2, "1;3") _ArrayTranspose($aArray2) _ArrayDisplay($aArray2) ; From HTML source, "innerhtml", get the table into an array. Func _IE_InnerhtmlTableToArray($sSource) Local $oIE = _IECreate("about:blank", 0, 0) ; Hidden _IEPropertySet($oIE, "innerhtml", $sSource) Local $oTable = _IETableGetCollection($oIE, 0) Local $aTableData = _IETableWriteToArray($oTable) _IEQuit($oIE) Return $aTableData EndFunc ;==>_IE_InnerhtmlTableToArray
    1 point
  5. water

    If Excel window exists

    When you run _Excel_BookList you get a list of workbooks in all running Excel instances. Loop through the array and select the needed workbook, then use _Excel_BookAttach to connect to this workbooks and save/close them if needed.
    1 point
  6. Stilgar

    _POP3.au3 (V1.03)

    Here's an updated version of this: POP3-UDF (array.au3 are not used anymore, better return codes, new functions, optimized code, added comments) Many thanks to the original author Luc HENNINOT! _POP3.au3 Current functions: - _POP3Info (new) - _POP3Connect (new: with "automatic" mode - tries to find the pop3-server by your email adress) - _POP3Dele - _POP3Disconnect - _POP3List (new: returns an 2D-array) - _POP3Noop - _POP3Quit - _POP3Retr - _POP3Rset - _POP3Stat - _POP3MsgCnt (new) - _POP3Top - _POP3Uidl (new: returns an 2D-array) - __POP3Cmd (new internal function) Example: If _POP3Connect("AnnExampleUser@freenet.de", "0815") Then $a = _POP3Info() _ArrayDisplay($a) _POP3Quit() _POP3Disconnect() EndIf The UDF: _POP3.au3
    1 point
  7. SmOke_N

    _WinGetCtrlInfo()

    On a request from a user, and others I've seen lately, if you want to get the ClassNameNN or the Control ID of all the controls from a window... This should return them all in a 2 dimensional Array. Return: [N][0] = ClassNameNN [N][1] = Control ID of the same control Example: Global $Array = _WinGetCtrlInfo(WinGetTitle('')) Global $sOne = '[0][0] = ' & $Array[0][0] & @CR, $sTwo For $iCC = 1 To $Array[0][0] $sOne &= '[' & $iCC & '][0] = ' & $Array[$iCC][0] & @CR $sTwo &= '[' & $iCC & '][1] = ' & $Array[$iCC][1] & @CR Next MsgBox(64, 'WinInfo', StringTrimRight($sOne, 1) & @CR & StringTrimRight($sTwo, 1)) Func _WinGetCtrlInfo($hWin) If IsString($hWin) Then $hWin = WinGetHandle($hWin) Local $sClassList = WinGetClassList($hWin), $iAdd = 1, $aDLL, $sHold Local $aSplitClass = StringSplit(StringTrimRight($sClassList, 1), @LF), $aReturn[1][2] For $iCount = $aSplitClass[0] To 1 Step - 1 Local $nCount = 0 While 1 $nCount += 1 If ControlGetHandle($hWin, '', $aSplitClass[$iCount] & $nCount) = '' Then ExitLoop If Not StringInStr(Chr(1) & $sHold, Chr(1) & $aSplitClass[$iCount] & $nCount & Chr(1)) Then $sHold &= $aSplitClass[$iCount] & $nCount & Chr(1) $iAdd += 1 ReDim $aReturn[$iAdd][2] $aReturn[$iAdd - 1][0] = $aSplitClass[$iCount] & $nCount $aDLL = DllCall('User32.dll', 'int', 'GetDlgCtrlID', 'hwnd', _ ControlGetHandle($hWin, '', $aSplitClass[$iCount] & $nCount)) If @error = 0 Then $aReturn[$iAdd - 1][1] = $aDLL[0] Else $aReturn[$iAdd - 1][1] = '' EndIf EndIf WEnd Next $aReturn[0][0] = $iAdd - 1 Return $aReturn EndFunc
    1 point
×
×
  • Create New...