Leaderboard
Popular Content
Showing content with the highest reputation on 02/23/2015 in all areas
-
OMG, I had intended this to go until midnight in the UK. At least jaberwacky doesn't have to stay awake until an unearthly hour tonight. Before anyone cries foul, I added my entry to boost the choices, and as a participant I couldn't exert any influence over the competition's deadline once voting started. I believe that some valuable comments have been made here and I am grateful for all those who participated, but also a little sad that we didn't get more people voting. I liked all of the entries for one reason or another. The first one I ran was TheSaint's entry and I thought it was great. UEZ's ying yang was even more impressive, and although it is a fantastic example, I agree with other people's comments that it is ideally suited to more advanced audience. I think the best comment was made by mLipok: I was slightly embarrassed about the English word calculator and would like to thank JohnOne for his solution. I have learned a lot through this process myself and I hope to prove mLipok right. The first 24 hours was a bit nail-biting for me: when the standings were even. I think all the participants will agree with me when I say this was a tough endeavour: not so much in terms of coding but more in terms of reading other people's criticism. If I were able to cast a vote myself, I would have voted for TheSaint's entry. You have all been a great inspiration and thanks again to TheSaint for trying to drum up more enthusiasm from all the other forums. It resulted in a landslide. Thanks everyone. Edit: I think a small recess is in order before tackling the article. If anyone has any any further constructive comments to add, please don't keep them to yourself.4 points
-
When so many others try to dissuade you and yet you persist, hell that's the kind of stubbornness I can respect. If you must try and write an Antivirus in AutoIt dude just be careful the damned thing doesn't flag or try to delete itself.4 points
-
Ha ha, I had an idea it might have been czardas for that one. Congratulations czardas! Well done. I agree it is a goody! Commiserations to the other two. Great efforts guys. And thanks for making the attempts ... two each no less. Good on ya! No doubt, it was pretty clear all along, that 5 was mine. Did any of you notice that the comments had been mistakenly left off mine, and then re-instated upon my request, only to have them criticized ... imagine how I felt then. Did anyone notice mine was 33 lines, not 32? Not that the final Exit was needed. Let the discussions begin!3 points
-
Wiki Challenge Part 2
TheSaint and 2 others reacted to jaberwacky for a topic
Meh, I'm going to do it. Without furthur ado. Example 1: kylomas Example 2: UEZ Example 3: kylomas Example 4: UEZ Example 5: TheSaint Example 6: czardas -- AUTOIT CHAMPION!3 points -
This is for extraction of data from HTML tables to an array. It uses an raw html source file as input, and does not relies on any browser. You can get the source of the html using commands like InetGet(), InetRead(), _INetGetSource(), _IEDocReadHTML() for example, or load an html file from disc as well. It also takes care of the data position in the table due to rowspan and colspan trying to keep the same layout in the generated array. It has the option to fill the cells in the array corresponding with the "span" zones all with the same value of the first "span" cell of the corresponding area. ; save this as _HtmlTable2Array.au3 #include-once #include <array.au3> ; ; #FUNCTION# ==================================================================================================================== ; Name ..........: _HtmlTableGetList ; Description ...: Finds and enumerates all the html tables contained in an html listing (even if nested). ; if the optional parameter $i_index is passed, then only that table is returned ; Syntax ........: _HtmlTableGetList($sHtml[, $i_index = -1]) ; Parameters ....: $sHtml - A string value containing an html page listing ; $i_index - [optional] An integer value indicating the number of the table to be returned (1 based) ; with the default value of -1 an array with all found tables is returned ; Return values .: Success; Returns an 1D 1 based array containing all or single html table found in the html. ; element [0] (and @extended as well) contains the number of tables found (or 0 if no tables are returned) ; if an error occurs then an ampty string is returned and the following @error code is setted ; @error: 1 - no tables are present in the passed HTML ; 2 - error while parsing tables, (opening and closing tags are not balanced) ; 3 - error while parsing tables, (open/close mismatch error) ; 4 - invalid table index request (requested table nr. is out of boundaries) ; =============================================================================================================================== Func _HtmlTableGetList($sHtml, $i_index = -1) Local $aTables = _ParseTags($sHtml, "<table", "</table>") If @error Then Return SetError(@error, 0, "") ElseIf $i_index = -1 Then Return SetError(0, $aTables[0], $aTables) Else If $i_index > 0 And $i_index <= $aTables[0] Then Local $aTemp[2] = [1, $aTables[$i_index]] Return SetError(0, 1, $aTemp) Else Return SetError(4, 0, "") ; bad index EndIf EndIf EndFunc ;==>_HtmlTableGetList ; #FUNCTION# ==================================================================================================================== ; Name ..........: _HtmlTableWriteToArray ; Description ...: It writes values from an html table to a 2D array. It tries to take care of the rowspan and colspan formats ; Syntax ........: _HtmlTableWriteToArray($sHtmlTable[, $bFillSpan = False[, $iFilter = 0]]) ; Parameters ....: $sHtmlTable - A string value containing the html code of the table to be parsed ; $bFillSpan - [optional] Default is False. If span areas have to be filled by repeating the data ; contained in the first cell of the span area ; $iFilter - [optional] Default is 0 (no filters) data extracted from cells is returned unchanged. ; - 0 = no filter ; - 1 = removes non ascii characters ; - 2 = removes all double whitespaces ; - 4 = removes all double linefeeds ; - 8 = removes all html-tags ; - 16 = simple html-tag / entities convertor ; Return values .: Success: 2D array containing data from the html table ; Faillure: An empty strimg and sets @error as following: ; @error: 1 - no table content is present in the passed HTML ; 2 - error while parsing rows and/or columns, (opening and closing tags are not balanced) ; 3 - error while parsing rows and/or columns, (open/close mismatch error) ; =============================================================================================================================== Func _HtmlTableWriteToArray($sHtmlTable, $bFillSpan = False, $iFilter = 0) $sHtmlTable = StringReplace(StringReplace($sHtmlTable, "<th", "<td"), "</th>", "</td>") ; th becomes td ; rows of the wanted table Local $iError, $aTempEmptyRow[2] = [1, ""] Local $aRows = _ParseTags($sHtmlTable, "<tr", "</tr>") ; $aRows[0] = nr. of rows If @error Then Return SetError(@error, 0, "") Local $aCols[$aRows[0] + 1], $aTemp For $i = 1 To $aRows[0] $aTemp = _ParseTags($aRows[$i], "<td", "</td>") $iError = @error If $iError = 1 Then ; check if it's an empty row $aTemp = $aTempEmptyRow ; Empty Row Else If $iError Then Return SetError($iError, 0, "") EndIf If $aCols[0] < $aTemp[0] Then $aCols[0] = $aTemp[0] ; $aTemp[0] = max nr. of columns in table $aCols[$i] = $aTemp Next Local $aResult[$aRows[0]][$aCols[0]], $iStart, $iEnd, $aRowspan, $aColspan, $iSpanY, $iSpanX, $iSpanRow, $iSpanCol, $iMarkerCode, $sCellContent Local $aMirror = $aResult For $i = 1 To $aRows[0] ; scan all rows in this table $aTemp = $aCols[$i] ; <td ..> xx </td> ..... For $ii = 1 To $aTemp[0] ; scan all cells in this row $iSpanY = 0 $iSpanX = 0 $iY = $i - 1 ; zero base index for vertical ref $iX = $ii - 1 ; zero based indexes for horizontal ref ; following RegExp kindly provided by SadBunny in this post: ; http://www.autoitscript.com/forum/topic/167174-how-to-get-a-number-located-after-a-name-from-within-a-string/?p=1222781 $aRowspan = StringRegExp($aTemp[$ii], "(?i)rowspan\s*=\s*[""']?\s*(\d+)", 1) ; check presence of rowspan If IsArray($aRowspan) Then $iSpanY = $aRowspan[0] - 1 If $iSpanY + $iY > $aRows[0] Then $iSpanY -= $iSpanY + $iY - $aRows[0] + 1 EndIf EndIf ; $aColspan = StringRegExp($aTemp[$ii], "(?i)colspan\s*=\s*[""']?\s*(\d+)", 1) ; check presence of colspan If IsArray($aColspan) Then $iSpanX = $aColspan[0] - 1 ; $iMarkerCode += 1 ; code to mark this span area or single cell If $iSpanY Or $iSpanX Then $iX1 = $iX For $iSpY = 0 To $iSpanY For $iSpX = 0 To $iSpanX $iSpanRow = $iY + $iSpY If $iSpanRow > UBound($aMirror, 1) - 1 Then $iSpanRow = UBound($aMirror, 1) - 1 EndIf $iSpanCol = $iX1 + $iSpX If $iSpanCol > UBound($aMirror, 2) - 1 Then ReDim $aResult[$aRows[0]][UBound($aResult, 2) + 1] ReDim $aMirror[$aRows[0]][UBound($aMirror, 2) + 1] EndIf ; While $aMirror[$iSpanRow][$iX1 + $iSpX] ; search first free column $iX1 += 1 ; $iSpanCol += 1 If $iX1 + $iSpX > UBound($aMirror, 2) - 1 Then ReDim $aResult[$aRows[0]][UBound($aResult, 2) + 1] ReDim $aMirror[$aRows[0]][UBound($aMirror, 2) + 1] EndIf WEnd Next Next EndIf ; $iX1 = $iX ; following RegExp kindly provided by mikell in this post: ; http://www.autoitscript.com/forum/topic/167309-how-to-remove-from-a-string-all-between-and-pairs/?p=1224207 $sCellContent = StringRegExpReplace($aTemp[$ii], '<[^>]+>', "") If $iFilter Then $sCellContent = _HTML_Filter($sCellContent, $iFilter) For $iSpX = 0 To $iSpanX For $iSpY = 0 To $iSpanY $iSpanRow = $iY + $iSpY If $iSpanRow > UBound($aMirror, 1) - 1 Then $iSpanRow = UBound($aMirror, 1) - 1 EndIf While $aMirror[$iSpanRow][$iX1 + $iSpX] $iX1 += 1 If $iX1 + $iSpX > UBound($aMirror, 2) - 1 Then ReDim $aResult[$aRows[0]][$iX1 + $iSpX + 1] ReDim $aMirror[$aRows[0]][$iX1 + $iSpX + 1] EndIf WEnd $aMirror[$iSpanRow][$iX1 + $iSpX] = $iMarkerCode ; 1 If $bFillSpan Then $aResult[$iSpanRow][$iX1 + $iSpX] = $sCellContent Next $aResult[$iY][$iX1] = $sCellContent Next Next Next ; _ArrayDisplay($aMirror, "Debug") Return SetError(0, $aResult[0][0], $aResult) EndFunc ;==>_HtmlTableWriteToArray ; ; #FUNCTION# ==================================================================================================================== ; Name ..........: _HtmlTableGetWriteToArray ; Description ...: extract the html code of the required table from the html listing and copy the data of the table to a 2D array ; Syntax ........: _HtmlTableGetWriteToArray($sHtml[, $iWantedTable = 1[, $bFillSpan = False[, $iFilter = 0]]]) ; Parameters ....: $sHtml - A string value containing the html listing ; $iWantedTable - [optional] An integer value. The nr. of the table to be parsed (default is first table) ; $bFillSpan - [optional] Default is False. If all span areas have to be filled by repeating the data ; contained in the first cell of the span area ; $iFilter - [optional] Default is 0 (no filters) data extracted from cells is returned unchanged. ; - 0 = no filter ; - 1 = removes non ascii characters ; - 2 = removes all double whitespaces ; - 4 = removes all double linefeeds ; - 8 = removes all html-tags ; - 16 = simple html-tag / entities convertor ; Return values .: success: 2D array containing data from the wanted html table. ; faillure: An empty string and sets @error as following: ; @error: 1 - no tables are present in the passed HTML ; 2 - error while parsing tables, (opening and closing tags are not balanced) ; 3 - error while parsing tables, (open/close mismatch error) ; 4 - invalid table index request (requested table nr. is out of boundaries) ; =============================================================================================================================== Func _HtmlTableGetWriteToArray($sHtml, $iWantedTable = 1, $bFillSpan = False, $iFilter = 0) Local $aSingleTable = _HtmlTableGetList($sHtml, $iWantedTable) If @error Then Return SetError(@error, 0, "") Local $aTableData = _HtmlTableWriteToArray($aSingleTable[1], $bFillSpan, $iFilter) If @error Then Return SetError(@error, 0, "") Return SetError(0, $aTableData[0][0], $aTableData) EndFunc ;==>_HtmlTableGetWriteToArray ; #FUNCTION# ==================================================================================================================== ; Name ..........: _ParseTags ; Description ...: searches and extract all portions of html code within opening and closing tags inclusive. ; Returns an array containing a collection of <tag ...... </tag> lines. one in each element (even if are nested) ; Syntax ........: _ParseTags($sHtml, $sOpening, $sClosing) ; Parameters ....: $sHtml - A string value containing the html listing ; $sOpening - A string value indicating the opening tag ; $sClosing - A string value indicating the closing tag ; Return values .: success: an 1D 1 based array containing all the portions of html code representing the element ; element [0] af the array (and @extended as well) contains the counter of found elements ; faillure: An empty string and sets @error as following: ; @error: 1 - no tables are present in the passed HTML ; 2 - error while parsing tables, (opening and closing tags are not balanced) ; 3 - error while parsing tables, (open/close mismatch error) ; 4 - invalid table index request (requested table nr. is out of boundaries) ; =============================================================================================================================== Func _ParseTags($sHtml, $sOpening, $sClosing) ; example: $sOpening = '<table', $sClosing = '</table>' ; it finds how many of such tags are on the HTML page StringReplace($sHtml, $sOpening, $sOpening) ; in @xtended nr. of occurences Local $iNrOfThisTag = @extended ; I assume that opening <tag and closing </tag> tags are balanced (as should be) ; (so NO check is made to see if they are actually balanced) If $iNrOfThisTag Then ; if there is at least one of this tag ; $aThisTagsPositions array will contain the positions of the ; starting <tag and ending </tag> tags within the HTML Local $aThisTagsPositions[$iNrOfThisTag * 2 + 1][3] ; 1 based (make room for all open and close tags) ; 2) find in the HTML the positions of the $sOpening <tag and $sClosing </tag> tags For $i = 1 To $iNrOfThisTag $aThisTagsPositions[$i][0] = StringInStr($sHtml, $sOpening, 0, $i) ; start position of $i occurrence of <tag opening tag $aThisTagsPositions[$i][1] = $sOpening ; it marks which kind of tag is this $aThisTagsPositions[$i][2] = $i ; nr of this tag $aThisTagsPositions[$iNrOfThisTag + $i][0] = StringInStr($sHtml, $sClosing, 0, $i) + StringLen($sClosing) - 1 ; end position of $i^ occurrence of </tag> closing tag $aThisTagsPositions[$iNrOfThisTag + $i][1] = $sClosing ; it marks which kind of tag is this Next _ArraySort($aThisTagsPositions, 0, 1) ; now all opening and closing tags are in the same sequence as them appears in the HTML Local $aStack[UBound($aThisTagsPositions)][2] Local $aTags[Ceiling(UBound($aThisTagsPositions) / 2)] ; will contains the collection of <tag ..... </tag> from the html For $i = 1 To UBound($aThisTagsPositions) - 1 If $aThisTagsPositions[$i][1] = $sOpening Then ; opening <tag $aStack[0][0] += 1 ; nr of tags in html $aStack[$aStack[0][0]][0] = $sOpening $aStack[$aStack[0][0]][1] = $i ElseIf $aThisTagsPositions[$i][1] = $sClosing Then ; a closing </tag> was found If Not $aStack[0][0] Or Not ($aStack[$aStack[0][0]][0] = $sOpening And $aThisTagsPositions[$i][1] = $sClosing) Then Return SetError(3, 0, "") ; Open/Close mismatch error Else ; pair detected (the reciprocal tag) ; now get coordinates of the 2 tags ; 1) extract this tag <tag ..... </tag> from the html to the array $aTags[$aThisTagsPositions[$aStack[$aStack[0][0]][1]][2]] = StringMid($sHtml, $aThisTagsPositions[$aStack[$aStack[0][0]][1]][0], 1 + $aThisTagsPositions[$i][0] - $aThisTagsPositions[$aStack[$aStack[0][0]][1]][0]) ; 2) remove that tag <tag ..... </tag> from the html $sHtml = StringLeft($sHtml, $aThisTagsPositions[$aStack[$aStack[0][0]][1]][0] - 1) & StringMid($sHtml, $aThisTagsPositions[$i][0] + 1) ; 3) adjust the references to the new positions of remaining tags For $ii = $i To UBound($aThisTagsPositions) - 1 $aThisTagsPositions[$ii][0] -= StringLen($aTags[$aThisTagsPositions[$aStack[$aStack[0][0]][1]][2]]) Next $aStack[0][0] -= 1 ; nr of tags still in html EndIf EndIf Next If Not $aStack[0][0] Then ; all tags where parsed correctly $aTags[0] = $iNrOfThisTag Return SetError(0, $iNrOfThisTag, $aTags) ; OK Else Return SetError(2, 0, "") ; opening and closing tags are not balanced EndIf Else Return SetError(1, 0, "") ; there are no of such tags on this HTML page EndIf EndFunc ;==>_ParseTags ; #============================================================================= ; Name ..........: _HTML_Filter ; Description ...: Filter for strings ; AutoIt Version : V3.3.0.0 ; Syntax ........: _HTML_Filter(ByRef $sString[, $iMode = 0]) ; Parameter(s): .: $sString - String to filter ; $iMode - Optional: (Default = 0) : removes nothing ; - 0 = no filter ; - 1 = removes non ascii characters ; - 2 = removes all double whitespaces ; - 4 = removes all double linefeeds ; - 8 = removes all html-tags ; - 16 = simple html-tag / entities convertor ; Return Value ..: Success - Filterd String ; Failure - Input String ; Author(s) .....: Thorsten Willert, Stephen Podhajecki {gehossafats at netmdc. com} _ConvertEntities ; Date ..........: Wed Jan 27 20:49:59 CET 2010 ; modified ......: by Chimp Removed a double " " entities declaration, ; replace it with char(160) instead of chr(32), ; declaration of the $aEntities array as Static instead of just Local ; ============================================================================== Func _HTML_Filter(ByRef $sString, $iMode = 0) If $iMode = 0 Then Return $sString ;16 simple HTML tag / entities converter If $iMode >= 16 And $iMode < 32 Then Static Local $aEntities[95][2] = [[""", 34],["&", 38],["<", 60],[">", 62],[" ", 160] _ ,["¡", 161],["¢", 162],["£", 163],["¤", 164],["¥", 165],["¦", 166] _ ,["§", 167],["¨", 168],["©", 169],["ª", 170],["¬", 172],["­", 173] _ ,["®", 174],["¯", 175],["°", 176],["±", 177],["²", 178],["³", 179] _ ,["´", 180],["µ", 181],["¶", 182],["·", 183],["¸", 184],["¹", 185] _ ,["º", 186],["»", 187],["¼", 188],["½", 189],["¾", 190],["¿", 191] _ ,["À", 192],["Á", 193],["Ã", 195],["Ä", 196],["Å", 197],["Æ", 198] _ ,["Ç", 199],["È", 200],["É", 201],["Ê", 202],["Ì", 204],["Í", 205] _ ,["Î", 206],["Ï", 207],["Ð", 208],["Ñ", 209],["Ò", 210],["Ó", 211] _ ,["Ô", 212],["Õ", 213],["Ö", 214],["×", 215],["Ø", 216],["Ù", 217] _ ,["Ú", 218],["Û", 219],["Ü", 220],["Ý", 221],["Þ", 222],["ß", 223] _ ,["à", 224],["á", 225],["â", 226],["ã", 227],["ä", 228],["å", 229] _ ,["æ", 230],["ç", 231],["è", 232],["é", 233],["ê", 234],["ë", 235] _ ,["ì", 236],["í", 237],["î", 238],["ï", 239],["ð", 240],["ñ", 241] _ ,["ò", 242],["ó", 243],["ô", 244],["õ", 245],["ö", 246],["÷", 247] _ ,["ø", 248],["ù", 249],["ú", 250],["û", 251],["ü", 252],["þ", 254]] $sString = StringRegExpReplace($sString, '(?i)<p.*?>', @CRLF & @CRLF) $sString = StringRegExpReplace($sString, '(?i)<br>', @CRLF) Local $iE = UBound($aEntities) - 1 For $x = 0 To $iE $sString = StringReplace($sString, $aEntities[$x][0], Chr($aEntities[$x][1]), 0, 2) Next For $x = 32 To 255 $sString = StringReplace($sString, "&#" & $x & ";", Chr($x)) Next $iMode -= 16 EndIf ;8 Tag filter If $iMode >= 8 And $iMode < 16 Then ;$sString = StringRegExpReplace($sString, '<script.*?>.*?</script>', "") $sString = StringRegExpReplace($sString, "<[^>]*>", "") $iMode -= 8 EndIf ; 4 remove all double cr, lf If $iMode >= 4 And $iMode < 8 Then $sString = StringRegExpReplace($sString, "([ \t]*[\n\r]+[ \t]*)", @CRLF) $sString = StringRegExpReplace($sString, "[\n\r]+", @CRLF) $iMode -= 4 EndIf ; 2 remove all double withespaces If $iMode = 2 Or $iMode = 3 Then $sString = StringRegExpReplace($sString, "[[:blank:]]+", " ") $sString = StringRegExpReplace($sString, "\n[[:blank:]]+", @CRLF) $sString = StringRegExpReplace($sString, "[[:blank:]]+\n", "") $iMode -= 2 EndIf ; 1 remove all non ASCII (remove all chars with ascii code > 127) If $iMode = 1 Then $sString = StringRegExpReplace($sString, "[^\x00-\x7F]", " ") EndIf Return $sString EndFunc ;==>_HTML_Filter This simple demo allow to test those functions, showing what it can extract from the html tables in a web page of your choice or loading the html file from the disc. ; #include <_HtmlTable2Array.au3> ; <--- udf already included (hard coded) at bottom of this demo #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #include <File.au3> ; needed for _FileWriteFromArray() #include <array.au3> #include <IE.au3> Local $oIE1 = _IECreateEmbedded(), $oIE2 = _IECreateEmbedded(), $iFilter = 0 Local $sHtml_File, $iIndex, $aTable, $aMyArray, $sFilePath GUICreate("Html tables to array demo", 1000, 450, (@DesktopWidth - 1000) / 2, (@DesktopHeight - 450) / 2 _ , $WS_OVERLAPPEDWINDOW + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN) GUICtrlCreateObj($oIE1, 010, 10, 480, 360) ; left browser GUICtrlCreateTab(500, 10, 480, 360) GUICtrlCreateTabItem("view table") GUICtrlCreateObj($oIE2, 502, 33, 474, 335) ; right browser GUICtrlCreateTabItem("view html") Local $idLabel_HtmlTable = GUICtrlCreateInput("", 502, 33, 474, 335, $ES_MULTILINE + $ES_AUTOVSCROLL) GUICtrlSetFont(-1, 10, 0, 0, "Courier new") GUICtrlCreateTabItem("") Local $idInputUrl = GUICtrlCreateInput("", 10, 380, 440, 20) Local $idButton_Go = GUICtrlCreateButton("Go", 455, 380, 25, 20) Local $idButton_Load = GUICtrlCreateButton("Load html from disk", 10, 410, 480, 30) Local $idButton_Prev = GUICtrlCreateButton("Prev <-", 510, 375, 50, 30) Local $idLabel_NunTable = GUICtrlCreateLabel("00 / 00", 570, 375, 40, 30) GUICtrlSetFont(-1, 9, 700) Local $idButton_Next = GUICtrlCreateButton("Next ->", 620, 375, 50, 30) GUICtrlCreateGroup("Fill Span", 680, 370, 80, 40) Local $iFillSpan = GUICtrlCreateCheckbox("", 715, 388, 15, 15) GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group Local $idButton_Array0 = GUICtrlCreateButton("Preview array", 770, 375, 100, 30) Local $idButton_Array1 = GUICtrlCreateButton("Write array to file", 880, 375, 100, 30) ; options for filtering GUICtrlCreateGroup("Filters", 510, 410, 470, 35) Local $iFilter01 = GUICtrlCreateCheckbox("non ascii", 520, 425, 85, 15) Local $iFilter02 = GUICtrlCreateCheckbox("double spaces", 610, 425, 85, 15) Local $iFilter04 = GUICtrlCreateCheckbox("double @LF", 700, 425, 85, 15) Local $iFilter08 = GUICtrlCreateCheckbox("html-tags", 790, 425, 85, 15) Local $iFilter16 = GUICtrlCreateCheckbox("tags to entities", 880, 425, 85, 15) GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group GUISetState(@SW_SHOW) ;Show GUI ; _IEDocWriteHTML($oIE2, "<HTML></HTML>") GUICtrlSetData($idInputUrl, "http://www.danshort.com/HTMLentities/") ; GUICtrlSetData($idInputUrl, "http://www.mojotoad.com/sisk/projects/HTML-TableExtract/tables.html") ; example page ControlClick("", "", $idButton_Go) ; _IEAction($oIE1, "stop") Do; Waiting for user to close the window $iMsg = GUIGetMsg() Select Case $iMsg = $idButton_Go _IENavigate($oIE1, GUICtrlRead($idInputUrl)) ; _IEAction($oIE1, "stop") $aTables = _HtmlTableGetList(_IEBodyReadHTML($oIE1)) If Not @error Then ; _ArrayDisplay($aTables, "Tables contained in this html") $iIndex = 1 _IEBodyWriteHTML($oIE2, "<html>" & $aTables[$iIndex] & "</html>") ControlClick("", "", $idButton_Prev) _IEAction($oIE2, "stop") Else MsgBox(0, 0, "@error " & @error) EndIf Case $iMsg = $idButton_Load ConsoleWrite("$idButton_Load" & @CRLF) $sHtml_File = FileOpenDialog("Choose an html file", @ScriptDir & "\", "html page (*.htm;*.html)") If Not @error Then GUICtrlSetData($idInputUrl, $sHtml_File) ControlClick("", "", $idButton_Go) EndIf Case $iMsg = $idButton_Next If IsArray($aTables) Then $iIndex += $iIndex < $aTables[0] GUICtrlSetData($idLabel_NunTable, "Table" & @CRLF & $iIndex & " / " & $aTables[0]) GUICtrlSetData($idLabel_HtmlTable, $aTables[$iIndex]) _IEBodyWriteHTML($oIE2, "<html>" & $aTables[$iIndex] & "</html>") _IEAction($oIE2, "stop") EndIf Case $iMsg = $idButton_Prev If IsArray($aTables) Then $iIndex -= $iIndex > 1 GUICtrlSetData($idLabel_NunTable, "Table" & @CRLF & $iIndex & " / " & $aTables[0]) GUICtrlSetData($idLabel_HtmlTable, $aTables[$iIndex]) _IEBodyWriteHTML($oIE2, "<html>" & $aTables[$iIndex] & "</html>") _IEAction($oIE2, "stop") EndIf Case $iMsg = $idButton_Array0 ; Preview Array If IsArray($aTables) Then $iFilter = 1 * _IsChecked($iFilter01) + 2 * _IsChecked($iFilter02) + 4 * _IsChecked($iFilter04) + 8 * _IsChecked($iFilter08) + 16 * _IsChecked($iFilter16) $aMyArray = _HtmlTableWriteToArray($aTables[$iIndex], _IsChecked($iFillSpan), $iFilter) If Not @error Then _ArrayDisplay($aMyArray) EndIf Case $iMsg = $idButton_Array1 ; Saves the array in a csv file of your choice If IsArray($aTables) Then $iFilter = 1 * _IsChecked($iFilter01) + 2 * _IsChecked($iFilter02) + 4 * _IsChecked($iFilter04) + 8 * _IsChecked($iFilter08) + 16 * _IsChecked($iFilter16) $aMyArray = _HtmlTableWriteToArray($aTables[$iIndex], _IsChecked($iFillSpan), $iFilter) If Not @error Then $sFilePath = FileSaveDialog("Choose a file to save to", @ScriptDir, "(*.csv)") If $sFilePath <> "" Then If Not _FileWriteFromArray($sFilePath, $aMyArray, 0, Default, ",") Then MsgBox(0, "Error on file write", "Error code is " & @error & @CRLF & @CRLF & "@error meaning:" & @CRLF & _ "1 - Error opening specified file" & @CRLF & _ "2 - $aArray is not an array" & @CRLF & _ "3 - Error writing to file" & @CRLF & _ "4 - $aArray is not a 1D or 2D array" & @CRLF & _ "5 - Start index is greater than the $iUbound parameter") EndIf EndIf EndIf EndIf EndSelect Until $iMsg = $GUI_EVENT_CLOSE GUIDelete() ; returns 1 if CheckBox is checked Func _IsChecked($idControlID) ; $GUI_CHECKED = 1 Return GUICtrlRead($idControlID) = $GUI_CHECKED EndFunc ;==>_IsChecked ; ------------------------------------------------------------------------ ; Following code should be included by the #include <_HtmlTable2Array.au3> ; hard coded here for easy load an run to try the example ; ------------------------------------------------------------------------ #include-once #include <array.au3> ; ; #FUNCTION# ==================================================================================================================== ; Name ..........: _HtmlTableGetList ; Description ...: Finds and enumerates all the html tables contained in an html listing (even if nested). ; if the optional parameter $i_index is passed, then only that table is returned ; Syntax ........: _HtmlTableGetList($sHtml[, $i_index = -1]) ; Parameters ....: $sHtml - A string value containing an html page listing ; $i_index - [optional] An integer value indicating the number of the table to be returned (1 based) ; with the default value of -1 an array with all found tables is returned ; Return values .: Success; Returns an 1D 1 based array containing all or single html table found in the html. ; element [0] (and @extended as well) contains the number of tables found (or 0 if no tables are returned) ; if an error occurs then an ampty string is returned and the following @error code is setted ; @error: 1 - no tables are present in the passed HTML ; 2 - error while parsing tables, (opening and closing tags are not balanced) ; 3 - error while parsing tables, (open/close mismatch error) ; 4 - invalid table index request (requested table nr. is out of boundaries) ; =============================================================================================================================== Func _HtmlTableGetList($sHtml, $i_index = -1) Local $aTables = _ParseTags($sHtml, "<table", "</table>") If @error Then Return SetError(@error, 0, "") ElseIf $i_index = -1 Then Return SetError(0, $aTables[0], $aTables) Else If $i_index > 0 And $i_index <= $aTables[0] Then Local $aTemp[2] = [1, $aTables[$i_index]] Return SetError(0, 1, $aTemp) Else Return SetError(4, 0, "") ; bad index EndIf EndIf EndFunc ;==>_HtmlTableGetList ; #FUNCTION# ==================================================================================================================== ; Name ..........: _HtmlTableWriteToArray ; Description ...: It writes values from an html table to a 2D array. It tries to take care of the rowspan and colspan formats ; Syntax ........: _HtmlTableWriteToArray($sHtmlTable[, $bFillSpan = False[, $iFilter = 0]]) ; Parameters ....: $sHtmlTable - A string value containing the html code of the table to be parsed ; $bFillSpan - [optional] Default is False. If span areas have to be filled by repeating the data ; contained in the first cell of the span area ; $iFilter - [optional] Default is 0 (no filters) data extracted from cells is returned unchanged. ; - 0 = no filter ; - 1 = removes non ascii characters ; - 2 = removes all double whitespaces ; - 4 = removes all double linefeeds ; - 8 = removes all html-tags ; - 16 = simple html-tag / entities convertor ; Return values .: Success: 2D array containing data from the html table ; Faillure: An empty strimg and sets @error as following: ; @error: 1 - no table content is present in the passed HTML ; 2 - error while parsing rows and/or columns, (opening and closing tags are not balanced) ; 3 - error while parsing rows and/or columns, (open/close mismatch error) ; =============================================================================================================================== Func _HtmlTableWriteToArray($sHtmlTable, $bFillSpan = False, $iFilter = 0) $sHtmlTable = StringReplace(StringReplace($sHtmlTable, "<th", "<td"), "</th>", "</td>") ; th becomes td ; rows of the wanted table Local $iError, $aTempEmptyRow[2] = [1, ""] Local $aRows = _ParseTags($sHtmlTable, "<tr", "</tr>") ; $aRows[0] = nr. of rows If @error Then Return SetError(@error, 0, "") Local $aCols[$aRows[0] + 1], $aTemp For $i = 1 To $aRows[0] $aTemp = _ParseTags($aRows[$i], "<td", "</td>") $iError = @error If $iError = 1 Then ; check if it's an empty row $aTemp = $aTempEmptyRow ; Empty Row Else If $iError Then Return SetError($iError, 0, "") EndIf If $aCols[0] < $aTemp[0] Then $aCols[0] = $aTemp[0] ; $aTemp[0] = max nr. of columns in table $aCols[$i] = $aTemp Next Local $aResult[$aRows[0]][$aCols[0]], $iStart, $iEnd, $aRowspan, $aColspan, $iSpanY, $iSpanX, $iSpanRow, $iSpanCol, $iMarkerCode, $sCellContent Local $aMirror = $aResult For $i = 1 To $aRows[0] ; scan all rows in this table $aTemp = $aCols[$i] ; <td ..> xx </td> ..... For $ii = 1 To $aTemp[0] ; scan all cells in this row $iSpanY = 0 $iSpanX = 0 $iY = $i - 1 ; zero base index for vertical ref $iX = $ii - 1 ; zero based indexes for horizontal ref ; following RegExp kindly provided by SadBunny in this post: ; http://www.autoitscript.com/forum/topic/167174-how-to-get-a-number-located-after-a-name-from-within-a-string/?p=1222781 $aRowspan = StringRegExp($aTemp[$ii], "(?i)rowspan\s*=\s*[""']?\s*(\d+)", 1) ; check presence of rowspan If IsArray($aRowspan) Then $iSpanY = $aRowspan[0] - 1 If $iSpanY + $iY > $aRows[0] Then $iSpanY -= $iSpanY + $iY - $aRows[0] + 1 EndIf EndIf ; $aColspan = StringRegExp($aTemp[$ii], "(?i)colspan\s*=\s*[""']?\s*(\d+)", 1) ; check presence of colspan If IsArray($aColspan) Then $iSpanX = $aColspan[0] - 1 ; $iMarkerCode += 1 ; code to mark this span area or single cell If $iSpanY Or $iSpanX Then $iX1 = $iX For $iSpY = 0 To $iSpanY For $iSpX = 0 To $iSpanX $iSpanRow = $iY + $iSpY If $iSpanRow > UBound($aMirror, 1) - 1 Then $iSpanRow = UBound($aMirror, 1) - 1 EndIf $iSpanCol = $iX1 + $iSpX If $iSpanCol > UBound($aMirror, 2) - 1 Then ReDim $aResult[$aRows[0]][UBound($aResult, 2) + 1] ReDim $aMirror[$aRows[0]][UBound($aMirror, 2) + 1] EndIf ; While $aMirror[$iSpanRow][$iX1 + $iSpX] ; search first free column $iX1 += 1 ; $iSpanCol += 1 If $iX1 + $iSpX > UBound($aMirror, 2) - 1 Then ReDim $aResult[$aRows[0]][UBound($aResult, 2) + 1] ReDim $aMirror[$aRows[0]][UBound($aMirror, 2) + 1] EndIf WEnd Next Next EndIf ; $iX1 = $iX ; following RegExp kindly provided by mikell in this post: ; http://www.autoitscript.com/forum/topic/167309-how-to-remove-from-a-string-all-between-and-pairs/?p=1224207 $sCellContent = StringRegExpReplace($aTemp[$ii], '<[^>]+>', "") If $iFilter Then $sCellContent = _HTML_Filter($sCellContent, $iFilter) For $iSpX = 0 To $iSpanX For $iSpY = 0 To $iSpanY $iSpanRow = $iY + $iSpY If $iSpanRow > UBound($aMirror, 1) - 1 Then $iSpanRow = UBound($aMirror, 1) - 1 EndIf While $aMirror[$iSpanRow][$iX1 + $iSpX] $iX1 += 1 If $iX1 + $iSpX > UBound($aMirror, 2) - 1 Then ReDim $aResult[$aRows[0]][$iX1 + $iSpX + 1] ReDim $aMirror[$aRows[0]][$iX1 + $iSpX + 1] EndIf WEnd $aMirror[$iSpanRow][$iX1 + $iSpX] = $iMarkerCode ; 1 If $bFillSpan Then $aResult[$iSpanRow][$iX1 + $iSpX] = $sCellContent Next $aResult[$iY][$iX1] = $sCellContent Next Next Next ; _ArrayDisplay($aMirror, "Debug") Return SetError(0, $aResult[0][0], $aResult) EndFunc ;==>_HtmlTableWriteToArray ; ; #FUNCTION# ==================================================================================================================== ; Name ..........: _HtmlTableGetWriteToArray ; Description ...: extract the html code of the required table from the html listing and copy the data of the table to a 2D array ; Syntax ........: _HtmlTableGetWriteToArray($sHtml[, $iWantedTable = 1[, $bFillSpan = False[, $iFilter = 0]]]) ; Parameters ....: $sHtml - A string value containing the html listing ; $iWantedTable - [optional] An integer value. The nr. of the table to be parsed (default is first table) ; $bFillSpan - [optional] Default is False. If all span areas have to be filled by repeating the data ; contained in the first cell of the span area ; $iFilter - [optional] Default is 0 (no filters) data extracted from cells is returned unchanged. ; - 0 = no filter ; - 1 = removes non ascii characters ; - 2 = removes all double whitespaces ; - 4 = removes all double linefeeds ; - 8 = removes all html-tags ; - 16 = simple html-tag / entities convertor ; Return values .: success: 2D array containing data from the wanted html table. ; faillure: An empty string and sets @error as following: ; @error: 1 - no tables are present in the passed HTML ; 2 - error while parsing tables, (opening and closing tags are not balanced) ; 3 - error while parsing tables, (open/close mismatch error) ; 4 - invalid table index request (requested table nr. is out of boundaries) ; =============================================================================================================================== Func _HtmlTableGetWriteToArray($sHtml, $iWantedTable = 1, $bFillSpan = False, $iFilter = 0) Local $aSingleTable = _HtmlTableGetList($sHtml, $iWantedTable) If @error Then Return SetError(@error, 0, "") Local $aTableData = _HtmlTableWriteToArray($aSingleTable[1], $bFillSpan, $iFilter) If @error Then Return SetError(@error, 0, "") Return SetError(0, $aTableData[0][0], $aTableData) EndFunc ;==>_HtmlTableGetWriteToArray ; #FUNCTION# ==================================================================================================================== ; Name ..........: _ParseTags ; Description ...: searches and extract all portions of html code within opening and closing tags inclusive. ; Returns an array containing a collection of <tag ...... </tag> lines. one in each element (even if are nested) ; Syntax ........: _ParseTags($sHtml, $sOpening, $sClosing) ; Parameters ....: $sHtml - A string value containing the html listing ; $sOpening - A string value indicating the opening tag ; $sClosing - A string value indicating the closing tag ; Return values .: success: an 1D 1 based array containing all the portions of html code representing the element ; element [0] af the array (and @extended as well) contains the counter of found elements ; faillure: An empty string and sets @error as following: ; @error: 1 - no tables are present in the passed HTML ; 2 - error while parsing tables, (opening and closing tags are not balanced) ; 3 - error while parsing tables, (open/close mismatch error) ; 4 - invalid table index request (requested table nr. is out of boundaries) ; =============================================================================================================================== Func _ParseTags($sHtml, $sOpening, $sClosing) ; example: $sOpening = '<table', $sClosing = '</table>' ; it finds how many of such tags are on the HTML page StringReplace($sHtml, $sOpening, $sOpening) ; in @xtended nr. of occurences Local $iNrOfThisTag = @extended ; I assume that opening <tag and closing </tag> tags are balanced (as should be) ; (so NO check is made to see if they are actually balanced) If $iNrOfThisTag Then ; if there is at least one of this tag ; $aThisTagsPositions array will contain the positions of the ; starting <tag and ending </tag> tags within the HTML Local $aThisTagsPositions[$iNrOfThisTag * 2 + 1][3] ; 1 based (make room for all open and close tags) ; 2) find in the HTML the positions of the $sOpening <tag and $sClosing </tag> tags For $i = 1 To $iNrOfThisTag $aThisTagsPositions[$i][0] = StringInStr($sHtml, $sOpening, 0, $i) ; start position of $i occurrence of <tag opening tag $aThisTagsPositions[$i][1] = $sOpening ; it marks which kind of tag is this $aThisTagsPositions[$i][2] = $i ; nr of this tag $aThisTagsPositions[$iNrOfThisTag + $i][0] = StringInStr($sHtml, $sClosing, 0, $i) + StringLen($sClosing) - 1 ; end position of $i^ occurrence of </tag> closing tag $aThisTagsPositions[$iNrOfThisTag + $i][1] = $sClosing ; it marks which kind of tag is this Next _ArraySort($aThisTagsPositions, 0, 1) ; now all opening and closing tags are in the same sequence as them appears in the HTML Local $aStack[UBound($aThisTagsPositions)][2] Local $aTags[Ceiling(UBound($aThisTagsPositions) / 2)] ; will contains the collection of <tag ..... </tag> from the html For $i = 1 To UBound($aThisTagsPositions) - 1 If $aThisTagsPositions[$i][1] = $sOpening Then ; opening <tag $aStack[0][0] += 1 ; nr of tags in html $aStack[$aStack[0][0]][0] = $sOpening $aStack[$aStack[0][0]][1] = $i ElseIf $aThisTagsPositions[$i][1] = $sClosing Then ; a closing </tag> was found If Not $aStack[0][0] Or Not ($aStack[$aStack[0][0]][0] = $sOpening And $aThisTagsPositions[$i][1] = $sClosing) Then Return SetError(3, 0, "") ; Open/Close mismatch error Else ; pair detected (the reciprocal tag) ; now get coordinates of the 2 tags ; 1) extract this tag <tag ..... </tag> from the html to the array $aTags[$aThisTagsPositions[$aStack[$aStack[0][0]][1]][2]] = StringMid($sHtml, $aThisTagsPositions[$aStack[$aStack[0][0]][1]][0], 1 + $aThisTagsPositions[$i][0] - $aThisTagsPositions[$aStack[$aStack[0][0]][1]][0]) ; 2) remove that tag <tag ..... </tag> from the html $sHtml = StringLeft($sHtml, $aThisTagsPositions[$aStack[$aStack[0][0]][1]][0] - 1) & StringMid($sHtml, $aThisTagsPositions[$i][0] + 1) ; 3) adjust the references to the new positions of remaining tags For $ii = $i To UBound($aThisTagsPositions) - 1 $aThisTagsPositions[$ii][0] -= StringLen($aTags[$aThisTagsPositions[$aStack[$aStack[0][0]][1]][2]]) Next $aStack[0][0] -= 1 ; nr of tags still in html EndIf EndIf Next If Not $aStack[0][0] Then ; all tags where parsed correctly $aTags[0] = $iNrOfThisTag Return SetError(0, $iNrOfThisTag, $aTags) ; OK Else Return SetError(2, 0, "") ; opening and closing tags are not balanced EndIf Else Return SetError(1, 0, "") ; there are no of such tags on this HTML page EndIf EndFunc ;==>_ParseTags ; #============================================================================= ; Name ..........: _HTML_Filter ; Description ...: Filter for strings ; AutoIt Version : V3.3.0.0 ; Syntax ........: _HTML_Filter(ByRef $sString[, $iMode = 0]) ; Parameter(s): .: $sString - String to filter ; $iMode - Optional: (Default = 0) : removes nothing ; - 0 = no filter ; - 1 = removes non ascii characters ; - 2 = removes all double whitespaces ; - 4 = removes all double linefeeds ; - 8 = removes all html-tags ; - 16 = simple html-tag / entities convertor ; Return Value ..: Success - Filterd String ; Failure - Input String ; Author(s) .....: Thorsten Willert, Stephen Podhajecki {gehossafats at netmdc. com} _ConvertEntities ; Date ..........: Wed Jan 27 20:49:59 CET 2010 ; modified ......: by Chimp Removed a double " " entities declaration, ; replace it with char(160) instead of chr(32), ; declaration of the $aEntities array as Static instead of just Local ; ============================================================================== Func _HTML_Filter(ByRef $sString, $iMode = 0) If $iMode = 0 Then Return $sString ;16 simple HTML tag / entities converter If $iMode >= 16 And $iMode < 32 Then Static Local $aEntities[95][2] = [[""", 34],["&", 38],["<", 60],[">", 62],[" ", 160] _ ,["¡", 161],["¢", 162],["£", 163],["¤", 164],["¥", 165],["¦", 166] _ ,["§", 167],["¨", 168],["©", 169],["ª", 170],["¬", 172],["­", 173] _ ,["®", 174],["¯", 175],["°", 176],["±", 177],["²", 178],["³", 179] _ ,["´", 180],["µ", 181],["¶", 182],["·", 183],["¸", 184],["¹", 185] _ ,["º", 186],["»", 187],["¼", 188],["½", 189],["¾", 190],["¿", 191] _ ,["À", 192],["Á", 193],["Ã", 195],["Ä", 196],["Å", 197],["Æ", 198] _ ,["Ç", 199],["È", 200],["É", 201],["Ê", 202],["Ì", 204],["Í", 205] _ ,["Î", 206],["Ï", 207],["Ð", 208],["Ñ", 209],["Ò", 210],["Ó", 211] _ ,["Ô", 212],["Õ", 213],["Ö", 214],["×", 215],["Ø", 216],["Ù", 217] _ ,["Ú", 218],["Û", 219],["Ü", 220],["Ý", 221],["Þ", 222],["ß", 223] _ ,["à", 224],["á", 225],["â", 226],["ã", 227],["ä", 228],["å", 229] _ ,["æ", 230],["ç", 231],["è", 232],["é", 233],["ê", 234],["ë", 235] _ ,["ì", 236],["í", 237],["î", 238],["ï", 239],["ð", 240],["ñ", 241] _ ,["ò", 242],["ó", 243],["ô", 244],["õ", 245],["ö", 246],["÷", 247] _ ,["ø", 248],["ù", 249],["ú", 250],["û", 251],["ü", 252],["þ", 254]] $sString = StringRegExpReplace($sString, '(?i)<p.*?>', @CRLF & @CRLF) $sString = StringRegExpReplace($sString, '(?i)<br>', @CRLF) Local $iE = UBound($aEntities) - 1 For $x = 0 To $iE $sString = StringReplace($sString, $aEntities[$x][0], Chr($aEntities[$x][1]), 0, 2) Next For $x = 32 To 255 $sString = StringReplace($sString, "&#" & $x & ";", Chr($x)) Next $iMode -= 16 EndIf ;8 Tag filter If $iMode >= 8 And $iMode < 16 Then ;$sString = StringRegExpReplace($sString, '<script.*?>.*?</script>', "") $sString = StringRegExpReplace($sString, "<[^>]*>", "") $iMode -= 8 EndIf ; 4 remove all double cr, lf If $iMode >= 4 And $iMode < 8 Then $sString = StringRegExpReplace($sString, "([ \t]*[\n\r]+[ \t]*)", @CRLF) $sString = StringRegExpReplace($sString, "[\n\r]+", @CRLF) $iMode -= 4 EndIf ; 2 remove all double withespaces If $iMode = 2 Or $iMode = 3 Then $sString = StringRegExpReplace($sString, "[[:blank:]]+", " ") $sString = StringRegExpReplace($sString, "\n[[:blank:]]+", @CRLF) $sString = StringRegExpReplace($sString, "[[:blank:]]+\n", "") $iMode -= 2 EndIf ; 1 remove all non ASCII (remove all chars with ascii code > 127) If $iMode = 1 Then $sString = StringRegExpReplace($sString, "[^\x00-\x7F]", " ") EndIf Return $sString EndFunc ;==>_HTML_Filter Any error reports or suggestions for enhancements are welcome2 points
-
MyIncludes.au3 file might look like this Func _MyAddFunc($n1, $n2) Return $n1 + $n2 EndFunc MyScript.au3 file might look like this #include "MyIncludes.au3" $value = _MyAddFunc(12, 43) MsgBox(0, "Result", $value)2 points
-
As for the low turnout: I think it helped a little bit entries in the signature, the members of this forum. That's good advice on the future. edit: btw. you should change your signature as I do2 points
-
AutoIt should be the ultimate winner. Thanks. Edit I forgot to say thanks jaberwacky - you played a very important role and did a great job.2 points
-
Then I wouldn't do anything with GDI+ Congrats czardas. I should have leave the rotation from Yin Yang out - it made it a little bit more looking complicated... Br, UEZ2 points
-
Game Intro - Effects, Animation, Title Menu
argumentum and one other reacted to minxomat for a topic
I made this a while ago for a game I was going to make. I don't see the game happening any time soon, so i might as well just share what I have done. The way animations are displayed in this is quite different, as each sprite is contained within a main TTF font. It also shows how to time Control-Based animations and how to rotate them. Advantages of font-based animations: Only one file for all animationsSprites can be scaled to any size as they are vector data (like SVGs)Sprites can be displayed in any color (or angle)The antialiasing can be varied very easily...You have to install all fonts to view this intro. Here, have a screenshot of the end: Download: Game Intro.zip2 points -
Hi! Today I want to show you my current AutoIt project: The ISN AutoIt Studio. The ISN AutoIt Studio is a complete IDE made with AutoIt, for AutoIt! It includes a GUI designer, a code editor (with syntax highlighting, auto complete & intelisense), a file viewer, a backup system, trophies and a lot more features!! Here are some screenshots: Here some higlights: -> easy to create/manage/public your AutoIt-projects! ->integrated GUI-Editor (ISN Form Studio 2) ->integrated - file & projectmanager ->auto backupfunction for your Projects ->extendable with plugins! ->available in several languages ->trophies ->Syntax highlighting /Autocomplete / Intelisense ->Dynamic Script ->detailed overview of the project (total working hours, total size...) And much more!!! -> -> Click here to download ISN AutoIt Studio <- <- Here is the link to the german autoit forum where I posted ISN AutoIt Studio the first time: http://autoit.de/index.php?page=Thread&threadID=29742&pageNo=1 For more information visit my Homepage: https://www.isnetwork.at So….have fun with ISN AutoIt Studio! PS: Sorry for my bad English! ^^1 point
-
You should read and download Navigating in an image before you read and download this example. The first example shows how to navigate in an image, and the zipfile contains the test images. The first example contains an illustration of the GUI. The example The picture to the left shows a triangular selection. It's shown with a zoom factor of 24. Each 24x24 square equals a single pixel in the source image. The oblique lines in the triangle cut across the 24x24 squares. But a selection in the source image can only include entire pixels. The horizontal/vertical polygon in the middle picture contains pixels that are completely inside the triangle. Pixels at borders are not included. The horz/vert polygon on the right is just outside the triangle, and contains pixels at the borders. In this example you can draw a closed polygon with the mouse. The horz/vert polygon that follows the pixel edges along the oblique polygon lines are calculated, and pixels are selected. The horz/vert polygon can be calculated inside or outside the oblique polygon. The example is not limited to triangles. You can create a selection like this with 15 line segments: Program modes In Navigating in an image there is only one mode: View mode. To create a non-rectangular selection you have to switch to Polygon selection mode. Click button 3 below to switch mode. This will add a new Polygon selection toolbar. Click button 3 again to leave Polygon selection mode. A click in the title bar, the menu bar, a tab item, buttons in toolbar not related to Polygon selection, the free area of the toolbar or the status bar will also leave Polygon selection mode. Toolbar buttons The left group is the Copy/paste toolbar. A click on a button in Polygon selection mode will switch to View mode. 1) Copy selected pixels2) Paste as new imageThe middle group is the Select toolbar. The buttons are available both in View mode and in Polygon selection mode.3) Polygon selection4) Center selection5) Remove selection6) Selection colorsThe last group is the Polygon selection toolbar. This toolbar is only visible when button 3 is pressed.7) New polygon8) Recent polygons9) Polygons on opposite side of support lines10) Redraw polygons (after error or debug)11) Undo last support polygon action12) Redo last support polygon actionYou can right (secondary) click button 1, 6 and 8. Note that all toolbar buttons are provided with tooltips. In addition to colors that can be set with button 6, you can set colors for frame and grid. Right click the tab item to set all colors at once, that best fits bright and dark images. By default colors are set to fit a bright image. More details Draw a polygon To create a non-rectangular selection you just have to draw a non-rectangular polygon with the mouse. Nomenclature: The oblique polygon you draw with the mouse is called the support polygon. The polygons which follows the pixel edges along each oblique support line are called horizontal/vertical or horz/vert polygons. In the first illustration above you see a support polygon in the left picture, and a support polygon plus three horz/vert polygons in the two other pictures. A support polygon is drawn as a sequence of line segments. End point of previous line must be start point of next line. The polygon is finished, when end point of last line is equal to start point of first line. 1) First line segmentClick a start point with primary mouse button, drag line to an end point, release mouse button. 2) Next line segmentClick end point of previous line, drag line with mouse to end point of next line. Repeat this step as many times as needed. 3) Last line segmentClick end point of previous line, drag line with mouse to start point of first line. This illustration shows how to create a triangular selection. First line segment Zoom in to a sufficiently high level with the mouse wheelClick Polygon selection button to switch to Polygon selection modeClick New polygon button to create a new polygonCreate the first oblique support line with the mouseClick possibly "Polygons on opposite side of support lines" button to calculate and draw the horz/vert polygon on opposite side of the support lineThe default action when you drag with the mouse is to move the image. A click at the New polygon button disables the default action for the next drag operation, and you can create the first line segment. For the following line segments you have to start the dragging at an end line marker. Dragging outside an end line marker will move the image. Next line segment Move the mouse pointer over the marker at the end of the first line segmentThe pointer will change to a cross cursorCreate the next oblique support lineLast line segmentMove the pointer over one of the markers at the end of the two line segmentsThe pointer will change to a cross cursorCreate the last oblique support lineForce empty line after listMouse actions In Polygon selection mode you can still zoom in/out with the mouse wheel, drag/move the image, and click a point to zoom around this point. This is described in Navigating in an image. You can create a support polygon as explained above. In addition to these actions you can adjust line end points and corner points, move the entire support polygon, and delete a support line. To see which actions you can do, just hover the mouse pointer over a line marker, and you'll get information in a tooltip. Over a line marker the pointer will change to a cross cursor. When you click Polygon selection button, tooltips will be shown for the first few support lines. To adjust an end point of a support line or a corner point between two support lines press the Shift button, move the mouse pointer over the marker, click and drag the point. To move the entire polygon position the mouse pointer over a middle marker, click and drag the polygon. Note that this will move the polygon relative to the source image. If you have zoomed in to a factor 24 as in the image above, the polygon will be moved in steps af 24 pixels in the picture control. To delete a support line position the mouse pointer over a middle marker, right (secondary) click and click "Delete line segment" in the context menu. Only end lines can be deleted. For a finished polygon any line can be deleted, but as soon as one line is deleted, only end lines can be deleted. Keyboard actions You can use Page Up/Page Down to zoom in/out, arrow keys to move the image a pixel at a time, and Shift plus arrow keys to move the image a page at a time. Line validations If you are creating a selection as shown to the left, and have added line 0, 1 and 2 and are going to add line 3, it can happen that line 3 gets too close to line 0. This is an error, and you'll get a visual feedback as shown to the right. The end point of the line must not be inside the red region, and the line must not cross the red region. To get rid of the red lines/circles just recreate line 3 and make it a little shorter, or click Redraw polygons button. Several validations are performed on line segments in this order: 1) Line segments must not be too short2) Line segments must not be horizontal or vertical3) Angles between neighbor lines must not be too small or too large4) Start or end point of a new line must not be too close to neigbor segments5) Start and end point of a line must not be too close to other segments (the illustration above)To create selections with horizontal/vertical lines that doesn't violate point 2, you can do something like this: Array limits Array limits are not validated in this version. The limits are: Line segments in a support polygon: 25Points in a horizontal/vertical polygon along a support line: 2000Points in the final polygon (drawn with _GDIPlus_GraphicsDrawPolygon): 10000Force empty line after listDebug menu Right (secondary) click a middle marker to access the Debug menu. The illustration shows some of the features of the Debug menu. Picture 1 is a simple quadrilateral (polygon with four sides) with four horz/vert polygons inside the support polygon. Right (secondary) click the middle marker below the number and select Debug polygons | Draw this/next polygon | Entire polygons. The result is shown in picture 2. The horz/vert polygon for the current support line is blue, and the horz/vert polygon for the next support line is red. The picture shows the intersection point between the horz/vert polygons. In picture 3 (Debug polygons | Draw this/next polygon | Adjusted polygons) the part of the horz/vert polygons on the wrong side of the intersection point is cut off, and the adjusted polygons are shown. Picture 4 (Debug polygons | Show selected pixels) shows the selected pixels with a horizontal black line. View mode When you switch to View mode (click Polygon selection button or View mode button (arrow icon)), the separate horz/vert polygons along each of the oblique support lines are put together into one big closed polygon (which can be drawn with _GDIPlus_GraphicsDrawPolygon). The selected pixels are calculated from this final polygon, when you click the Copy button. Note that the middle markers are still visible, and you can drag/move the polygon around in the image. In this way you can copy/paste several different regions with the same polygon. Copy/paste Click Copy button to create a copy of the selected pixels on a white background. In the context menu for the Copy button, you can choose a red, green or blue background color. Click Paste button to paste selected pixels as a new image. The new image appears in a new tab item. In this version you can only paste the selected pixels as a new image. More details If you are interested, you can find more information about calculations and code for the following topics in posts below (I'll add the information in the course of a week, when I get my notes organized a little better.): Overview of the program progress in a flow chartHorizontal/vertical polygons along support linesCalculations related to zoom in/out issuesFinal polygon and selected pixelsForce empty line after listThis version This version is a test version to find out whether it's possible to carry out non-rectangular selections. Only functionality required for the test is coded. If you run the example in Scite, you can see a few warnings and error messages in the console. The code is not cleaned up according to double defined local variables or unused parameters in function calls (primary functions to handle windows messages). This means a lot of warnings if you run Au3Check. Zipfile The top level is the folder "Image Editor". It contains one subfolder: "2) Non-rectangular selections". The subfolder contains source and resource files. Most important source files are: Selections.au3 - run this scriptincludestoolsSelectPolygon.au3 - executes the message loop which runs when the program is in Polygon selection mode. The message loop handles drawing of the oblique support lines and responds to button clicks. In bottom of the file you find the function to draw the final polygon in View mode.includestoolsSelectPolygonFunctions1.au3 - utility functions. Functions to zoom in/out, to create the final polygon, and to extract the selected pixels.includestoolsSelectPolygonFunctions2.au3 - all functions to calculate, adjust and draw the horizontal/vertical polygons along the oblique support lines.includestoolsSelectPolygonValidations.au3 - functions to validate the oblique support lines.includestoolsSelectPolygonDebug.au3 - functions for the Debug menu.Tested with AutoIt 3.3.10 on Windows 7 32/64 bit and Windows XP 32 bit. Selections.7z This update fixes an issue. More information here. Selections2.7z1 point
-
Here is an English version. Local $Date = '16-Mar-2010 22:14:00' Local $Date2 = Execute(StringRegExpReplace($Date, "(?i)^(\d{2})-([A-Z]{3})-(\d{4})\h(\d{2}):(\d{2}):(\d{2})$", _ "'$3' & StringRight('0' & UBound(StringRegExp('$2', '(Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec)|', 3)) - 1, 2) & '$1$4$5$6'")) ConsoleWrite($Date2 & @LF) ; Returns 201003162214001 point
-
Never had a problem with XLS files. XLS files are in a binary format whereas XLSX files are ZIP-compressed XML files. I suggest to use XLS.1 point
-
You mean the ; character or #cs and #ce as describeded here?1 point
-
Success...!! this is my include file Func Alert($msg) Local $title = StringSplit(@ScriptName,".") MsgBox(0,$title[1],$msg) EndFunc And this is my script file... #include <Alert.au3> Alert("Hello World!") It works.. Thank you all...1 point
-
Also, have a look at the Keyword Reference section of the Help file, under #Include etc.1 point
-
kcvinu, Wrong - read the tutorial to which water and I linked above. M231 point
-
@JohnOne - An excellent example and right to the point. I don't recall ever having made my own Include file, though I've always known how, and included plenty by other people. I probably should have a standard Include of my own, as many of my programs use a lot of the same functions, and so it would save me plenty of copy and paste. It's on the todo list ... you know ... the one that keeps falling down the back of the sofa.1 point
-
Maybe I'm missing something? I've always just used the handle straight up. #include <GUIConstantsEx.au3> #include <Array.au3> #include <WinAPI.au3> $hGUI = GUICreate("Test", 500, 500) $cButton = GUICtrlCreateButton("Test", 10, 10, 80, 30) $hHandle = GUICtrlGetHandle($cButton) ; Get control handle GUISetState() ; Using ControlID $aControlGetPos1 = ControlGetPos($hGUI, "", $cButton) _ArrayDisplay($aControlGetPos1, "ControlID", Default, 8) ; Using handle $aControlGetPos2 = ControlGetPos("", "", $hHandle) _ArrayDisplay($aControlGetPos2, "Handle1", Default, 8) $aControlGetPos3 = ControlGetPos($hHandle, "", "") _ArrayDisplay($aControlGetPos3, "Handle2", Default, 8) $aControlGetPos4 = ControlGetPos($hGUI, "", $hHandle) _ArrayDisplay($aControlGetPos4, "Handle3", Default, 8) .1 point
-
You can either copy and paste the function from AutomatingWindowsExplorer.au3 to your new script. Or you can create a new au3 file (example: SharedFunctions.au3) and include this file in both of your scripts using a #include statement. That's a function of the SciTE editor. IIRC there is a wiki entry how to incorporate your own UDF into scite with highlighting and syntax tooltips.1 point
-
JohnOne, Trying to deal with date formats (particularly ones with letter months/days) is very difficult and I am not sure you can do it in a single RegEx - cue for someone to prove me wrong! I had to write quite a complex UDF to do it - look in my sig for Date_Time_Convert: #include "DTC.au3" $sDate = '21/09/2009 21:35' $sRet = _Date_Time_Convert($sDate, "dd/MM/yyyy HH:mm", "yyyyMMddHHmm") ConsoleWrite($sRet & @CRLF) $sDate = '16-Mar-2010 22:14:00' $sRet = _Date_Time_Convert($sDate, "dd-MMM-yyyy HH:mm:ss", "yyyyMMddHHmm") ConsoleWrite($sRet & @CRLF) M231 point
-
http://www.binaryconvert.com/result_double.html?hexadecimal=00000000000000FF1 point
-
how i can use call like this
SecuirtyZone reacted to TheSaint for a topic
It seems to me you are incorrectly trying to use the Call function? What you probably need, is something like. MyCallFunc("fileinstall", "program.exe", @tempdir, "/", run) Func MyCallFunc($aaaaa, $bbbbb, $ccccc, $ddddd, $bbbbb) ; your commands go here ; especially where you join by assignment - $path = $ccccc & $ddddd & $bbbbb EndFunc Note though, that "/" should probably be "" and run won't work. run should probably be $run and be assigned a value previously (i.e. $run = 1) Then you use it in your function, by having something like - If $run = 1 Then Run($path) So in essence you would have - $run = 1 MyCallFunc("fileinstall", "program.exe", @tempdir, "\", $run) Not sure why you need to single out "" or "/" as being separate in the manner you do?1 point -
_WinAPI_LockWindowUpdate wants the handle from GuiCreate not the control1 point
-
I didn't know it would be a leap year calculation at first. I just thought to myself, what number can I type into the calculator that would be easy to read and understand. That's when I came up with the idea of using a macro. Only then did I ask myself what can I do with it? That's when I figured that a leap year is something that everyone can relate to.1 point
-
Then up to now, the simplest and fastest is. Locking the GUI in tandem with using _GUICtrlListView_BeginUpdate and _GUICtrlListView_EndUpdate. Func PopulateLV() Local $hTimer = TimerInit() _GUICtrlListView_BeginUpdate ($hLV) GUISetState(@SW_LOCK) For $i = 0 To 1000 GUICtrlCreateListViewItem($sLVI, $hLV) Next GUISetState(@SW_UNLOCK) _GUICtrlListView_EndUpdate( $hLV) MsgBox(0, "Time Difference", TimerDiff($hTimer) / 1000) EndFunc ;==>PopulateLV EDIT: Adding the update function halves the timer at least.1 point
-
Well, said, and I also guessed UEZ must have done one, though not which. Never guessed kylomas did though. Would have been fun, if we had added a Guess Who vote or bet ... though my style was probably a dead giveaway ... despite using uncommon declarations (for me). You made me chuckle a little with your last paragraph from >Post #60, when I first saw it. P.S. I was going to vote for yours if I could have (after seeing BrewManNH vote), and that's when I re-read the first post, just to make sure it was allowed. P.S.S. Sad I didn't get even one vote .... oh well, like I said to jaberwacky when I provided it, I thought it was the complex side of simple. Yours nailed it I thought, having that catchy little Leap Year element. I tried to do the same with my loop for doing each character, but really I tried to put too much into my example.1 point
-
Fukki, ProcessSetPriority might be what you are looking for. M231 point
-
GuiBuilderNxt - Reboot [08/18/2016]
Trong reacted to jaberwacky for a topic
Oh yes, I ignore those because I like declaring consts within if and switch cases. AutoIt3 doesn't complain but Au3Check does. Edit: Actually, I did miss two of those. Thanks for pointing that out.1 point -
Playing around with these various functions (for a while) will clear up most of the confusion you are experiencing - I'm sure.1 point
-
First I nested these particular expressions in parentheses and it didn't work. I then thought it would be more consistant to create them as separate groups and it worked. However, you are right to point out that it is needless bloat. Thanks! Func _StringIsNumber($sString) Return StringRegExp($sString, "(?i)\A(\-?\d+(\.\d+)?(e[\+\-]\d{1,3})?|0x[A-F\d]{1,16})\z") = 1 EndFunc1 point
-
Why did you wrap A and z in a capturing group?1 point
-
Here's a function I wrote a while ago. Maybe it can be useful. ; Local $aNumber[7] = ["12","5.6","7e-7","0xF","1.4e+130","0x12345677890ABC","1+1"] For $i = 0 To 6 ConsoleWrite(_StringIsNumber($aNumber[$i]) & @LF) Next ; #FUNCTION# ==================================================================================================================== ; Name...........: _StringIsNumber ; Description ...: Checks whether a string is a number as recognised by the AutoIt interpreter ; Syntax.........: _StringIsNumber($sString [, $bVulgarFrac]) ; Parameters ....: $sString - The string to test ; $bVulgarFrac - [Optional] if set to True, vulgar fractions will also return True ; Return values .: True or False ; Author ........: czardas ; Remarks .......: Returns True for integers, floats, hexadecimal and scientific notation. ; Related .......: StringIsDigit, StringIsFloat, StringIsInt, StringIsXDigit ; Link ..........: ; Example .......: MsgBox(0, "1.2e-300 is a number", _StringIsNumber("1.2e-300")) ; =============================================================================================================================== Func _StringIsNumber($sString, $bVulgarFrac = False) Local $bReturn = False If StringIsInt($sString) Or StringIsFloat($sString) Then $bReturn = True ; string is integer or float ElseIf StringRegExp($sString, "(?i)(\A[\+\-]?0x[A-F\d]+\z)") Then $bReturn = True ; string is hexadecimal integer ElseIf StringRegExp($sString, "(?i)(\A[\+\-]?\d*\.?\d+e[\+\-]?\d+\z)") Then $bReturn = True ; exponential (or scientific notation) ElseIf $bVulgarFrac And StringRegExp($sString, "(\A[\+\-]?\d+/\d+\z)") Then $bReturn = True ; string is a vulgar fraction EndIf Return $bReturn EndFunc ; _StringIsNumber1 point
-
Run this... Local $aStr = "123" ConsoleWrite("Is" & VarGetType($aStr) & " variable type." & @CRLF) ConsoleWrite( (stringisdigit($aStr) ? 'Yes, it is a digit' : 'No, it is Klingon') & @CRLF)1 point
-
Check out VarGetType in the Help file... edit: additional info If your value is in quotes it is a string. There are a number of StringIs* functions to detect what the string might be representing. See the Help file. When you do Number($var) then the result is always a number... There is a very specific set of rules for how different data representations are treatred, again, see the Help file.1 point
-
FileSelectFolder - Help file $Cmdline is an array that you get automatically when a script starts...from the Help file1 point
-
The run times between _WinAPI_LockWindowUpdate anf GuiSetState ar almost identical...I just chose the simplest way that I knew to prevent re-painting...1 point
-
J1, No flicker and 1000 loaded in .05 sec... #include <ListViewConstants.au3> #include <GuiListView.au3> #include <WindowsConstants.au3> #include <WinAPIGdi.au3> #include <GuiTab.au3> $sLVI = "one|two|three|four" Global $Gui = GUICreate("GUI", 600, 600, 100, 100) $button = GUICtrlCreateButton("go", 560, 20) Global $hTab = GUICtrlCreateTab(0, 0, 500, 500) Global $idTab1 = GUICtrlCreateTabItem("Tab 1") Global $hLV = GUICtrlCreateListView($sLVI, 0, 20, 500, 500) _GUICtrlListView_SetExtendedListViewStyle($hLV, BitOR($LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER)) Global $idTab2 = GUICtrlCreateTabItem("Tab 2") GUICtrlCreateTabItem("") GUISetState() While 3 Switch GUIGetMsg() Case -3 Exit Case $button PopulateLV() EndSwitch WEnd Func PopulateLV() Local $hTimer = TimerInit() GUISetState(@SW_LOCK) For $i = 0 To 1000 GUICtrlCreateListViewItem($sLVI, $hLV) Next GUISetState(@SW_UNLOCK) _GUICtrlTab_ClickTab($hTab, 0) MsgBox(0, "Time Difference", TimerDiff($hTimer) / 1000) EndFunc ;==>PopulateLV1 point
-
Func PopulateLV() _WinAPI_LockWindowUpdate($Gui) For $i = 0 To 300 GUICtrlCreateListViewItem($sLVI, $hLV) Next _WinAPI_LockWindowUpdate(Null) _WinAPI_InvalidateRect($Gui) _WinAPI_UpdateWindow($Gui) EndFunc ;==>PopulateLV1 point
-
New thread started >here.1 point
-
@kcvinu - I would add to what the others wrote, by advising caution when working with the registry ... you should always backup keys and sections before making changes, especially when new to it. Like SmOke_N I was also looking for some functions I wrote a while back, that add or remove entries for the three main things. [1] Folder - folders and zip files. [2] Directory - Folders. [3] * - Files My functions were also designed to work with shortcuts/command-line so that one could include them as part of an uninstall routine.1 point
-
I wrote code to do this ... trying to remember where ... I believe it was in a thread by guiness but didn't really adapt to what he was trying to accomplish. I'm only giving the above clues in case I can't find it and someone feels like spending a day or two looking for it ... Edit: Found the thread, but it's not exactly what I wrote the code for: Thread: '?do=embed' frameborder='0' data-embedContent>> My Code: page-2#entry1042451'>page-2#entry1042451 Mine opens the explorer with the files you want before hand selected, not what you're currently selecting, however that seems quite fairly easy, maybe follow through and see how it's being done in the code above.1 point
-
Ok you can try this small example I did it on XP so it may be a little different on an other OS Registry key to add : [HKEY_CLASSES_ROOT\Directory\shell\my_script\command] @="C:\\my_script.exe \"%1\"" Use the code below to make a compiled script named "my_script.exe" and put this exe in C: #include <GUIConstantsEx.au3> GuiCreate("", 500, 30, -1, 30) GuiCtrlCreateInput($CmdLine[1], 10, 5, 480, 20) GuisetState() While GuiGetMsg() <> $GUI_EVENT_CLOSE Sleep(10) Wend1 point
-
Select a specific radio button, quick exit
Tripredacus reacted to kylomas for a topic
BlackFlag, I cannot get it to fail either. After looking at your code I made some changes... 1 - got rid of intermediate variables 2 - added header formatting from radio button text (the only reason I could see for the vars you were setting) 3 - added a limit to edit control (100000 characters) 4 - changed "exit" to "exitloop" 5 - added a display of the file 6 - changed the filename See the comments in code.... #include <Constants.au3> #include <GUIConstants.au3> #include <File.au3> #include <Array.au3> #include <Date.au3> $Work = GUICreate("Work Journal", 623, 330, 192, 114) $Edit1 = GUICtrlCreateEdit("", 8, 16, 505, 265) GUICtrlSetLimit(-1, 100000) ; set limit to 100000 characters $Save = GUICtrlCreateButton("Save", 8, 288, 73, 25) $Label1 = GUICtrlCreateLabel("Tags", 536, 24, 43, 24) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") $Vessel = GUICtrlCreateRadio("Vessel Issue", 528, 56, 81, 25) $Bad = GUICtrlCreateRadio("Bad News", 528, 88, 89, 25) $WhattheHell = GUICtrlCreateRadio("Dev Issue", 528, 120, 89, 25) $Watch = GUICtrlCreateRadio("Watching", 528, 152, 89, 25) GUISetState(@SW_SHOW) $TheJournal = FileOpen(@ScriptDir & "\WorkNotes.txt", 1) Local $hdr, $msg ; <---- added to get text of radio button and format output header While 1 ; set $msg to control actioned so that it can be used in a GuiCtrlRead later $msg = GUIGetMsg() Switch $msg ; sets text of radio button clicked Case $Vessel, $Bad, $WhattheHell, $Watch $hdr = GUICtrlRead($msg, 1) ; The ", 1" gets the text of the control (advanced mode) Case $Save ;$TextInfo = GUICtrlRead($Edit1) ; no need for an intermediate var ;$Today = _NowDate() ; no need for an intermediate var FileWrite($TheJournal, "--------------------------------- " & $hdr & " -------------------------------" & @CRLF) FileWrite($TheJournal, _NowDate() & @CRLF & @CRLF) FileWrite($TheJournal, GUICtrlRead($Edit1) & @CRLF) ExitLoop ; exit loop will also exit the script if nothing follows the loop / for testing I want to see the file EndSwitch WEnd ShellExecute(@ScriptDir & "\WorkNotes.txt") ; display the file using the default windows handler for ".txt" kylomas1 point -
Game Intro - Effects, Animation, Title Menu
argumentum reacted to UEZ for a topic
I don't want to install any font. But I was curious about what you did so I added following lines to avoid font installing: #include <WinAPIGdi.au3> _WinAPI_AddFontResourceEx('..\Black-and-Knight.ttf', $FR_PRIVATE) _WinAPI_AddFontResourceEx('..\ChaosandPain-CnP.ttf', $FR_PRIVATE) _WinAPI_AddFontResourceEx('..\TheDeadAreComing.ttf', $FR_PRIVATE) _WinAPI_AddFontResourceEx('..\vtks encount(e)r.ttf', $FR_PRIVATE) Nice looking intro. Br, UEZ1 point -
Yeah, the change is intentional. Jon had a post about that some time ago giving explanation and basically redefining the word "stupid". However, I hope people that influence Jon these days will be smart, and more importantly eloquent, enough to make him reconsider the decision. I also hope for peace in the world. How big are chances for that?1 point
-
I'm finding users adjusting the default screen DPI setting far more often in Windows 7 than I ever experienced with Windows XP. Perhaps the setting is now more prominently displayed or easily found than when is was in the advanced section of the settings tab of the display options window. Most commercial applications seem to adapt to the DPI value without a glitch, but Autoit only partially conforms to this system-wide setting. The fonts within controls are affected, yet the overall control dimensions are not. The result are labels, buttons, etc, with txt that is truncated or unreadable. Some special controls or API functions in Autoit, like calendar, are also affected by the DPI setting. I've overridden non-default DPI settings by calling this at the top of programs: Func GetDPI_Ratio() Local $hWnd = 0 Local $hDC = DllCall("user32.dll", "long", "GetDC", "long", $hWnd) Local $aRet = DllCall("gdi32.dll", "long", "GetDeviceCaps", "long", $hDC[0], "long", 90) $hDC = DllCall("user32.dll", "long", "ReleaseDC", "long", $hWnd, "long", $hDC) If $aRet[0] = 0 Then $aRet[0] = 96 Return $aRet[0] / 96 EndFunc It returns an $iDPI_Ratio global such as 1 or 1.25. I then replace all calls to GUISetFont() and GUICtrlSetFont() with calls to user functions like GUISetFont_DPI() and GUICtrlSetFont_DPI() which apply the $iDPI_Ratio variable as a divisor to the font size parameter like this: Func GUISetFont_DPI($isize, $iweight = "", $iattribute = "", $sfontname = "") GUISetFont($isize / $iDPI_Ratio, $iweight, $iattribute, $sfontname) EndFunc I'm still left with a few uncorrected issues like calendar controls. I considered a bugtracker to request an extra parm for GUISetFont() and GUICtrlSetFont(), that would act as a DPI divisor and default to 1. That would greatly simplify programatically suppressing a non-standard DPI setting. Then I wonder if perhaps the goal should be to move in the opposite direction... that of making Autoit fully DPI-aware? It appears the available values for the DPI setting are: .75 1.00 (default) 1.25 1.50 2.001 point
-
Command Line Compile - Determine Failure?
argumentum reacted to water for a topic
Use parameter /ErrorStdOut when running your exe and pipe the output to a file.1 point -
Malwarebytes actively believes AutoIt is malware
EmilyLove reacted to Emiel Wieldraaijer for a topic
hahahaha 'Malwarebytes' i thought is was Malware.. pfff .. don't use malwarebytes anymore.. problem solved1 point