Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/25/2016 in all areas

  1. Another thing: FileRead(@ScriptFullPath), "//", 1) FileRead() only accept 2 arguments from the Help File: FileRead ( "filehandle/filename" [, count] ) You are passing 3 arguments here. Regards Alien.
    1 point
  2. @ScriptFullPath Refer to the Full path of the running script, so this: $StrSplit = StringSplit(FileRead(@ScriptFullPath), "//", 1) Is searching on \file.exe and not in \newfile.exe Regards Alien.
    1 point
  3. Local $aRecordsetAsArray = _ADO_Execute($oConnection, $sQUERY1, True) _ADO_Recordset_Display($aRecordsetAsArray) Local $aRecordsetContent = _ADO_RecordsetArray_GetContent($aRecordsetAsArray) For $iRecord_idx = 0 To UBound($aRecordsetContent) - 1 .... .... .... .... Next or like you say from example: RecordsetToConsole ; Executing some query Local $oRecordset = _ADO_Execute($oConnection, $sQUERY) ; Get recordset to array of arrays (Conent and ColumnNames) Local $aRecordsetAsArray = _ADO_Recordset_ToArray($oRecordset, False) ; Get inner array - only conent of Recordset Local $aRecordsetContent = _ADO_RecordsetArray_GetContent($aRecordsetAsArray) ; Go through the array variable (Recorset Conent) Local $iColumn_count = UBound($aRecordsetContent, $UBOUND_COLUMNS) For $iRecord_idx = 0 To UBound($aRecordsetContent) - 1 .... .... .... Next
    1 point
  4. The definition of word is pretty fuzzy and mostly context-dependant. For instance would you consider COP21 as one word (granted it's an acronym) or only COP? Nonetheless PCRE with UCP opens some possibilities ... and some pitfalls. The last "word" in the first returned array doesn't dissociate joined words from distinct scripts, but looking for "letter words" in specific scripts does: Local $sString = ' 師_green|house,деления<<<Δελτα___ՅԴգէկՔիթטאףצװהםлениΔελτα' Local $aWords = StringRegExp($sString, '(*UCP)(?<!\pL)\pL+', 3) _ArrayDisplay($aWords, "Words") $aWords = StringRegExp($sString, '(*UCP)(?<!\p{Armenian})\p{Armenian}+', 3) _ArrayDisplay($aWords, "Armenian") $aWords = StringRegExp($sString, '(*UCP)(?<!\p{Hebrew})\p{Hebrew}+', 3) _ArrayDisplay($aWords, "Hebrew") $aWords = StringRegExp($sString, '(*UCP)(?<!\p{Latin})\p{Latin}+', 3) _ArrayDisplay($aWords, "Common latin") $aWords = StringRegExp($sString, '(*UCP)(?<!\p{Han})\p{Han}+', 3) _ArrayDisplay($aWords, "Chinese") $aWords = StringRegExp($sString, '(*UCP)(?<!\p{Cyrillic})\p{Cyrillic}+', 3) _ArrayDisplay($aWords, "Cyrillic") $aWords = StringRegExp($sString, '(*UCP)(?<!\p{Greek})\p{Greek}+', 3) _ArrayDisplay($aWords, "Greek") Even in UCP mode, \b may not be what you want. Try to replace (?<!\p{Armenian}) by \b for an easy example. Also consider that many scripts have dedicated Unicode symbols for decimal digits. Thus \p{Devanagari}+ for instance will match both Devanagari letters and digits. Disclaimer: don't expect real words here, I just concatenated random letters from some scripts I can't read. So if something here reads as a horrible offence to you, persuade yourself it's God's hand drawing a smilley for you.
    1 point
  5. RTFC

    3D Bar Graph

    @The_Key_Maker: replace $ghGDIPDll with $__g_hGDIPDll, for example by adding below your #includes: Global $ghGDIPDll=$g__h_GDIPDll For line graphs, see for example here.
    1 point
  6. Hi @czardas My code is really bad and it does not work properly but my point is with StringInStr() you will find where is the substring no matter what delimiter is there and base on that you could extract that word. Regards Alien.
    1 point
  7. Please note that if the delimiter is a "|" in the file, there is maybe a simpler way #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <File.au3> #include <Array.au3> #include <GuiListView.au3> ; Create file $sFileName = "Data.txt" FileDelete($sFileName) $sString = "Checked|Column 1|Column 2|Column 3|Column 4|Column 5|Column 6|Column 7|Column 8" & @CRLF & _ "×|50.01.0001|160404134631346000|Other value|T3|alphachymotrypsin|Other value|C|alpha choay 4000IU" & @CRLF & _ "×|50.01.0003|160407154252435000|Other value|T2|Paracetamol|Other value|C|Acepron 250mg" & @CRLF & _ "|50.01.0005|160415135700860000|Other value|T3|Acenocoumarol|Other value|D|Acenocumarol WPW 4mg" & @CRLF & _ "|50.01.0006|160423064434487000|Other value|T3|Acetylcystein|Other value|D|Aceblue 100mg" & @CRLF & _ "×|50.01.0007|160430993168114000|Other value|T1|Acetylcystein|Other value|C|Aceblue 200mg" FileWrite($sFileName, $sString) ;============================================ ; Create array 1D $aData = StringRegExp(FileRead($sFileName), '\N+', 3) ; delete cols 3-6 and set order 0-1-2-7-4-5-8 For $i = 0 To UBound($aData)-1 $aData[$i] = StringRegExpReplace($aData[$i], '(?x)((?:.*?\|){3}) (.*?\|) ((?:.*?\|){2}) (.*?\|) (.*?\|) (.*)', "$1$5$3$6") Next ;_ArrayDisplay($aData) $column_titles = $aData[0] _ArrayDelete($aData, 0) ;============================================ ; Create GUI $hGUI = GUICreate("Test", 800, 500) ; Create controls GUICtrlCreateLabel("Find:", 10, 30, 100, 20) $cInput = GUICtrlCreateInput("", 120, 30, 300, 20) $cSave = GUICtrlCreateButton("Save Check", 480, 10, 80, 20) $cFind = GUICtrlCreateButton("Find", 480, 30, 80, 20) ; $cFind8Only = GUICtrlCreateCheckbox(" Column 8 only", 600, 30, 200, 20) $cReset = GUICtrlCreateButton("Reset", 680, 70, 80, 20) ; Create ListView $cListView = GUICtrlCreateListView($column_titles, 10, 100, 780, 300) _GUICtrlListView_SetExtendedListViewStyle($cListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_CHECKBOXES)) For $i = 1 to _GUICtrlListView_GetColumnCount($cListView) - 1 _GUICtrlListView_SetColumnWidth ($cListView, $i, 110) Next ; Create items _ResetListview() GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cFind $search = GuiCtrlRead($cInput) If $search = "" Then ContinueLoop $aResults = _ArrayFindAll ($aData, $search, 0, 0, 0, 1) If UBound($aResults) = 0 Then Msgbox(0,"", "no results found") ContinueLoop EndIf ; _ArrayDisplay($aResults) _GUICtrlListView_DeleteAllItems($cListView) For $i = 0 To UBound($aResults)-1 GUICtrlCreateListViewItem($aData[$aResults[$i]], $cListView) If StringLeft($aData[$aResults[$i]], 1) = "×" Then _GUICtrlListView_SetItemChecked($cListView, $i) _GUICtrlListView_SetItemText($cListView, $i, "") EndIf Next Case $cReset _GUICtrlListView_DeleteAllItems($cListView) _ResetListview() EndSwitch WEnd Func _ResetListview() For $i = 0 to UBound($aData)-1 GUICtrlCreateListViewItem($aData[$i], $cListView) If StringLeft($aData[$i], 1) = "×" Then ; Check the checkboxes to match the data _GUICtrlListView_SetItemChecked($cListView, $i) _GUICtrlListView_SetItemText($cListView, $i, "") EndIf Next EndFunc
    1 point
  8. meomeo192, You could also use _ArrayFindAll to get all the row indexes if the data to search exists in several rows $aResults = _ArrayFindAll ($aData, "acetyl", 0, 0, 0, 1, -1) _ArrayDisplay($aResults)
    1 point
  9. meomeo192, That is exactly how I would do it. M23
    1 point
  10. To me it seems the solution posted in #23 is the most elegant way to retrieve the last cell of each row.
    1 point
  11. It's kind of you to explain your view on social behaviour. I'll respect your opinions if you respect mine. Now... please lets stick to the topic
    1 point
  12. Search for WinAPIEx.au3 by Yashied and the Function _WinAPI_EmptyWorkingSet() which "Removes as many pages as possible from the working set of the specified process." OR Call this Function in you .au3 to reduce the memory of the current process. Func _ReduceMemory() Local $aReturn = DllCall("psapi.dll", "int", "EmptyWorkingSet", "long", -1) If @error = 1 Then Return SetError(1, 0, 0) EndIf Return $aReturn[0] EndFunc ;==>_ReduceMemory
    1 point
  13. monoceres

    png files in autoit

    Or you could paint the control yourself #include <GDIPlus.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> _GDIPlus_Startup() $image = _GDIPlus_ImageLoadFromFile("image.png") $hwnd = GUICreate("test", 300, 300) GUICtrlCreatePic("", 10, 10, 280, 280) GUISetState() GUIRegisterMsg($WM_PAINT, "_ReDraw") $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd) _GDIPlus_GraphicsDrawImageRect($graphics, $image, 10, 10, 280, 280) Do $msg = GUIGetMsg() Until $msg = -3 _WinAPI_DeleteObject($image) _GDIPlus_GraphicsDispose($graphics) _GDIPlus_Shutdown() Func _ReDraw() _GDIPlus_GraphicsDrawImageRect($graphics, $image, 10, 10, 280, 280) Return $GUI_RUNDEFMSG EndFunc ;==>_ReDraw
    1 point
×
×
  • Create New...