Leaderboard
Popular Content
Showing content with the highest reputation on 09/20/2022 in all areas
-
AutoIt v3.3.16.1 has been released. Thanks to @jpm and the MVPs who were responsible for the majority of code in this version. Download it here. Complete list of changes: History6 points
-
GuiFlatButton UDF : Change Colors of Regular Buttons
mumpel reacted to kurtykurtyboy for a topic
GuiFlatButton is a UDF to easily create regular buttons with different colors for background, foreground, border, hover, focus, etc.. This started as an effort to change the background color of a button and eventually grew into a full UDF. If you've looked around forums for changing button background colors, you have probably noticed that each proposed workaround has its own set of issues/side-effects. The answers usually circle back to 'use ownerdrawn buttons' and 'not worth it'. Well, now it is possible for anyone to easily create ownerdrawn buttons - totally worth it! Some issues with other workarounds such as drawing with GDI+ or using a colored label as a 'button': Not 'real' buttons so you lose built-in functionality that windows gives to buttons Messy / inefficient code in the main while loop to check for mouse position Slow to respond to click, paint, etc... Having to deal with GUIRegisterMsg messages Not straight-forward to implement GuiFlatButton is not a workaround; it is a technique to respond to Windows' built-in owner-drawn button events. With minimal effort, we can now create true simple colored buttons. The idea is to create an owner-drawn button using GUICtrlCreateButton then subclass the GUI and controls to handle the button-specific events to paint it however we want. This UDF magically does all of this for us! No need to worry about event handling or main while loop logic. How to use It couldn't be any easier! Simply create a new button using the familiar syntax. This creates an ownerdrawn button with default colors. $mybutton1 = GuiFlatButton_Create("Button 1", 78, 20, 120, 40) If you want to change the background and text colors: GuiFlatButton_SetBkColor(-1, 0x5555FF) GuiFlatButton_SetColor(-1, 0xFFFFFF) Advanced Usage Set background/text/border all at once GuiFlatButton_SetColors(-1, 0x0000FF, 0xFFFFFF, 0x9999FF) Set ALL colors for ALL button states! (normal, focus, hover, selected) Local $aColorsEx = [0x0000FF, 0xFFFFFF, -2, 0x4444FF, 0xFFFFFF, 0xAAAAFF, 0x6666FF, 0xFFFFFF, 0xCCCCFF, 0x0000EE, 0xFFFFFF, 0x7777EE] GuiFlatButton_SetColorsEx(-1, $aColorsEx) Set default colors to apply to any future buttons ;set colors GuiFlatButton_SetDefaultColors(0x0000FF, 0xFFFFFF, 0x9999FF) ;create buttons $mybutton1 = GuiFlatButton_Create("Button 1", 12, 20, 120, 40) $mybutton2 = GuiFlatButton_Create("Button 2", 143, 20, 120, 40) Set ALL color defaults ;set colors Local $aColorsEx = [0x0000FF, 0xFFFFFF, -2, 0x4444FF, 0xFFFFFF, 0xAAAAFF, 0x6666FF, 0xFFFFFF, 0xCCCCFF, 0x0000EE, 0xFFFFFF, 0x7777EE] GuiFlatButton_SetDefaultColorsEx($aColorsEx) ;create buttons $mybutton1 = GuiFlatButton_Create("Button 1", 12, 20, 120, 40) $mybutton2 = GuiFlatButton_Create("Button 2", 143, 20, 120, 40) Available Functions Simple Example #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include "GuiFlatButton.au3" Example() ;GUI with one button Func Example() Local $hGUI, $mybutton1 $hGUI = GUICreate("GuiFlatButton Ex0", 275, 120) GUISetBkColor(0x333333) Local $idLabel = GUICtrlCreateLabel("Click the button", 10, 100, 150, 30) GUICtrlSetColor(-1, 0xFFFFFF) ;create new button then set the background and foreground colors $mybutton1 = GuiFlatButton_Create("Button 1" & @CRLF & "Line 2", 78, 20, 120, 40, $BS_MULTILINE) GuiFlatButton_SetBkColor(-1, 0x5555FF) GuiFlatButton_SetColor(-1, 0xFFFFFF) GUISetState(@SW_SHOW, $hGUI) Local $i = 0 Local $iMsg While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE ExitLoop Case $mybutton1 $i += 1 GUICtrlSetData($idLabel, $i) ConsoleWrite($i & @CRLF) EndSwitch Sleep(10) WEnd GUIDelete() EndFunc ;==>Example Menu/Toolbar Example #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include "GuiFlatButton.au3" Example() ;Example GUI with toolbar Func Example() Local $hGUI, $idLabel, $aButtons, $iTbSize $hGUI = GUICreate("GuiFlatButton Ex2", 300, 200) GUISetBkColor(0x444444) $idLabel = GUICtrlCreateLabel("Click a button", 10, 180, 150, 30) GUICtrlSetColor(-1, 0xFFFFFF) $aButtons = createToolbar() $iTbSize = UBound($aButtons) GUISetState(@SW_SHOW, $hGUI) Local $i = 0 Local $iMsg While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE ExitLoop Case $aButtons[0] To $aButtons[$iTbSize - 1] ConsoleWrite("1") GUICtrlSetData($idLabel, GuiFlatButton_Read($iMsg)) EndSwitch Sleep(10) WEnd GUIDelete() EndFunc ;==>Example Func createToolbar() Local $aButtons[6] Local $bkColor = 0x777777 Local $textColor = 0xFFFFFF Local $borderColor = 0x999999 Local $aBtnClrs[12] = [0x777777, 0xFFFFFF, $GUI_BKCOLOR_TRANSPARENT, 0x888888, 0xFFFFFF, $GUI_BKCOLOR_TRANSPARENT, 0x999999, 0xFFFFFF, $GUI_BKCOLOR_TRANSPARENT, 0x666666, 0xFFFFFF, $GUI_BKCOLOR_TRANSPARENT] For $i = 0 To UBound($aButtons) - 1 $aButtons[$i] = GuiFlatButton_Create("B" & $i, $i * 50, 0, 50, 17) GuiFlatButton_SetColorsEx($aButtons[$i], $aBtnClrs) Next Return $aButtons EndFunc ;==>createToolbar Icon Example You can even easily add icons to your buttons -- just create a new button and send it an icon! #include <GDIPlus.au3> #include "GuiFlatButton.au3" Example() ;buttons with Icon images Func Example() ;get images for demonstration _GDIPlus_Startup() ;initialize GDI+ Local $hIcon = _WinAPI_ShellExtractIcon(@SystemDir & '\shell32.dll', 258, 24, 24) ;extract the 'Save' icon Local $hBitmap = _GDIPlus_BitmapCreateFromHICON($hIcon) ;Create Bitmap from Icon (for demonstration) Local $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) ;Create HBitmap from Bitmap _GDIPlus_BitmapDispose($hBitmap) ;dispose the bitmap _GDIPlus_Shutdown() ;done with GDI+ Local $hGUI = GUICreate("GuiFlatButton Ex5", 255, 400) GUISetBkColor(0xEEEEEE) ;set default colors of future buttons Local $aColorsEx = _ [0xE2E5E8, 0X000000, 0x888888, _ ; normal : Background, Text, Border 0xE2E5E8, 0X000000, 0x333333, _ ; focus : Background, Text, Border 0xE8E8E8, 0X000000, 0x666666, _ ; hover : Background, Text, Border 0xDDDDDD, 0X000000, 0xAAAAAA] ; selected : Background, Text, Border GuiFlatButton_SetDefaultColorsEx($aColorsEx) ;normal button with icon $label1 = GUICtrlCreateLabel( "$BS_TOOLBUTTON -->", 5, 10) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) Local $mybutton1 = GuiFlatButton_Create("Save", 130, 5, 50, 48, $BS_TOOLBUTTON) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybutton1), $BM_SETIMAGE, $IMAGE_ICON, $hIcon)) ;align top Local $mybuttonT = GuiFlatButton_Create("Top", 5, 65, 120, 55, $BS_TOP) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybuttonT), $BM_SETIMAGE, $IMAGE_ICON, $hIcon)) ;align top-left Local $mybuttonTL = GuiFlatButton_Create("Top-Left", 5, 125, 120, 55, BITOR($BS_TOP, $BS_LEFT)) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybuttonTL), $BM_SETIMAGE, $IMAGE_ICON, $hIcon)) ;align top-right Local $mybuttonTR = GuiFlatButton_Create("Top-Right", 5, 185, 120, 55, BITOR($BS_TOP, $BS_RIGHT)) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybuttonTR), $BM_SETIMAGE, $IMAGE_ICON, $hIcon)) ;align left Local $mybuttonL = GuiFlatButton_Create("Left", 5, 245, 120, 55, $BS_LEFT) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybuttonL), $BM_SETIMAGE, $IMAGE_ICON, $hIcon)) ;align bottom Local $mybuttonB = GuiFlatButton_Create("Bottom", 130, 65, 120, 55, $BS_BOTTOM) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybuttonB), $BM_SETIMAGE, $IMAGE_ICON, $hIcon)) ;align bottom-left Local $mybuttonBL = GuiFlatButton_Create("Bottom-Left", 130, 125, 120, 55, BITOR($BS_BOTTOM, $BS_LEFT)) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybuttonBL), $BM_SETIMAGE, $IMAGE_ICON, $hIcon)) ;align bottom-right Local $mybuttonBR = GuiFlatButton_Create("Bottom-Right", 130, 185, 120, 55, BITOR($BS_BOTTOM, $BS_RIGHT)) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybuttonBR), $BM_SETIMAGE, $IMAGE_ICON, $hIcon)) ;align right Local $mybuttonR = GuiFlatButton_Create("Right", 130, 245, 120, 55, $BS_RIGHT) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybuttonR), $BM_SETIMAGE, $IMAGE_ICON, $hIcon)) GuiFlatButton_SetState($mybuttonR, $GUI_DISABLE ) ;disabled Local $mybuttonDisable = GuiFlatButton_Create("Disabled", 130, 310, 120, 55, $BS_TOOLBUTTON) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybuttonDisable), $BM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap)) GuiFlatButton_SetState($mybuttonDisable, $GUI_DISABLE ) ;clean up! _WinAPI_DestroyIcon( $hIcon ) _WinAPI_DeleteObject( $hHBitmap ) GUISetState(@SW_SHOW, $hGUI) Local $iMsg While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch Sleep(10) WEnd GUIDelete() EndFunc ;==>Example I'm sure there are some use-cases I've forgotten, so feedback is welcome! Download the latest UDF and several more examples: GuiFlatButton_20220919.zip (1,121) Update 2022-09-19 Added update from 05/25 back in after it was accidentally removed Update 2022-09-01 Added $BS_MULTILINE button style Added ellipses when text is longer than the button Fixed compatibility with Opt("MustDeclareVars", 1) Update 2022-05-25 Fixed issue, buttons disappear when a GUI containing a child window with WS_EX_MDICHILD extended style is moved Update 2022-05-24 Fixed issue releasing subclassing when GUI is deleted but program is not closed Fixed occasional white background flicker Added function GuiFlatButton_GetPos Update 2021-01-02 Fixed bug, not drawing correctly after deleting GUI with GUIDelete() Fixed bug, changing default colors changed all buttons, even previously created buttons Made some internal functions more efficient Update 2019-04-14 Fixed bug, not showing pressed down state when clicking rapidly Added Icon/Bitmap support! Added function GuiFlatButton_SetPos to change the position and/or size of a button Update 2019-02-09 Added 2 new functions to set the button colors globally for all future buttons. GuiFlatButton_SetDefaultColors GuiFlatButton_SetDefaultColorsEx Credits to: Melba23 (UDF template) LarsJ (general subclassing code) 4ggr35510n (TrackMouseEvent example) binhnx (disable dragging with $WS_EX_CONTROLPARENT) GUIRegisterMsg in AutoIt Help (owner-draw button example) funkey (_WinAPI_DrawState example)1 point -
Decipher data to date
Musashi reacted to HurleyShanabarger for a topic
Hi @Musashi, thank you for your support, it helped me to look in the right place (_Date_Time_* UDF). The format I encountered is the FILETIME format from Microsoft and that can easily converted with all the wonderful UDF from AutoIt ♥1 point -
Looking for Lazycat (YDY) Direct RTF writer file rtf_writer.zip
pixelsearch reacted to Zedna for a topic
Here is content of my local copy of RTF_writer.au3: ;=============================================================================== ; ; Description: Functions for formatting given text into RTF format ; Requirement(s): None ; Return Value(s): On Success - string with Rich-formatted data ; Author(s): YDY (Lazycat) ; Version: 0.1 ; Date: 15.01.2005 ; ;=============================================================================== ;=============================================================================== ; ; Description: Create empty RTF data block ; Parameter(s): Default font name ; Return Value(s): On Success - string with Rich-formatted data ; ;=============================================================================== Func _RTFCreateDocument($sDefFont) Local $sDoc = "{\rtf1\ansi\deff0" $sDoc = $sDoc & "{\fonttbl{\f0\fnil " & $sDefFont & ";}{\fontplaceholder}}" $sDoc = $sDoc & "{\colortbl \red0\green0\blue0;{\colorplaceholder}}" $sDoc = $sDoc & "{\placeholder}}" Return($sDoc) EndFunc ;=============================================================================== ; ; Description: Format string with given parameters ; Parameter(s): ; $RTF - previously created RTF data ; $sText - text for formatting ; $nColor - text color ; $iSize - text size ; $iFontStyle - font style ; 1 - Bold ; 2 - Italic ; 4 - Underline ; 8 - Strikeout ; $sFont - text font ; Return Value(s): On Success - string with Rich-formatted data ; ;=============================================================================== Func _RTFAppendString($RTF, $sText, $nColor, $iSize, $iFontStyle, $sFont) Local $iFSPos = StringInStr($RTF, "{\fonttbl") Local $iFEPos = StringInStr($RTF, "{\fontplaceholder}}") Local $sFontBlock = StringMid($RTF, $iFSPos, $iFEPos - $iFSPos) Local $iCSPos = StringInStr($RTF, "{\colortbl") + 10 Local $iCEPos = StringInStr($RTF, "{\colorplaceholder}}") Local $sColorBlock = StringMid($RTF, $iCSPos, $iCEPos - $iCSPos) Local $iFontIndex = -1, $iFPos, $sFontStyle = "" Local $asColor, $iColIndex, $sFormatted ; Lookup font table While 1 $iFontIndex = $iFontIndex + 1 $iFPos = StringInStr($sFontBlock, "\f" & $iFontIndex) If not $iFPos Then $RTF = StringReplace($RTF, "{\fontplaceholder}", "{\f" & $iFontIndex & "\fnil " & $sFont & ";}{\fontplaceholder}") Exitloop Endif $sFontBlock = StringTrimLeft($sFontBlock, $iFPos) While StringLeft($sFontBlock, 1) <> " " $sFontBlock = StringTrimLeft($sFontBlock, 1) Wend $sFontBlock = StringTrimLeft($sFontBlock, 1) If StringLeft($sFontBlock, StringLen($sFont)) == $sFont Then Exitloop Wend ; Lookup color table $asColor = StringSplit($sColorBlock, ";") $iColIndex= $asColor[0]-1 For $iCnt = 1 to $asColor[0] - 1 If $asColor[$iCnt] = _RTFGetColor($nColor) Then $iColIndex = $iCnt-1 Exitloop Endif Next If $iColIndex = $asColor[0]-1 Then $RTF = StringReplace($RTF, "{\colorplaceholder}", _RTFGetColor($nColor) & ";{\colorplaceholder}") Endif ; Construct font style If BitAnd($iFontStyle, 1) Then $sFontStyle = $sFontStyle & "\b" If BitAnd($iFontStyle, 2) Then $sFontStyle = $sFontStyle & "\i" If BitAnd($iFontStyle, 4) Then $sFontStyle = $sFontStyle & "\ul" If BitAnd($iFontStyle, 8) Then $sFontStyle = $sFontStyle & "\strike" ; Replace special symbols $sText = StringReplace($sText, "\", "\\") $sText = StringReplace($sText, @CR, "\par") ; Construct formatted block $sFormatted = "{\f" & $iFontIndex & _ "\cf" & $iColIndex & _ "\fs" & $iSize * 2 & $sFontStyle & _ " " & $sText & "}{\placeholder}" $RTF = StringReplace($RTF, "{\placeholder}", $sFormatted) Return($RTF) EndFunc ;=============================================================================== ; ; Description: Return RTF-style formatted color ; Parameter(s): Color numeric value ; Return Value(s): RTF-style formatted color ; ;=============================================================================== Func _RTFGetColor($nColor) $sRed = BitAnd(BitShift($nColor, 16), 0xff) $sGreen = BitAnd(BitShift($nColor, 8), 0xff) $sBlue = BitAnd($nColor, 0xff) Return("\red" & $sRed & "\green" & $sGreen & "\blue" & $sBlue) EndFunc1 point -
Decipher data to date
HurleyShanabarger reacted to Musashi for a topic
Unfortunately I have not found anything regarding the first timestamp (there are so many formats ). Could you please post the name of the application / database. The conversion of a Unix timestamp to a date/time notation would look like this for example. I don't know if this helps you in somehow. ; complete example by @Realm ; https://www.autoitscript.com/forum/topic/153617-seconds-since-epoch-aka-unix-timestamp/ #include <Date.au3> #include <Array.au3> #include <Constants.au3> Local $iUnixTime = 1663697056 Local $sUnixDateTime = _GetDateTime_FromUnixTime($iUnixTime) MsgBox($MB_SYSTEMMODAL, "Unix Timestamp", "Get Date from Unix Timestamp in Local Time" & @CRLF & _ "UnixTime = " & $iUnixTime & @CRLF & _ "DateTime = " & $sUnixDateTime & @CRLF) Func _GetDateTime_FromUnixTime($iUnixTime, $iReturnLocal = True) Local $aRet = 0, $aDate = 0 Local $aMonthNumberAbbrev[13] = ["", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] Local $timeAdj = 0 If Not $iReturnLocal Then Local $aSysTimeInfo = _Date_Time_GetTimeZoneInformation() Local $timeAdj = $aSysTimeInfo[1] * 60 If $aSysTimeInfo[0] = 2 Then $timeAdj += $aSysTimeInfo[7] * 60 EndIf $aRet = DllCall("msvcrt.dll", "str:cdecl", "ctime", "int*", $iUnixTime + $timeAdj ) If @error Or Not $aRet[0] Then Return "" $aDate = StringSplit(StringTrimRight($aRet[0], 1), " ", 2) Return $aDate[4] & "/" & StringFormat("%.2d", _ArraySearch($aMonthNumberAbbrev, $aDate[1])) & "/" & $aDate[2] & " " & $aDate[3] EndFunc ;==>_GetDateTime_FromUnixTime1 point -
OutlookEX UDF - Help & Support (IV)
seadoggie01 reacted to water for a topic
1 point -
Looking for Lazycat (YDY) Direct RTF writer file rtf_writer.zip
pixelsearch reacted to 1957classic for a topic
I think this is what you're looking for. http://autoit.darkhost.ru/files/rtf_writer.zip1 point -
isPressed on focused control
SkysLastChance reacted to Nine for a topic
Not sure if it is your own GUI, but here one way : #include <Misc.au3> #include <GUIConstants.au3> #include <Constants.au3> #include <WinAPIConv.au3> Local $hGUI = GUICreate("Example", 200, 200) Local $box = GUICtrlCreateInput("", 1, 30, 170, 30) GUIRegisterMsg($WM_COMMAND, WM_COMMAND) GUISetState() While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $iIDFrom = _WinAPI_LoWord($wParam) Local $iCode = _WinAPI_HiWord($wParam) If $iCode = $EN_CHANGE And $iIDFrom = $box Then If _IsPressed("41") Then ConsoleWrite("a" & @CRLF) EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND1 point -
Hello I'm using isn autoit studio for a long time and tried to add some plugins, but the existing SDK is very limited So I modified the original code I added linking external files with the project I know that the file name appears in the project tree, but the file is not found in the project folder ADD Item in Context Menu for add new Linker Global $TreeviewContextMenu_Item_Linker = _GUICtrlCreateODMenuItem("Linker", $TreeviewContextMenu_Item8, $smallIconsdll, 998) ;Projektbaum aktualisieren add Event in _InputCheck Case $TreeviewContextMenu_Item_Linker _Linker() add _Linker Function for add New Linker and update .isn file #Region ; DevMode Func _Linker() If $Offenes_Projekt = "" Then Return -1 If Not IsHWnd($Current_TVExplorer_TreeView) Then Return -1 Local $Treeview = $Current_TVExplorer_TreeView If _GUICtrlTreeView_GetSelection($Treeview) = 0 Then Return $FileSet = FileOpenDialog("Setect Linker",'','Autoit File(*.au3;)|All File(*.*)') If FileExists($FileSet) Then Dim $szDrive, $szDir, $szFName, $szExt _PathSplit($FileSet, $szDrive, $szDir, $szFName, $szExt) $LinkerName = InputBox("Add New Linker","Plese enter Linker Name",$szFName&$szExt) If $LinkerName = "" Then Return _GUICtrlTreeView_AddChild($hWndTreeview, _GUICtrlTreeView_GetFirstItem($hWndTreeview),'=>'&$LinkerName) $NewLinker = $FileSet&'%'&$LinkerName $OldLinkers = IniRead($Pfad_zur_Project_ISN, "ISNPROJECT_TODOLISTDATA", "Linker", "") IniWrite($Pfad_zur_Project_ISN, "ISNPROJECT_TODOLISTDATA", "Linker",$OldLinkers&'|'&$NewLinker) EndIf Sleep(250) $Projektbaum_ist_bereit = 1 EndFunc ;==>_Erstelle_kopie_von_markierter_datei #EndRegion add _LinkerOpen for open file in Editor Func _LinkerOpen($LinkerName) $Linkes = IniRead($Pfad_zur_Project_ISN, "ISNPROJECT_TODOLISTDATA", "Linker", "") $sLinker = StringSplit($Linkes,'|') For $p = 1 To $sLinker[0] If $sLinker[$p] = "" Then ContinueLoop $fLinker = StringSplit($sLinker[$p],'%') If $fLinker[0] = 2 And $LinkerName = $fLinker[2] Then Try_to_opten_file($fLinker[1]) EndIf Next EndFunc add Load Linker Func _Load_Project($Foldername) ....... $RDC_Main_Thread = _RDC_Create($Offenes_Projekt, 1, BitOR($FILE_NOTIFY_CHANGE_FILE_NAME, $FILE_NOTIFY_CHANGE_DIR_NAME), 0, $Studiofenster) $RDC_UDFs_Thread = _RDC_Create(_ISN_Variablen_aufloesen($UDFs_Folder), 1, BitOR($FILE_NOTIFY_CHANGE_FILE_NAME, $FILE_NOTIFY_CHANGE_DIR_NAME), 0, $Studiofenster) _Reload_Ruleslots() _Aktualisiere_oder_erstelle_Projektbaum($Offenes_Projekt) _GUICtrlTVExplorer_Expand($hWndTreeview) #Region Load Linker DevMode $Linkes = IniRead($Pfad_zur_Project_ISN, "ISNPROJECT_TODOLISTDATA", "Linker", "") $sLinker = StringSplit($Linkes,'|') For $p = 1 To $sLinker[0] If $sLinker[$p] = "" Then ContinueLoop $fLinker = StringSplit($sLinker[$p],'%') If $fLinker[0] = 2 Then _GUICtrlTreeView_AddChild($hWndTreeview, _GUICtrlTreeView_GetFirstItem($hWndTreeview),'=>'&$fLinker[2]) EndIf Next #EndRegion ;Set focus to the first item in the treeview ...... EndFunc ;==>_Load_Project Func _Update_Treeview() ...... #Region Load Linker DevMode $Linkes = IniRead($Pfad_zur_Project_ISN, "ISNPROJECT_TODOLISTDATA", "Linker", "") $sLinker = StringSplit($Linkes,'|') For $p = 1 To $sLinker[0] If $sLinker[$p] = "" Then ContinueLoop $fLinker = StringSplit($sLinker[$p],'%') If $fLinker[0] = 2 Then _GUICtrlTreeView_AddChild($hWndTreeview, _GUICtrlTreeView_GetFirstItem($hWndTreeview),'=>'&$fLinker[2]) EndIf Next #EndRegion EndFunc ;==>_Update_Treeview Also I needed to add some modifications because by clicking on the file in the project tree the item . is deleted Edit File ISN_Studio_WindowMessages.au3 , Function _ISN_WM_NOTIFY_TVExplorer Case -3 ; NM_DBLCLK $Current_TVExplorer_TreeView = $hTV ;~ If $tvData[$Index][28] Then ;~ ExitLoop ;~ EndIf $tPOINT = _WinAPI_GetMousePos(1, $hTV) $tTVHTI = _GUICtrlTreeView_HitTestEx($hTV, DllStructGetData($tPOINT, 1), DllStructGetData($tPOINT, 2)) $hItem = DllStructGetData($tTVHTI, 'Item') If BitAND(DllStructGetData($tTVHTI, 'Flags'), $TVHT_ONITEM) Then $text = _GUICtrlTreeView_GetText($Current_TVExplorer_TreeView, $hItem ) If StringLeft($text,2) = "=>" Then Return _LinkerOpen(StringTrimLeft($text,2)) ; DevMode $path = _TV_GetPath($Index, $hItem) If Not _WinAPI_PathIsDirectory($path) Then _TV_Send(6, $Index, $hItem) EndIf EndIf Edit File ISN_UDF_TVExplorer.au3 , Function _TV_Send Func _TV_Send($iDummy, $iIndex, $hItem, $fDirect = 0, $lParam = 0) IF BitAND($ISNDebugConsole_SpecialLogs, $ISNDebugConsole_SpecialLogs_TVExplorer) then _Write_ISN_Debug_Console("TVExplorer try to send "&$iDummy&" to index "&$iIndex&" and hItem "&$hItem , $ISN_Debug_Console_Errorlevel_Info) _Write_ISN_Debug_Console("DummyControl Handle: "&$tvData[$iIndex][$iDummy], $ISN_Debug_Console_Errorlevel_Info) Endif Local $wParam = _WinAPI_MakeLong($iDummy, $iIndex) If $hItem <> -1 Then $tvData[$iIndex][$iDummy + 17] = $hItem EndIf If $fDirect Then IF BitAND($ISNDebugConsole_SpecialLogs, $ISNDebugConsole_SpecialLogs_TVExplorer) then _Write_ISN_Debug_Console("TVExplorer try _TV_Dummy with wparam "&$wParam&" and lparam "&$lParam , $ISN_Debug_Console_Errorlevel_Info) _TV_Dummy($wParam, $lParam) Else IF BitAND($ISNDebugConsole_SpecialLogs, $ISNDebugConsole_SpecialLogs_TVExplorer) then _Write_ISN_Debug_Console("TVExplorer try GUICtrlSendToDummy with handle "&$tvData[$iIndex][$iDummy]&" and wparam "&$wParam , $ISN_Debug_Console_Errorlevel_Info) If StringLeft(_GUICtrlTreeView_GetText($Current_TVExplorer_TreeView, $hItem ),2) = "=>" Then Return 1 ; DevMode If Not GUICtrlSendToDummy($tvData[$iIndex][$iDummy], $wParam) Then IF BitAND($ISNDebugConsole_SpecialLogs, $ISNDebugConsole_SpecialLogs_TVExplorer) then _Write_ISN_Debug_Console("TVExplorer _TV_Send STOPPED at GUICtrlSendToDummy! Let´s ReCreate the DummyControls..." , $ISN_Debug_Console_Errorlevel_Warning) _ISN_ReCreateTVExplorerDummyControls($iIndex) If Not GUICtrlSendToDummy($tvData[$iIndex][$iDummy], $wParam) Then IF BitAND($ISNDebugConsole_SpecialLogs, $ISNDebugConsole_SpecialLogs_TVExplorer) then _Write_ISN_Debug_Console("TVExplorer _TV_Send STOPPED again at GUICtrlSendToDummy! ReCreate failed!" , $ISN_Debug_Console_Errorlevel_Critical) Return 0 Endif EndIf EndIf Return 1 EndFunc ;==>_TV_Send Please ISI360 add this feature to the official software Also, if possible, add the project to GitHub so that we can help it develop the program1 point
-
ArrayMultiColSort -New Release 06 April 2019
MarkIT reacted to pixelsearch for a topic
@Melba23: that's a useful UDF and it's fast too I just tested it to sort a column containing digits & letters, maybe I should have done it differently but it worked : #include "ArrayMultiColSort.au3" ; Melba23's UDF #include <Array.au3> #include <File.au3> #include <MsgBoxConstants.au3> Local $aArray, $aArrayRegExp $sFilePath = @ScriptDir & "\ArrayMultiColSort - personal example.csv" _FileReadToArray($sFilePath, $aArray, $FRTA_NOCOUNT, ",") If @error Then MsgBox($MB_TOPMOST, "_FileReadToArray", "@error = " & @error) Exit EndIf _ArrayDisplay($aArray, "1 = before multisort") Local $iDim_Rows = UBound($aArray, $UBOUND_ROWS) Local $iDim_Cols = UBound($aArray, $UBOUND_COLUMNS) Redim $aArray[$iDim_Rows][$iDim_Cols + 2] ; add 2 temporary columns from the right For $iRow = 0 To $iDim_Rows - 1 $aArrayRegExp = StringRegExp($aArray[$iRow][0], '^\d+', $STR_REGEXPARRAYGLOBALMATCH) If Not @error Then ; $aArrayRegExp is valid $aArray[$iRow][$iDim_Cols] = Number($aArrayRegExp[0]) $aArray[$iRow][$iDim_Cols + 1] = StringMid($aArray[$iRow][0], StringLen($aArrayRegExp[0]) + 1) Else $aArray[$iRow][$iDim_Cols] = "A" $aArray[$iRow][$iDim_Cols + 1] = $aArray[$iRow][0] EndIf Next ; Sort on both temporary columns, ascending Local $aSortData[][] = [ _ [$iDim_Cols, 0], _ [$iDim_Cols + 1, 0]] _ArrayMultiColSort($aArray, $aSortData, 1) ; 3rd par = 1 (index to start from) as index 0 = header Redim $aArray[$iDim_Rows][$iDim_Cols] ; delete 2 temporary columns from the right _ArrayDisplay($aArray, "2 = after multisort") As you can see in the script, 2 temporary columns were added from the right of the Array : * First temporary column : populated with the digits part (or an "A" in case no digits are found) * Second temporary column : contains the rest of the string. Then your UDF sorts these 2 temporary columns (ascending) before they got deleted, they did the job We notice that 51, 3526, 6001 are correctly sorted and they are followed by their corresponding string part (which is also correctly sorted compared to the original). Also "JANETTE" and "FAWN" which had no digits at all are now correctly placed at the end of the Array (due to the "A" while sorting) In fact, I need to do this in a Listview when the user needs to sort this kind of "mixed" column. The problem is that it seems more complicated to sort that way in a listview which is already populated, because it requires to use GUICtrlListView_RegisterSortCallBack() and its 2nd parameter which is very slow for sorting when equal to 2 (Use Windows API StrCmpLogical : better for "x1y" < "x10y") I wonder if there is another alternative for using your UDF in listview to sort this kind of column, because I can't delete all "native created" items one by one (it will take too much time) just to reuse their contents in an Array, do exactly what we saw in the script above, then repopulate the listview... it will be too much time consuming, depending on the number of items/columns.1 point -
AutoIT Editor Dark Theme
SkysLastChance reacted to argumentum for a topic
The newest SciTE comes with a dark theme, cool !, now switching back to light(standard) theme, there are leftovers from the dark theme, so, i merged those two and recreate them to not leave leftovers from the prior (Light/Dark). Did not do it for all the themes, just those two default standard themes. ...I've got to this back and forth due to Switching to and from "High contrast" windows themes, so I wanted to do the same flawlessly in SciTE, hence the above code. Do your own copy and paste, or to a new file, just in case you wanna keep the original install, original. WARNING: These themes are gravely flawed ( as discussed farther down ). Side effect include messing up any other extension type coloring due to inclusions of global parameters, out of place in a user only configuration file !!!. It will be better to check out the betas that are available.1 point -
AutoIT Editor Dark Theme
SkysLastChance reacted to MaximusCZ for a topic
I searched this forum for long to find any suitable dark theme, but in the end stitched mine. check.if.already.open=0 ## Debug Output Options (to permanent change your selection copy them to SciTEUser.Properties and change it there # Debug MessageBox Option 2="All" 1="No @extended" 0="No @extended & @error". debug.msgbox.option=0 # Debug Console Option 3="All" 2="No SystemTime" 1="No SystemTime & Return" 0="No SystemTime, Return & Error". debug.console.option=0 # Debug Trace Option 3="All" 2="No SystemTime" 1="No SystemTime & Return" 0="No SystemTime, Return & Error". debug.trace.option=2 title.full.path=1 ;Chooses how the file name is displayed in the title bar. When 0 (default) the file name is displayed. When 1 the full path is displayed. When 2 the window title displays "filename in directory". font.base=font:Consolas,size:10,$(font.override) font.monospace=font:Consolas,size:10 backup.files=0 proper.case=0 error.inline=1 highlight.current.word=1 highlight.current.word.by.style=0 ;Allows highlight in comments also highlight.current.word.autoselectword=0 ;Force enable only after minlenght highlight.current.word.wholeword=0 highlight.current.word.matchcase=0 highlight.current.word.minlength=3 ;How many chars before higlight use.tabs=1 indent.size=4 indent.size.*.au3=4 tabsize=4 style.*.32=fore:#009999,back:#003F3F,$(font.base) ; 32 is the default style and its features will be inherited by all other styles unless overridden. caret.line.back=#101010 caret.line.back.alpha=50 selection.fore=#FFFFFF selection.alpha=60 selection.back=#78A878 selection.multipaste=1 style.error.1=fore:#FF0000,back:#24221C style.error.2=fore:#FF0000,back:#000000 highlight.current.word.colour=#FF0000 ;Color of highlighht indicators.alpha=63 calltips.set.above=0 style.au3.38=fore:#AAA6DB,back:#505050 calltips.color.highlight=#FF0000 visible.policy.strict=1 visible.policy.lines=0 style.*.34=fore:#FFFFFF,back:#000000 ; 34 and 35 are used to display matching and non-matching braces respectively. style.*.35=fore:#FF0000,back:#FF0000 ; 34 and 35 are used to display matching and non-matching braces respectively. style.au3.0=fore:#DC4050 0X White space72ADC0 UserDefined Functions and their calls: Terminate(),back:#1F1F1F style.au3.1=fore:#71AE71,back:#1F1F1F style.au3.2=fore:#71AE71,back:#1F1F1F style.au3.3=fore:#A7A8B9 0X Number,back:#1F1F1F style.au3.4=fore:#AAA6DB 0X Function Run(),back:#1F1F1F style.au3.5=fore:#0080FF 0X Keyword,back:#1F1F1F style.au3.6=fore:#FF46FF 0X Macro @error,back:#1F1F1F style.au3.7=fore:#A7A8B9 0X String,back:#1F1F1F style.au3.8=fore:#FF6060 0X Operator,back:#1F1F1F style.au3.9=fore:#D29A6C 0X Variable,back:#1F1F1F style.au3.10=fore:#EA9515,back:#1F1F1F style.au3.11=fore:#F000FF 0X Pre-Processor,back:#1F1F1F style.au3.12=fore:#0080C0 0X Special,back:#1F1F1F style.au3.13=fore:#7D8AE6,back:#1F1F1F style.au3.14=fore:#0080FF,back:#1F1F1F style.au3.15=fore:#72ADC0 0X Standard UDFs,back:#1F1F1F style.au3.16=fore:#0080FF,back:#1F1F1F command.name.7.*= command.name.19.*= command.name.33.*= openpath.$(au3)=$(SciteDefaultHome)\..\include check.updates.scite4autoit3=0 style.*.33=fore:#008A8A,back:#000C0C,$(font.base) ; 33 is used to display line numbers in the margin. style.*.37=fore:#8A8A8A,back:#0C0C0C whitespace.fore=#999999 ;Sets the colours used for displaying all visible whitespace, overriding any styling applied by the lexer. whitespace.back=#3F3F3F ;Sets the colours used for displaying all visible whitespace, overriding any styling applied by the lexer. bookmark.fore=#000000 ;The colours used to display bookmarks in the margin. If bookmark.fore is empty then a blue sphere is used. When the margin is turned off, bookmarks are shown by a change in the background colour of the line with the translucency set with bookmark.alpha. bookmark.back=#71AE71 ;The colours used to display bookmarks in the margin. If bookmark.fore is empty then a blue sphere is used. When the margin is turned off, bookmarks are shown by a change in the background colour of the line with the translucency set with bookmark.alpha. style.*.32=fore:#009999,back:#003F3F,$(font.base) ; 32 is the default style and its features will be inherited by all other styles unless overridden. style.batch.0=fore:#999999 # Default (SCE_BAT_DEFAULT) style.batch.1=fore:#71AE71 # Comment (rem or ::) (SCE_BAT_COMMENT) style.batch.2=fore:#009FFF,bold # Keywords (SCE_BAT_WORD) style.batch.3=fore:#C8C800,back:#000000 # Label (line beginning with ':') (SCE_BAT_LABEL) style.batch.4=fore:#FF46FF,bold # Hide command character ('@') (SCE_BAT_HIDE) style.batch.5=fore:#AAA6DB,bold # External commands (SCE_BAT_COMMAND) style.batch.6=fore:#D39D72,bold # Variable: %%x (x is almost whatever, except space and %), %n (n in ) (SCE_BAT_IDENTIFIER) style.batch.7=fore:#FF8080 # Operator: * ? < > | (SCE_BAT_OPERATOR) style.batch.8=fore:#D39D72,bold # Variable: %EnvironmentVar% (SCE_BAT_ENVIRONMENT) style.batch.9=fore:#D39D72,bold # Variable: !EnvironmentVar! (SCE_BAT_EXPANSION) style.batch.10=fore:#448489,bold # Label in text (SCE_BAT_CLABEL) comment.block.batch=:: braces.batch.style=7 # Braces are only matched in operator style style.*.32=fore:#009999,back:#003F3F,$(font.base) ; 32 is the default style and its features will be inherited by all other styles unless overridden. style.*.34=fore:#FFFFFF,back:#000000 ; 34 and 35 are used to display matching and non-matching braces respectively. style.*.35=fore:#FF0000,back:#FF0000 ; 34 and 35 are used to display matching and non-matching braces respectively. style.*.33=fore:#008A8A,back:#000C0C,$(font.base) ; 33 is used to display line numbers in the margin. style.au3.37=fore:#8A8A8A,back:#0C0C0C line.margin.width=1+ fold.margin.colour=#1F1F1F ;checkerboard pixel patter color 1 around fold trees fold.margin.highlight.colour=#1F1F1F ;checkerboard pixel patter color 2 around fold trees caret.fore=#8FAF9F edge.colour=#8A8A8A edge.mode=0 style.*.32=fore:#009999,back:#003F3F,$(font.base) ; 32 is the default style and its features will be inherited by all other styles unless overridden. style.errorlist.0=fore:#F9F9F9 # ; Actual consoleWrite output style.errorlist.2=fore:#C738B9 style.errorlist.3=fore:#71AE71 # ; >@@ DEBUG (15) : Actual Console output style.errorlist.4=fore:#AAA6DB # ; >Error code: 0 style.errorlist.5=fore:#000000 style.errorlist.11=fore:#EA9515 # ; +>10:21:37 Starting AutoIt3Wrapper v.16.306.1237.......... style.errorlist.12=fore:#AF20C0 # ; --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop style.errorlist.21=fore:#c0c000 error.marker.fore=fore:#505050,back:#3F3F3F colour.error=fore:#ff0000,back:#FF8080 style.css.0=fore:#DCDCCC style.css.1=fore:#AAA6DB style.css.2=fore:#0080FF style.css.3=fore:#61AFAF style.css.4=fore:#CEDF99 style.css.5=fore:#FF8080 style.css.6=fore:#D29A6C style.css.7=fore:#DCDCCC style.css.8=fore:#8296AE style.css.9=fore:#71AE71 style.css.10=fore:#CEDF99 style.css.11=fore:#BFCAA9 style.css.12=fore:#CEDF99 style.css.13=fore:#b5b5b5 style.css.14=fore:#b5b5b5 style.props.0=fore:#A7A7A7 # Default style.props.1=fore:#71AE71 # Comment style.props.2=fore:#4A88D2 # Section style.props.3=fore:#FF8080 # Assignment operator style.props.4=fore:#FF8380 # Default value (@) style.props.5=fore:#A7A7A7 # Key style.props.6=fore:#A7A7A7 # Keys Set 0 style.props.8=fore:#A7A7A7 # Keys Set 2 style.hypertext.0=fore:#999999 # Text style.hypertext.1=fore:#0080FF # Tags style.hypertext.2=fore:#EDD6ED # Unknown Tags style.hypertext.3=fore:#FF8080 # Attributes style.hypertext.4=fore:#DFDFDF # Unknown Attributes style.hypertext.5=fore:#FF00FF # Numbers style.hypertext.6=fore:#CC9393 # Double quoted strings style.hypertext.7=fore:#6860D2 # Single quoted strings style.hypertext.8=fore:#B5B5B5 # Other inside tag style.hypertext.9=fore:#71AE71 # Comment style.hypertext.10=fore:#CDD04A,back:#555555 # Entities style.hypertext.11=fore:#E3CEAB # XML style tag ends '/>' style.hypertext.17=fore:#C89191 # CDATA style.hypertext.19=fore:#FF8000 # Unquoted values style.hypertext.21=fore:#DFDFDF # SGML tags <! ... > style.xml.0=fore:#999999 # Default style.xml.1=fore:#AAA6DB # Tags style.xml.2=fore:#EDD6ED # Unknown Tags style.xml.3=fore:#CC7975 # Attributes style.xml.4=fore:#CC7975 # Unknown Attributes style.xml.5=fore:#8CD0D3 # Numbers style.xml.6=fore:#8296AE # Double quoted strings style.xml.7=fore:#8296AE # Single quoted strings style.xml.8=fore:#B5B5B5 # Other inside tag style.xml.9=fore:#71AE71 # Comment style.xml.11=fore:#AAA6DB # XML style tag ends '/>' style.xml.12=fore:#7F9F7F # XML identifier start '<?' style.xml.13=fore:#7F9F7F # XML identifier end '?>' style.xml.17=fore:#6860D2 # CDATA style.xml.21=fore:#CC7975 # SGML tags <! ... > ; style.xml.1=fore:#0080FF ; style.xml.3=fore:#FF8080 ; style.xml.4=fore:#FF8080 ; style.xml.6=fore:#6860D2 ; style.xml.7=fore:#6860D2 ; style.xml.11=fore:#0080FF ; style.xml.21=fore:#FF8080 ; colour.comment=fore:#008000 ; colour.code.comment.doc=$(colour.comment),back:#FEFEFE ; colour.embedded.comment=back:#E0EEFF ; colour.number=fore:#C738B9 ; colour.keyword=fore:#0080FF ; colour.string=fore:#999999 ; colour.char=$(colour.string) ; colour.operator=fore:#FF8080 ; colour.preproc=fore:#F000FF ; colour.error=fore:#ff0000,back:#FF8080 ; colour.whitespace=fore:#72ADC0 style.vb.0=fore:#FF8080 # Default, White space - @ style.vb.1=fore:#71AE71,italics # Comment style.vb.2=fore:#DC57EB # Number style.vb.3=fore:#0080FF # Keyword1 style.vb.4=fore:#999999 # String style.vb.5=fore:#D997DE # Preprocessor (directives) style.vb.6=fore:#FF8080 # Operator style.vb.7=fore:#C0AD72 # Identifier style.vb.10=fore:#0080FF # Keyword2 style.vb.11=fore:#0080FF # Keyword3 style.vb.12=fore:#0080FF # Keyword4 style.cpp.0=fore:#72ADC0 # White space style.cpp.1=fore:#71AE71,italics # Comment line style.cpp.2=fore:#71AE71,italics # Comment block style.cpp.3=fore:#AAA6DB # style.cpp.4=fore:#C738B9 # Number style.cpp.5=fore:#0080FF # Keyword style.cpp.6=fore:#999999 # String style.cpp.7=fore:#9999AA # style.cpp.8=fore:#FF8080 # style.cpp.9=fore:#F000FF # Pre-Processor style.cpp.10=fore:#FF8080 # Operator style.cpp.11=fore:#D29A6C # Variable style.cpp.12=fore:#0080C0 # Special style.cpp.13=fore:#7D8AE6,bold # Abbrev-Expand style.cpp.14=fore:#0080FF,bold # Com Objects style.cpp.15=fore:#72ADC0 # Standard UDFs edge.column=5000 line.margin.visible=1 caret.width=1 fold.compact=0 ;Turning this option on leads to blank lines following the end of an element folding with that element. Defaults to on. fold.colour=#606060 ;Not highlighted color of line connecting lines fold.highlight.colour=#0060Af # ;Highlited font.base=font:Consolas,size:10,$(font.override) blank.margin.right=0 blank.margin.left=6 fold=1 fold.on.open=0 ;To automatically fold files as much as possible when loaded, set fold.on.open to 1. fold.preprocessor=0 fold.comment=1 fold.flags=0 fold.symbols=3 ;The fold.symbols setting chooses between four ways of showing folding. Set to 0 (the default) for macOS style arrows to indicate contracted (facing right) and expanded (facing down); 1 to display contracted folds with "+" and expanded with "-"; 2 for a flattened tree control with round headers and rounded joins; 3 for a flattened tree control with square headers. fold.highlight=1 ;Set to 1 to enable highlight for current folding block (smallest one that contains the caret). By default, its disable. Note : The highlight is enabled only when fold.symbols equals to 2 (round headers) or 3 (square headers). fold.margin.width=16 style.*.33=fore:#008A8A,back:#000C0C,$(font.base) ; 33 is used to display line numbers in the margin. font.base=font:Consolas,size:10,$(font.override) font.base=font:Consolas,size:10,$(font.override) ; style.au3.32=style.*.32=$(font.base),back:#3F3F3F # Background (??? ??? ????) ; style.au3.34=fore:#FFFFFF,back:301030 # Brace highlight ; style.au3.35=fore:#FF1010,back:B03030 # Brace incomplete highlight ;style.au3.33=fore:#8A8A8A,back:#0C0C0C,$(font.base) ;style.au3.37=fore:#8A8A8A,back:#0C0C0C fold.fore=#505050 ;Color of symbol Fore color fold.back=#202020 ;Color of symbol fill style.*.32=fore:#009999,back:#003F3F,$(font.base) ; 32 is the default style and its features will be inherited by all other styles unless overridden. style.errorlist.32=back:#3F3F3F,$(font.monospace) style.au3.32=style.*.32=$(font.base),back:#1F1F1F style.au3.34=fore:#0080FF 0X Keyword,back:#1F1F1F style.au3.35=fore:#71AE71,back:#1F1F1F highlight.current.word.indicator=style:fullbox,colour:#FFFF80,outlinealpha:200,fillalpha:80 import au3.UserUdfs import au3.keywords.user.abbreviations style.error.0=fore:#ff0000,back:#F0F0F0 Dark.SciTEConfig1 point -
AutoIT Editor Dark Theme
TheOne23 reacted to InunoTaishou for a topic
1 point