Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/09/2019 in all areas

  1. Run the script compiled during log in or boot up or how ever you want the script to run. You can use a batch file to run the executable from within GP.
    1 point
  2. Skysnake, The SQLite include file contains function definitions - you cannot have function definitions within other function definitions, hence the error. M23
    1 point
  3. I don't have my scripts with me, but... You can make Listviews with checkboxes, tick the box corresponding to the row item you want, click on a button and do something with any value in a selected cell. I'll try to find an example Found it @kulltsb Here we go. SQLite db for data persistence, Listview for pretty display. And a nice GUI to make your CRUD easy You don't need to copy cell data to the clipboard, you can select to a $var and then do with it as you please... Zip file includes the SQLite 3.12.1 DLL. getLVcelldata.zip This uses a very different approach to managing the Listview compared to what @Subz put above. I only think my code is easier to follow and perhaps easier to maintain.
    1 point
  4. Try this : #include <ScreenCapture.au3> #include <GDIPlus.au3> #include <Date.au3> #include <Memory.au3> Global $RaportFileName = @YEAR & "-" & @MON & "-" & @MDAY & "_" & @HOUR & "_" & @MIN & "_" & @SEC & ".html" $text = "This is first line text" & @CRLF &"and this is next line" _Raport($text, 1) FileWrite(@ScriptDir & "\" & $RaportFileName, "</pre></html>") ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Raport ; Description ...: ; Syntax ........: _Raport($sText1[, $Screen = 0]) ; Parameters ....: $sText1 - a string value. ; $Screen - [optional] an unknown value. Default is 0. ; 0 - Default - do not screenshot ; 1 - added screenshot full desktop ; Return values .: None ; Author ........: Your Name ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Raport($sText1, $Screen=0) Local $sText = "" Local $sHead = "" ; Define HTML file header and style $sHead = '<html>' & @CRLF & '<head><meta charset="utf-8"></head>' & @CRLF $sHead = $sHead & '<style>img{border:3px solid #FF0000;}</style>' & @CRLF $sHead = $sHead & '<style>pre{font-family: monospace;}</style>' & @CRLF $sHead = $sHead & '<style>pre{font-size: large;}</style>' & @CRLF $sHead = $sHead & '<pre>' & @CRLF If NOT FileExists(@ScriptDir & "\" & $RaportFileName) Then ; If file Raport not exist then create FileOpen(@ScriptDir & "\" & $RaportFileName, 258) FileWrite(@ScriptDir & "\" & $RaportFileName, $sHead) EndIf If StringInStr($sText1, @CRLF) > 0 Then ; @CRLF (ENTER) change the @CRLF and 11 space (indentation on width "[GG:MM:SS] ") $sText1 = StringReplace($sText1, @CRLF, @CRLF & '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;') EndIf $sText = $sText & $sText1 If $Screen <> 0 Then Local $hBitMap = _ScreenCapture_Capture("") _GDIPlus_Startup() Local $hImage = _GDIPlus_BitmapCreateFromHBITMAP ($hBitMap) Local $bString = Image2BinaryString($hImage) $sText = $sText & @CRLF & '<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' & '<img src="data:image/png;base64,' & _ _ConvertToBase64($bString) & '"/>' _GDIPlus_ImageDispose($hImage) _WinAPI_DeleteObject($hBitMap) _GDIPlus_Shutdown() EndIf FileWrite(@ScriptDir & "\" & $RaportFileName, "[" & _NowTime(5) & "]&nbsp;" & $sText & "<br><br>"&@CRLF) ; write to file Raport EndFunc Func _ConvertToBase64($bString) $objXML=ObjCreate("MSXML2.DOMDocument") $objNode=$objXML.createElement("b64") $objNode.dataType="bin.base64" $objNode.nodeTypedValue=Binary($bString) Return $objNode.Text EndFunc Func Image2BinaryString($hBitmap) ; based on UEZ code Local $sImgCLSID, $tGUID, $tParams, $tData $sImgCLSID = _GDIPlus_EncodersGetCLSID("PNG") $tGUID = _WinAPI_GUIDFromString($sImgCLSID) Local $hStream = _WinAPI_CreateStreamOnHGlobal() _GDIPlus_ImageSaveToStream($hBitmap, $hStream, DllStructGetPtr($tGUID)) Local $hMemory = _WinAPI_GetHGlobalFromStream($hStream) Local $iMemSize = _MemGlobalSize($hMemory) Local $pMem = _MemGlobalLock($hMemory) $tData = DllStructCreate("byte[" & $iMemSize & "]", $pMem) Local $bData = DllStructGetData($tData, 1) _WinAPI_ReleaseStream($hStream) _MemGlobalFree($hMemory) Return $bData EndFunc
    1 point
  5. @SirAlonne Well, jchp explained most of my regexp and pointed you to the complete reference manual. If that is overwhelming, you can check the StringRegExp helpfile and the Regular Expression Tutorial for some more comprehensive approaches, As for my re: "[^\w\h\.!\()-]" "[]" ;square brackets mark a set. A set matches any of the characters included in it "^" ;when inside a set gives the complement of the set, e.g. "[e]" matches the "e" char, "[^e]" matches any char but "e" "\w" ;matches any word char, that is any letter,digit or the underscore "_" char "\h" ;matches any horizontal space char, that is space, tab and some more,you can find them in the StringRegExp helpfile "\." ;matches the dot char, if not escaped "." matches any char with some exceptions, see StringRegExp helpfile again "!" ;matches the exclamation mark "\(" ;matches the opening parenthesis, if not escaped parentheses mark a group, again look it up, too long to cover here ")" ;matches the closing parenthesis, only the left parenthesis needs escaping "-" ;matches the hyphen char, if put between chars marks a range, e.g. "[a-z]" matches any lowercase latin character, but ; "[a\-z]" matches either "a","-" or "z" ;so my previous re "[^\w\h-\.!\()]" was wrong because hyphen needed to be either escaped or in the end of the set "[^\w\h\.!\()-]" ;matches any char that isn't a word char, a horizontal space char, a dot, an exclamation mark,parentheses or a hyphen I hope I made it clear enough
    1 point
  6. You might find it useful to keep Unicode letters and digits as well. Prepend (*UCP) at the pattern to make \w match any Unicode letter or digit or _, and \d any Unicode digit. Fictuous example: Local $title = "영국여사 조쉬엄마의 첫 치맥 먹방 도전!?! ◓ ♬♫\ghuo .*. ỸἇἮὤ ∑ [ທຊکڄຮ] (+조쉬 사춘기 썰)" Local $titley = StringRegExpReplace($title, "(*UCP)[^\w\h-\.!\()]", "") MsgBox(0, "", $titley) If ever you need to filter in or out specific languages or types of Unicode codepoint, you may find the \p<something> construct pretty handy. See help under StringRegexp() for basics or the full official PCRE1 doc https://www.pcre.org/original/doc/html/pcrepattern.html
    1 point
  7. Maybe it's easier to decide what to keep? Local $titley = StringRegExpReplace($title, "[^\w\h-\.!\()]", "") The only symbols this code keeps are "_-.!()" you can add anything other you may want!
    1 point
  8. Here is a basic example using listview: #include <Array.au3> #include <File.au3> #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <WindowsConstants.au3> Global $g_idAddress, $g_idListView _Example() Func _Example() Local $aDocument, $aDocuments = _FileListToArrayRec(@ScriptDir, "New Text Document.txt", 1, 1, 0, 2) GUICreate("Contacts", 800, 900) $g_idListView = GUICtrlCreateListView("Name|Email|Phone|Age|Street Address|City|State|Zip Code", 10, 10, 780, 500) For $i = 1 To $aDocuments[0] _FileReadToArray($aDocuments[$i], $aDocument, 0, ":") _ArrayTranspose($aDocument) _ArrayDelete($aDocument, 0) _GUICtrlListView_AddArray($g_idListView, $aDocument) Next $g_idAddress = GUICtrlCreateEdit("", 10, 515, 780, 200) GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd EndFunc Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $iIndex, $sText Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo ; Local $tBuffer $hWndListView = $g_idListView If Not IsHWnd($g_idListView) Then $hWndListView = GUICtrlGetHandle($g_idListView) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $LVN_COLUMNCLICK ; A column was clicked Case $LVN_KEYDOWN ; A key has been pressed $iIndex = _GUICtrlListView_GetSelectionMark($g_idListView) + 1 $sText = _GUICtrlListView_GetItemText($g_idListView, $iIndex, 0) & @CRLF $sText &= _GUICtrlListView_GetItemText($g_idListView, $iIndex, 1) & @CRLF $sText &= _GUICtrlListView_GetItemText($g_idListView, $iIndex, 2) & @CRLF GUICtrlSetData($g_idAddress, $sText) ClipPut($sText) MsgBox(4096, "Clipboard", "Added to ClipBoard", 1) Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam) $sText = _GUICtrlListView_GetItemText($g_idListView, DllStructGetData($tInfo, "Index"), 0) & @CRLF $sText &= _GUICtrlListView_GetItemText($g_idListView, DllStructGetData($tInfo, "Index"), 1) & @CRLF $sText &= _GUICtrlListView_GetItemText($g_idListView, DllStructGetData($tInfo, "Index"), 2) & @CRLF GUICtrlSetData($g_idAddress, $sText) ClipPut($sText) MsgBox(4096, "Clipboard", "Added to ClipBoard", 1) Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY If you want more advanced features recommend Melba23 ListviewEx.au3 udf found here:
    1 point
×
×
  • Create New...