Leaderboard
Popular Content
Showing content with the highest reputation on 01/07/2018 in all areas
-
You don't have to chek for @error because the function returns 0 or 1 but doesn't set @error In your case, check the $Params value. The function uses Unicode, so the $sTagLOGFONT must use wchar instead of char Also, you have to set the size of the $tICONMETRICS structure in cbSize and in the $iParam param of _WinAPI_SystemParametersInfo Here is a working example : #include <WinAPI.au3> #include <WinAPIsysinfoConstants.au3> Global Const $sTagLOGFONT = 'long lfHeight;long lfWidth;long lfEscapement;long lfOrientation;long lfWeight;byte lfItalic;byte lfUnderline;byte lfStrikeOut;byte lfCharSet;byte lfOutPrecision;byte lfClipPrecision;byte lfQuality;byte lfPitchAndFamily;wchar lfFaceName[32];' Global Const $sTagICONMETRICS='uint cbSize;int iHorzSpacing;int iVertSpacing;int iTitleWrap;' & $sTagLOGFONT Local $tICONMETRICS = DllStructCreate($sTagICONMETRICS) Local $iSize = DllStructGetSize($tICONMETRICS) DllStructSetData($tICONMETRICS, "cbSize", $iSize) Local $iRet = _WInAPI_SystemParametersInfo($SPI_GETICONMETRICS, $iSize, $tICONMETRICS) If $iRet Then ConsoleWrite(DllStructGetData($tICONMETRICS, 'cbSize') & @TAB & DllStructGetData($tICONMETRICS, 'iHorzSpacing') & @TAB & DllStructGetData($tICONMETRICS, 'iVertSpacing') & @TAB & DllStructGetData($tICONMETRICS, 'iTitleWrap')&@CRLF) Else MsgBox(0, "Error", _WinAPI_GetLastErrorMessage() ) EndIf Edit : @Danyfirex, I was trying to make the structure by myself, but I didn't manage to get it work. I thought I had to use a ptr the LOGFONT structure...2 points
-
youtuber, From the Help file... kylomas1 point
-
Deye 1) Thank you very much 2) This code 100 percent work on Microsoft WIndows 7 Professional x64 Service Pack 1 #include <WinAPISys.au3> $hWnd = ControlGetHandle('[Class:Progman]', '', '[Class:SHELLDLL_DefView]') _Desktop_DefView_SetIconSz($hWnd, 1) Func _Desktop_DefView_SetIconSz($hWnd, $iSize) ;$hwnd of DefView, $iSize 0-4 smallest to largest ;EXLARGEICONS=0, MEDICONS=1, LARGEICONS=2,SMALLICONS=3, SMALLESTICONS=4 ;Made this up from watching Window Messages (fires menu messages I think) ;(IFolderView2::SetViewModeAndIconSize. is probably how WE should be doing this) If @OSVersion = "WIN_XP" Then Return 0 ;Works on Windows 7/8, Sends icon size to defView based on ListView view If $iSize < 0 Or $iSize > 4 Or @OSVersion = "WIN_XP" Then Return 0 Local $aLvtoDv[5] = [4, 3, 1, 2, 0] ;Extra Large Icons = &H704D -28749<-----Index 0 ;Medium Icons = &H704E -28750; Large Icons = &H704F -28751; ;Small Icons = &H7050 -28752; Smallest Icons = &H7051 -28753 Local Const $WM_COMMAND = 0x111 Local $iMsg = $WM_COMMAND Local $wParam = 28749 + $aLvtoDv[Int($iSize)] ;FVM_?? Local Const $lParam = 0 _SendMessage($hWnd, $iMsg, $wParam, $lParam) If @error Then MsgBox(0, "_Desktop_DefView_SetIconSz", "_SendMessage Error: " & @error) Exit EndIf Return 1 EndFunc ;==>_Desktop_DefView_SetIconSz 3) Question : how replace $hWnd = ControlGetHandle('[Class:Progman]', '', '[Class:SHELLDLL_DefView]') on $hWnd = _WinAPI_GetDesktopWindow ( ) I find on https://www.autoitscript.com/autoit3/docs/libfunctions/_WinAPI_GetDesktopWindow.htm 4) This code #include <WinAPISys.au3> #include <WinAPI.au3> $hWnd = _WinAPI_GetDesktopWindow ( ) _Desktop_DefView_SetIconSz($hWnd, 1) Func _Desktop_DefView_SetIconSz($hWnd, $iSize) ;$hwnd of DefView, $iSize 0-4 smallest to largest ... EndFunc ;==>_Desktop_DefView_SetIconSz do not work careca Hello This code 100 percent work on Microsoft WIndows 7 Professional x64 Service Pack 1 #include <WinAPISys.au3> $hWnd = ControlGetHandle('[Class:Progman]', '', '[Class:SHELLDLL_DefView]') _Desktop_DefView_SetIconSz($hWnd, 1) Func _Desktop_DefView_SetIconSz($hWnd, $iSize) ;$hwnd of DefView, $iSize 0-4 smallest to largest ;EXLARGEICONS=0, MEDICONS=1, LARGEICONS=2,SMALLICONS=3, SMALLESTICONS=4 ;Made this up from watching Window Messages (fires menu messages I think) ;(IFolderView2::SetViewModeAndIconSize. is probably how WE should be doing this) If @OSVersion = "WIN_XP" Then Return 0 ;Works on Windows 7/8, Sends icon size to defView based on ListView view If $iSize < 0 Or $iSize > 4 Or @OSVersion = "WIN_XP" Then Return 0 Local $aLvtoDv[5] = [4, 3, 1, 2, 0] ;Extra Large Icons = &H704D -28749<-----Index 0 ;Medium Icons = &H704E -28750; Large Icons = &H704F -28751; ;Small Icons = &H7050 -28752; Smallest Icons = &H7051 -28753 Local Const $WM_COMMAND = 0x111 Local $iMsg = $WM_COMMAND Local $wParam = 28749 + $aLvtoDv[Int($iSize)] ;FVM_?? Local Const $lParam = 0 _SendMessage($hWnd, $iMsg, $wParam, $lParam) If @error Then MsgBox(0, "_Desktop_DefView_SetIconSz", "_SendMessage Error: " & @error) Exit EndIf Return 1 EndFunc ;==>_Desktop_DefView_SetIconSz1 point
-
Hi. It's not possible to test your code. First error I see is the last line. It should be "EndFunc" in one word and w/o brackets. But if I try to run your script I get a lot of errors: "test2.au3"(1,26) : warning: $VK_ESCAPE: possibly used before declaration. _HotKey_Assign($VK_ESCAPE, ~~~~~~~~~~~~~~~~~~~~~~~~~^ "test2.au3"(4,22) : warning: $Fox: possibly used before declaration. _WinWaitActivate($Fox, ~~~~~~~~~~~~~~~~~~~~~^ "test2.au3"(1,26) : error: $VK_ESCAPE: undeclared global variable. _HotKey_Assign($VK_ESCAPE, ~~~~~~~~~~~~~~~~~~~~~~~~~^ "test2.au3"(1,36) : error: _HotKey_Assign(): undefined function. _HotKey_Assign($VK_ESCAPE, "OpText") ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "test2.au3"(4,25) : error: _WinWaitActivate(): undefined function. _WinWaitActivate($Fox,"") ~~~~~~~~~~~~~~~~~~~~~~~~^ "test2.au3"(5,58) : error: NET_ControlGetHandleByName(): undefined function. Local $Alfa = NET_ControlGetHandleByName($Fox, "", "txtA") ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "test2.au3"(8,41) : error: _GUICtrlEdit_GetSel(): undefined function. Local $range = _GUICtrlEdit_GetSel($Beta) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "test2.au3"(12,61) : error: _GUICtrlEdit_GetText(): undefined function. $SelectedText = StringMid(_GUICtrlEdit_GetText($Beta) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "test2.au3"(16,34) : error: _IsFocused(): undefined function. If _IsFocused($Fox, $Alfa) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "test2.au3"(17,114) : error: _GUICtrlEdit_SetText(): undefined function. _GUICtrlEdit_SetText($Alfa,StringUpper(StringLeft($SelectedText,1)) & StringTrimLeft($SelectedText,1)) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "test2.au3"(27,17) : error: _HotKey_Release(): undefined function. _HotKey_Release() ~~~~~~~~~~~~~~~~^ test2.au3 - 9 error(s), 2 warning(s) Try to serve a snippet everybody can run w/o errors except the one you are asking for. So someone is willing to help you. Regards, Conrad1 point
-
Yeah, the subquery flattener of the query planner/optimizer isn't always smart enough to perform such (advanced?) optimization, mainly because there are potential dark corners where a seemingly clever optimization falls flat on its nose in another seemingly similar use case. Such remarks regularly pop up on the mailing list, but often enough, the proposed optimization made by people would work on their precise test case but have devastating effects on another large range of slightly different queries. SQLite main use base (in terms of number of devices) is for low-end devices having limited computing power and/or memory. So contrary to Oracle or MySQL and other RDBMS where massaging a query ad nauseam to choose the absolute best plan is both possible and beneficial, SQLite can't devote as much code and complexity. In case one of your queries takes longer than expected, try looking at what EXPLAIN QUERY PLAN <query> yields. The output often calls for a rewrite of the query and/or creation of a useful index. See http://www.sqlite.org/eqp.html1 point
-
[GUI] Gui Function Help Needed
DynamicRookie reacted to farouk12 for a topic
Maybe This ;Script STRNG= 103494x104955x01 #include <Misc.au3> #Include <File.au3> #include <GuiConstants.au3> #INCLUDE <GuiConstantsEx.au3> #pragma compile(inputboxres, true) If Not (@ScriptName = "DynamicRookie's Colorized No. 103494x104955x01.au3") Then MsgBox(0, "Unofficial", "You are running an unnoficial version of STRNG: 103494x104955x01 by DynamicRookie, but feel free to use it below your own risk :)") ShellExecute("https://www.autoitscript.com/forum/profile/104955-dynamicrookie/") EndIf $StringVal116 = 1 $Const_Win32_idGetHandle = WinGetHandle("103494x104955x01", "1x1") Sleep (10) Hotkeyset("{=}", "_ResetVariable") SetError(0, 0, 0) $In01 = InputBox("In01", "Please enter the string you want to automate :)") If @error Then Call("ConsoleErrorFunction") EndIf $ID=MsgBox(4, "In03", "Want to enable _HasToRenewVal Function? (DEFAULT: Yes)") If $ID = 6 Then $_HTRVal = True Elseif $ID = 7 Then $_HTRVal = False EndIf Global $StringVal104910 = 0 ;Default String 0x0x1 :) Global $StringVal116 = 0 ;Custom String 0x5x1 :) Global $State = 1 Global $vReStr = '000' MsgBox(0, "DynaRookie", "Script made by DynamicRookie, for 103494 in AutoIt Forums") GUICreate("103494x104955x01", 400, 400, -1, -1, -1, -1) GUICtrlCreateLabel("103494x104955x01 Active Process", 10, 10, 100, 20, -1, -1) GUICtrlCreateLabel("Value Extension Macrostring: ", 10, 40, 100, 20) $vReStr = GUICtrlCreateLabel("N/V/R", 112, 40, 50, 20) GUICtrlCreateLabel("String Specified: # " & $In01 & " #, type K to type specified string.", 0, 100, 300, 20) GUISetState() Call("_D4N4M11CCKR010K133") ;It waits until u press K to check for $In03 and if checked to type type $In01 in the chat, then you need to press "=" key to enable the variable back, else ;If HasToRenew function is enabled you dont need to enable it back, ;else if the variable is already enabled and you dont want to make it type $In01 when you press K, press "=" when ;the variable is already enabled, it will deactivate it until you press "=" again. Func Init0() GUICtrlSetData($vReStr, 'Initializing: Control 0x1') $StatusString = "Init0" Sleep(1) $i_Win32_idPosition = WinGetPos("103494x104955x01", "1x2") $i_Win32_Status = "Active0" GUICtrlSetData($vReStr, 'Ready to use!') $StatusString = "RD1" Call("_D4N4M11CCKR010K133") EndFunc Func _D4N4M11CCKR010K133() While 1 If _IsPressed('4B') And $StringVal116 = 1 Then $StringVal104910 = 1 ExecuteFunction_0_0_0_1() EndIf Sleep(100) WEnd EndFunc Func _ResetVariable() If $State = 0 And $_HTRVal = True Then $State = 1 Call ("_D4N4M11CCKR010K133") Elseif $State = 1 And $_HTRVal = True Then $State = 0 Call ("_D4N4M11CCKR010K133") Else Call("_D4N4M11CCKR010K133") EndIf Endfunc Func ExecuteFunction_0_0_0_1() #forcedef $StatusString If $StatusString = "Init0" Then MsgBox(0, "Wait", "Please wait until it loads completely") Call("Init0") ElseIf $State = 1 And $_HTRVal = True Then GUICtrlSetData($vReStr, "Typing specified string") Send('' & $In01 & '', 1) $State = 0 GuiCtrlSetData($vReStr, "Sent function command!") Call("_D4N4M11CCKR010K133") ElseIf $State = 0 or $State = 1 And $_HTRVal = False Then GUICtrlSetData($vReStr, "Typing specified string") Send('' & $In01 & '', 1) GuiCtrlSetData($vReStr, "Sent function command!") Call("_D4N4M11CCKR010K133") Else Call("_D4N4M11CCKR010K133") EndIf EndFunc Func ConsoleErrorFunction() #forcedef $i_idTimeout_msg ConsoleWrite($Const_Win32_idGetHandle) MsgBox("1, 48, 256, 4096, 2097152", "Exception @error", "An Unexpected error has occurred, please contact DynamicRookie for help, in AutoIt forums ( This window will close in " & $i_idTimeout_msg & "seconds", $i_idTimeout_msg) Exit 0 If @error = 1 Then ConsoleWrite("User has decided: Cancel = Val. 2") Exit 0 ElseIf @error = 2 Then ShellExecute("https://www.autoitscript.com/forum/profile/104955-dynamicrookie/") ConsoleWrite("User has decided: Nothing = Val. 0") Exit 0 EndIf EndFunc1 point -
youtuber, This is an SQL implementation of what I understand of your needs... #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <array.au3> #include <SQLite.au3> #include <EditConstants.au3> #AutoIt3Wrapper_Add_Constants=n Local $gui010 = GUICreate('File Comapare Example', 1300, 620) GUICtrlCreateLabel('File 1 raw', 10, 15, 100, 15) Local $f1raw = GUICtrlCreateEdit('', 10, 30, 200, 200, $ws_vscroll) GUICtrlCreateLabel('File 1 distinct', 220, 15, 100, 15) Local $f1distinct = GUICtrlCreateEdit('', 220, 30, 200, 200, $ws_vscroll) GUICtrlCreateLabel('File 1 dups', 430, 15, 100, 15) Local $f1dups = GUICtrlCreateEdit('', 430, 30, 200, 200, $ws_vscroll) GUICtrlCreateLabel('File 1 not in file 2', 640, 15, 100, 15) Local $f1notinf2 = GUICtrlCreateEdit('', 640, 30, 200, 200, $ws_vscroll) GUICtrlCreateLabel('File 1 in file 2', 850, 15, 100, 15) Local $f1inf2 = GUICtrlCreateEdit('', 850, 30, 200, 200, $ws_vscroll) GUICtrlCreateLabel('Enter File 1 Path or ''...'' for select dialog', 10, 250, 200, 20) Local $f1 = GUICtrlCreateInput('', 10, 270, 400, 20) Local $selectf1 = GUICtrlCreateLabel('...', 420, 270, 20, 20) GUICtrlSetFont(-1, 14, 800) GUICtrlSetCursor($selectf1, 0) GUICtrlCreateLabel('File 2 raw', 10, 315, 100, 15) Local $f2raw = GUICtrlCreateEdit('', 10, 330, 200, 200, $ws_vscroll) GUICtrlCreateLabel('File 2 distinct', 220, 315, 100, 15) Local $f2distinct = GUICtrlCreateEdit('', 220, 330, 200, 200, $ws_vscroll) GUICtrlCreateLabel('File 2 dups', 430, 315, 100, 15) Local $f2dups = GUICtrlCreateEdit('', 430, 330, 200, 200, $ws_vscroll) GUICtrlCreateLabel('File 2 not in file 1', 640, 315, 100, 15) Local $f2notinf1 = GUICtrlCreateEdit('', 640, 330, 200, 200, $ws_vscroll) GUICtrlCreateLabel('File 2 in file 1', 850, 315, 100, 15) Local $f2inf1 = GUICtrlCreateEdit('', 850, 330, 200, 200, $ws_vscroll) GUICtrlCreateLabel('Combined distinct entries', 1070, 15, 100, 15) Local $comb = GUICtrlCreateEdit('', 1070, 30, 200, 500, $ws_vscroll) GUICtrlCreateLabel('Enter File 2 Path or ''...'' for select dialog', 10, 550, 200, 20) Local $f2 = GUICtrlCreateInput('', 10, 570, 400, 20) Local $selectf2 = GUICtrlCreateLabel('...', 420, 570, 20, 20) ;, $ss_centerimage) GUICtrlSetFont(-1, 14, 800) GUICtrlSetCursor($selectf2, 0) Local $pop = GUICtrlCreateButton('Copulate', 1100, 570, 150, 20) GUISetState() Local $aRetFiles While 1 Switch GUIGetMsg() Case $gui_event_close Exit Case $selectf1 _getf1() Case $selectf2 _getf2() Case $pop $aRetFiles = Get_File_Differences(GUICtrlRead($f1), GUICtrlRead($f2)) If @error <> 0 Then Exit MsgBox(17, 'Error from Get_File_Differences', '@ERROR = ' & @error) _pop($aRetFiles) EndSwitch WEnd Func _getf1() Local $sFileOpenDialog = FileOpenDialog('Selct File', @ScriptDir & "\", "Text (*.txt)", $FD_FILEMUSTEXIST) If @error Then MsgBox($MB_SYSTEMMODAL, "", "No file(s) were selected.") Else GUICtrlSetData($f1, StringReplace($sFileOpenDialog, "|", @CRLF)) EndIf FileChangeDir(@ScriptDir) EndFunc ;==>_getf1 Func _getf2() Local $sFileOpenDialog = FileOpenDialog('Selct File', @ScriptDir & "\", "Text (*.txt)", $FD_FILEMUSTEXIST) If @error Then MsgBox($MB_SYSTEMMODAL, "", "No file(s) were selected.") Else GUICtrlSetData($f2, StringReplace($sFileOpenDialog, "|", @CRLF)) EndIf FileChangeDir(@ScriptDir) EndFunc ;==>_getf2 Func _pop($filearray) GUICtrlSetData($f1raw, FileRead(GUICtrlRead($f1))) GUICtrlSetData($f2raw, FileRead(GUICtrlRead($f2))) GUICtrlSetData($f1distinct, _ArrayToString($filearray[0])) GUICtrlSetData($f1dups, _ArrayToString($filearray[1])) GUICtrlSetData($f1notinf2, _ArrayToString($filearray[2])) GUICtrlSetData($f1inf2, _ArrayToString($filearray[3])) GUICtrlSetData($f2distinct, _ArrayToString($filearray[4])) GUICtrlSetData($f2dups, _ArrayToString($filearray[5])) GUICtrlSetData($f2notinf1, _ArrayToString($filearray[6])) GUICtrlSetData($f2inf1, _ArrayToString($filearray[7])) GUICtrlSetData($comb, _ArrayToString($filearray[8])) EndFunc ;==>_pop Func Get_File_Differences($file1, $file2) _SQLite_Startup() If @error Then Return SetError(1, @error) _SQLite_Open() If @error Then Return SetError(2, @error) Local $afile1 = StringSplit(FileRead($file1), @CRLF, 3) Local $afile2 = StringSplit(FileRead($file2), @CRLF, 3) Local $sql = 'drop table if exists File1; drop table if exists File2;' If _SQLite_Exec(-1, $sql) <> $sqlite_ok Then Return SetError(5) Local $sql = 'drop table if exists f1distinct; drop table if exists f2distinct;' If _SQLite_Exec(-1, $sql) <> $sqlite_ok Then Return SetError(6) Local $sql = 'create table File1 (col1); create table File2 (col1);' If _SQLite_Exec(-1, $sql) <> $sqlite_ok Then Return SetError(3) $sql = '' For $1 = 0 To UBound($afile1) - 1 If $afile1[$1] = '' Then ContinueLoop $sql &= 'insert into file1 values(' & _SQLite_FastEscape($afile1[$1]) & ');' Next For $1 = 0 To UBound($afile2) - 1 If $afile2[$1] = '' Then ContinueLoop $sql &= 'insert into file2 values(' & _SQLite_FastEscape($afile2[$1]) & ');' Next If _SQLite_Exec(-1, $sql) <> $sqlite_ok Then Return SetError(4) ; $aret elements ; [0] array of distinct entries file 1 ; [1] array of dups in file 1 ; [2] array of file 1 entries not in file 2 ; [3] array of file 1 entries in file 2 ; [4] array of distinct entries file 2 ; [5] array of dups in file 2 ; [6] array of file 2 entries not in file 1 ; [7] array of file 2 entries in file 1 ; [8] array of file 1 and file 2 distinct entries Local $aret[9] Local $ret, $arows, $icol, $irow _SQLite_Exec(-1, 'create table f1distinct as select distinct(col1) from file1;') _SQLite_GetTable2d(-1, 'select col1 from f1distinct order by col1 asc', $arows, $icol, $irow) _ArrayDelete($arows, 0) $aret[0] = $arows _SQLite_GetTable2d(-1, 'SELECT col1 FROM file1 GROUP BY col1 HAVING ( COUNT(col1) > 1 ) order by col1 asc;', $arows, $icol, $irow) _ArrayDelete($arows, 0) $aret[1] = $arows ;_arraydisplay($arows) _SQLite_GetTable2d(-1, 'select col1 from f1distinct where col1 not in (select col1 from file2) order by col1 asc;', $arows, $icol, $irow) _ArrayDelete($arows, 0) $aret[2] = $arows _SQLite_GetTable2d(-1, 'select col1 from f1distinct where col1 in (select col1 from file2) order by col1 asc;', $arows, $icol, $irow) _ArrayDelete($arows, 0) $aret[3] = $arows _SQLite_Exec(-1, 'create table f2distinct as select distinct(col1) from file2;') _SQLite_GetTable2d(-1, 'select col1 from f2distinct order by col1 asc;', $arows, $icol, $irow) _ArrayDelete($arows, 0) $aret[4] = $arows _SQLite_GetTable2d(-1, 'SELECT col1 FROM file2 GROUP BY col1 HAVING ( COUNT(col1) > 1 ) order by col1 asc;', $arows, $icol, $irow) _ArrayDelete($arows, 0) $aret[5] = $arows _SQLite_GetTable2d(-1, 'select col1 from f2distinct where col1 not in (select col1 from file1) order by col1 asc;', $arows, $icol, $irow) _ArrayDelete($arows, 0) $aret[6] = $arows _SQLite_GetTable2d(-1, 'select col1 from f2distinct where col1 in (select col1 from file1) order by col1 asc;', $arows, $icol, $irow) _ArrayDelete($arows, 0) $aret[7] = $arows _SQLite_GetTable2d(-1, 'select col1 from file1 union select col1 from file2 order by col1 asc;', $arows, $icol, $irow) _ArrayDelete($arows, 0) $aret[8] = $arows Return $aret EndFunc ;==>Get_File_Differences The files that I used for testing are file2.txt and file1.txt kylomas1 point
-
I managed to solve the accelerator/tabstop issue for the moment, but now I've found an outright bug - When enabling or disabling a button, the hovers become unresponsive - if you click on the GUI however they work again. Re-activating the GUI does not solve it. I traced this cause to the GUICtrlSendMsg function. It's sending a message of code 0x172. I see that you're using raw numbers instead of constants all over the place. Wtf? How is anybody supposed to figure this out? This is not the first bug I've encountered, either, but the code in this UDF is too difficult to read. I think I'll just go and make my own implementation from scratch.1 point
-
Great UDF, looks nice and runs fast. Sadly the lack of accelerator and tabstop support is a deal breaker, and I've opted to stick with the bare Win32 style of controls. I did try to implement this myself, however. First I wanted to add accelerator support to the MsgBox. I decided to parse the string for ampersand hint character and manually draw the underline: ;Parse text for ampersand (&) to draw an underline Local $iAmpPos = StringInStr($Text, "&") If $iAmpPos > 0 Then $Text = StringReplace($Text, "&", "") Local $iTextSize = _StringSize($Text, $Fontsize, 700, 0, $Font) Local $iAccelChar = StringMid($Text, $iAmpPos, 1) Local $iAccelCharSize = _StringSize($iAccelChar, $Fontsize, 700, 0, $Font) Local $iAccelCharPre = StringLeft($Text, $iAmpPos - 1) Local $iAccelCharPreSize = _StringSize($iAccelCharPre, $Fontsize, 700, 0, $Font) Local $iAccelCharPixPos = _StringSize($iAccelChar, $Fontsize, 700, 0, $Font) Local $iLineStartX = $Width / 2 - $iTextSize[2] / 2 + $iAccelCharPreSize[2] + 1 Local $iLineEndX = $iLineStartX + $iAccelCharSize[2] - 2 Local $iLineY = $Height / 2 + $Fontsize / 2 + 1 Local $Pen_BTN_AccelUnderline = _GDIPlus_PenCreate($FrameColor, 1) _GDIPlus_GraphicsDrawLine($Button_Graphic1[0], $iLineStartX, $iLineY, $iLineEndX, $iLineY, $Pen_BTN_AccelUnderline) _GDIPlus_GraphicsDrawLine($Button_Graphic1[0], $iLineStartX, $iLineY, $iLineEndX, $iLineY, $Pen_BTN_AccelUnderline) EndIf It looked OK, for the most part (I did test it with other characters too, alignment is as best as it could be based on the reported character width/position calcualtion): This is shown permanently, however. I couldn't figure out how to show the the bitmap as an overlay on the existing one when I wanted (i.e. when ALT is held down), this GDI graphics work is all magic to me. Second, the desire for tabstops was blocked by the same thing. I couldn't figure out how to actually draw the tabstop based on your existing system, since it's all heavily nested in the hover code. The drawing part was fine, I just made a new pen for dotted outline; but actually getting it to draw on the right button on-demand. I'm hopeful that these features can be added one day by someone more skilled than I. Thanks.1 point
-
I've recently been uncovering the useful commandline tools that can be found natively in Windows, one of which was findstr (there is also a GUI interface available in SciTE4AutoIt3.) After coming across this little gem and implementing in >SciTE Jump, it felt only right that I should share this on the forums as a standalone UDF. Thanks Function: ; #FUNCTION# ==================================================================================================================== ; Name ..........: _FindInFile ; Description ...: Search for a string within files located in a specific directory. ; Syntax ........: _FindInFile($sSearch, $sFilePath[, $sMask = '*'[, $fRecursive = True[, $fLiteral = Default[, ; $fCaseSensitive = Default[, $fDetail = Default]]]]]) ; Parameters ....: $sSearch - The keyword to search for. ; $sFilePath - The folder location of where to search. ; $sMask - [optional] A list of filetype extensions separated with ';' e.g. '*.au3;*.txt'. Default is all files. ; $fRecursive - [optional] Search within subfolders. Default is True. ; $fLiteral - [optional] Use the string as a literal search string. Default is False. ; $fCaseSensitive - [optional] Use Search is case-sensitive searching. Default is False. ; $fDetail - [optional] Show filenames only. Default is False. ; Return values .: Success - Returns a one-dimensional and is made up as follows: ; $aArray[0] = Number of rows ; $aArray[1] = 1st file ; $aArray[n] = nth file ; Failure - Returns an empty array and sets @error to non-zero ; Author ........: guinness ; Remarks .......: For more details: http://ss64.com/nt/findstr.html ; Example .......: Yes ; =============================================================================================================================== Func _FindInFile($sSearch, $sFilePath, $sMask = '*', $fRecursive = True, $fLiteral = Default, $fCaseSensitive = Default, $fDetail = Default) Local $sCaseSensitive = $fCaseSensitive ? '' : '/i', $sDetail = $fDetail ? '/n' : '/m', $sRecursive = ($fRecursive Or $fRecursive = Default) ? '/s' : '' If $fLiteral Then $sSearch = ' /c:' & $sSearch EndIf If $sMask = Default Then $sMask = '*' EndIf $sFilePath = StringRegExpReplace($sFilePath, '[\\/]+$', '') & '\' Local Const $aMask = StringSplit($sMask, ';') Local $iPID = 0, $sOutput = '' For $i = 1 To $aMask[0] $iPID = Run(@ComSpec & ' /c ' & 'findstr ' & $sCaseSensitive & ' ' & $sDetail & ' ' & $sRecursive & ' "' & $sSearch & '" "' & $sFilePath & $aMask[$i] & '"', @SystemDir, @SW_HIDE, $STDOUT_CHILD) ProcessWaitClose($iPID) $sOutput &= StdoutRead($iPID) Next Return StringSplit(StringStripWS(StringStripCR($sOutput), BitOR($STR_STRIPLEADING, $STR_STRIPTRAILING)), @LF) EndFunc ;==>_FindInFileExample use of Function: #include <Array.au3> #include <Constants.au3> Example() Func Example() Local $hTimer = TimerInit() Local $aArray = _FindInFile('findinfile', @ScriptDir, '*.au3;*.txt') ; Search for 'findinfile' within the @ScripDir and only in .au3 & .txt files. ConsoleWrite(Ceiling(TimerDiff($hTimer) / 1000) & ' second(s)' & @CRLF) _ArrayDisplay($aArray) $hTimer = TimerInit() $aArray = _FindInFile('autoit', @ScriptDir, '*.au3') ; Search for 'autoit' within the @ScripDir and only in .au3 files. ConsoleWrite(Ceiling(TimerDiff($hTimer) / 1000) & ' second(s)' & @CRLF) _ArrayDisplay($aArray) EndFunc ;==>Example1 point