Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/04/2019 in all areas

  1. Mbee, I see no abuse in that post, merely a sensible comment that asking us to guess what might be the cause of a specific problem in a very large script is not really a reasonable thing to do. Your comment about being asked to isolate "snippets" of code is exactly what you are asking us to do - but without even sight of the code, which makes it several orders of magnitude more difficult. I suggest you extract the following code from your magnum opus: The GUI (including the various controls on which you want to drop) and the basics of the handler you use to recognise a drop - plus sufficient other lines to make it actually runnable. We do not need all the fancy functions etc - just the bare bones code. Then we can see if there is something fundamentally wrong with the way in which you are coding the whole process - or whether the problem lies elsewhere in these thousands of lines. This incremental approach is the only sensible manner to manage such a problem, so please cool down and help us to help you. M23
    3 points
  2. Then you should be able to post a snippet that reproduced your issue. You are asking members of this forum to first guess at what you are doing and then troubleshoot for you. Kind of a big ask with only the most vague description to go off of, isn't it?
    2 points
  3. MattyD

    Big Analogue Clock

    Hey folks, This is actually the beginnings of something else - but I was pretty happy with how this part turned out. So hey, here is a clock. it is drag-able Escape (after clicking on clock) : Exit Wheel: Grow & Shrink Click Wheel: Reset Size Edit: somehow missed an include directive... #AutoIt3Wrapper_Au3Check_Parameters = -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #NoTrayIcon #include <GDIPlus.au3> #include <GUIConstants.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", 1) Global $hGUI, $iWinH, $iWinW, $iChSize, _ $iStartSz, $iMargin, $iCanvasSz, $iWinXStartPos Global Const $PI = 4 * ATan(1) Global Const $MAGIC_PINK = 0xFF00FF, $MAGIC_PINK_ARGB = 0xFFFF00FF $iWinH = @DesktopHeight $iWinW = $iWinH $iCanvasSz = $iWinH $iMargin = 4 $iStartSz = Int($iWinH / 4) - (2 * $iMargin) $iWinXStartPos = 0 ;Right Side: ide@DesktopWidth - ($iStartSz + (2 * $iMargin)) $hGUI = GUICreate("Clock", $iWinW, $iWinH, $iWinXStartPos, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) GUISetBkColor($MAGIC_PINK) _WinAPI_SetLayeredWindowAttributes($hGUI, $MAGIC_PINK, 0xF0) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUIRegisterMsg($WM_MOUSEWHEEL, "WM_MOUSEWHEEL") GUIRegisterMsg($WM_NCMBUTTONDOWN, "WM_NCMBUTTONDOWN") Clock() Func Clock() Local $hGraphic, $hClockBitmap, $hClockGraphic Local $iSize, $iDigSize, $iOrigin Local $iNumDist, $iDigXOffset, $iDigYOffset Local $ixOffset, $iyOffset Local $hFrameBrush, $hNoseBrush, $hHighlightBrush, $hFaceBrush Local $hBlackPen, $hSecPen, $hMinPen, $hHourPen Local $iSec, $iMin, $iHour Local $ixSecOffset, $iySecOffset, $ixMinOffset, $iyMinOffset, _ $ixHourOffset, $iyHourOffset $iDigSize = $iSize / 20 $iChSize = $iStartSz _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) $hClockBitmap = _GDIPlus_BitmapCreateFromGraphics($iCanvasSz, $iCanvasSz, $hGraphic) $hClockGraphic = _GDIPlus_ImageGetGraphicsContext($hClockBitmap) _GDIPlus_GraphicsSetSmoothingMode($hClockGraphic, 4) $hFrameBrush = _GDIPlus_BrushCreateSolid(0xFF80BBCC) $hNoseBrush = _GDIPlus_BrushCreateSolid(0xEE778888) $hHighlightBrush = _GDIPlus_BrushCreateSolid(0x44FF00FF) $hFaceBrush = _GDIPlus_BrushCreateSolid(0xFFEEF0FF) $hSecPen = _GDIPlus_PenCreate(0xBB882255, 1) $hMinPen = _GDIPlus_PenCreate(0xBBFF8833, 4) $hHourPen = _GDIPlus_PenCreate(0xEE4488AA, 5) $hBlackPen = _GDIPlus_PenCreate(0xFF000000, 4) Do If $iSize <> $iChSize Or @SEC <> $iSec Then $iSize = $iChSize $iDigSize = $iSize / 20 $iOrigin = Int($iSize / 2) + $iMargin $iNumDist = $iSize / 2 - ($iSize / 8) $iDigXOffset = .55 * $iDigSize $iDigYOffset = -(.7 * $iDigSize) _GDIPlus_GraphicsClear($hClockGraphic, $MAGIC_PINK_ARGB) _GDIPlus_GraphicsFillEllipse($hClockGraphic, $iMargin, $iMargin, $iSize, $iSize, $hFrameBrush) _GDIPlus_GraphicsFillEllipse($hClockGraphic, $iMargin + 8, $iMargin + 8, $iSize - 8, $iSize - 8, $hHighlightBrush) _GDIPlus_GraphicsFillEllipse($hClockGraphic, $iMargin + 8, $iMargin + 8, $iSize - 16, $iSize - 16, $hFaceBrush) _GDIPlus_GraphicsDrawEllipse($hClockGraphic, $iMargin, $iMargin, $iSize, $iSize, $hBlackPen) For $i = 1 To 12 $ixOffset = Int($iNumDist * Sin($i * ($PI / 6))) $iyOffset = Int($iNumDist * Cos($i * ($PI / 6))) $ixOffset -= (StringLen($i) * $iDigXOffset) $iyOffset -= $iDigYOffset _GDIPlus_GraphicsDrawString($hClockGraphic, $i, ($iOrigin + $ixOffset), ($iOrigin - $iyOffset), "Symbol", $iDigSize) Next $iSec = @SEC $iMin = 60 * @MIN + $iSec $iHour = (3600 * @HOUR) + $iMin $ixSecOffset = Int((0.83 * $iNumDist) * Sin($iSec * ($PI / 30))) $iySecOffset = Int((0.83 * $iNumDist) * Cos($iSec * ($PI / 30))) $ixMinOffset = Int((0.85 * $iNumDist) * Sin($iMin * ($PI / 1800))) $iyMinOffset = Int((0.85 * $iNumDist) * Cos($iMin * ($PI / 1800))) $ixHourOffset = Int((0.65 * $iNumDist) * Sin($iHour * ($PI / 21600))) $iyHourOffset = Int((0.65 * $iNumDist) * Cos($iHour * ($PI / 21600))) _GDIPlus_GraphicsDrawLine($hClockGraphic, $iOrigin, $iOrigin, $iOrigin + $ixHourOffset, $iOrigin - $iyHourOffset, $hHourPen) _GDIPlus_GraphicsDrawLine($hClockGraphic, $iOrigin, $iOrigin, $iOrigin + $ixMinOffset, $iOrigin - $iyMinOffset, $hMinPen) _GDIPlus_GraphicsDrawLine($hClockGraphic, $iOrigin, $iOrigin, $iOrigin + $ixSecOffset, $iOrigin - $iySecOffset, $hSecPen) _GDIPlus_GraphicsFillEllipse($hClockGraphic, $iOrigin - 3, $iOrigin - 3, 6, 6, $hNoseBrush) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hClockBitmap, 0, 0, $iCanvasSz, $iCanvasSz) EndIf Until GUIGetMsg() = $GUI_EVENT_CLOSE _GDIPlus_BrushDispose($hFrameBrush) _GDIPlus_BrushDispose($hNoseBrush) _GDIPlus_BrushDispose($hHighlightBrush) _GDIPlus_BrushDispose($hFaceBrush) _GDIPlus_PenDispose($hSecPen) _GDIPlus_PenDispose($hMinPen) _GDIPlus_PenDispose($hHourPen) _GDIPlus_PenDispose($hBlackPen) _GDIPlus_BitmapDispose($hClockBitmap) _GDIPlus_GraphicsDispose($hClockGraphic) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>Clock Func WM_NCMBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam $iChSize = $iStartSz EndFunc ;==>WM_NCMBUTTONDOWN Func WM_MOUSEWHEEL($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam Local $iWheelDist, $iRate $iRate = 0.25 $iWheelDist = BitShift($wParam, 16) $iChSize -= Int($iRate * $iWheelDist) If $iChSize < 120 Then $iChSize = 120 If $iChSize > $iCanvasSz - (2 * $iMargin) Then $iChSize = $iCanvasSz - (2 * $iMargin) EndFunc ;==>WM_MOUSEWHEEL Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam Return $HTCAPTION EndFunc ;==>WM_NCHITTEST
    1 point
  4. I like where this is going and I have some suggestions, which you don't have to agree with Rename RollbarCreateItem to Rollbar_Send I understand what you are trying to convey, by having the API item as part of the name, but "CreateItem" in this case is also sending data to Rollbar Create help functions e.g. Rollbar_SendDebug Rollbar_SendInfo .... Writing to the console should be opt-in and not on by default, either by using a flag or by asking for a logging function RollbarCreateItem is quite big, and can be broken down into smaller functions Validation of the API token would be good Keep it up!
    1 point
  5. A MVP and don't know anything about that bypassing captchas is against rules?
    1 point
  6. For current and future interested readers, here's an bit of explanation. In Unicode, many (but not all) characters with diacritic signs (so-called "accents") can be represented in a string by essentially two forms, called "normalization forms". For instance the characters  and Ç can be represented by either sequences of form C (composed characters) or form D (decomposed characters):  in form C = 'Â' (U+00C2)  in form D = 'A' (U+0041) followed by circumflex combining mark '^' (U+0302) Ç in form C = 'Ç' (U+00C7) Ç in form D = 'C' (U+0043) followed by cedilla combining mark '̧̧' (U+0327) The idea under this method of unaccenting latin characters is to convert the string into form D then remove combining marks specifically. This works for most latin scripts but not in general. Human scripts are very complex and subtle, thus Unicode itself has to be complex as well. From the above you can infer that the notion of character in Unicode isn't as simple as it was with codepages (ANSI, Windows, you-name-it). For instance, decomposed "characters" (form D) may use several codepoints, which will count individually. So StringLen(Ç in form D) will return 2. Unicode string are almost always in form C as this makes it simpler to count "characters" (in a sense) and shorter to represent. Another useful concept in Unicode is the "extended grapheme cluster". That is a series of codepoints, some characters, some modifiers that are to be represented alltogether by the rendering system. Such languages using complex extended grapheme clusters are Arabic, Hebrew, Thai, Indic, and others. For examples and differences between decomposed characters and extended grapheme clusters, see this page Unicode to get a feeling about how complex representing human scripts can really be. Btw, our AutoIt implementation of regex (PCRE1) has a character type for matching an extended grapheme cluster: \X which matches as many codepoints as needed to comprehend the whole of what will be represented as a single (complex) visual glyph by the Unicode renderer engine (what you as user feel is a "character"). Finally please realize that all the notions discussed above are independant of the Unicode encoding in use. You can then mimic OSI layers applied to Unicode: bit (not very useful level) encoding unit (byte for UTF8, 16-bit word for UTF16, 32-bit dword for UTF32; byte-order conventional or explicit) codepoint (how many encoding units a codepoint needs for its representation in a given encoding) extended grapheme cluster (as many codepoints needed to designate a glyph) font (set of drawing rules used to draw a glyph) rendered glyph (graphical output of what we human visually perceive as a "character", done by the rendering engine) I told you Unicode wasn't trivial, didn't I?
    1 point
  7. My 2 cents. Use control id rather than instances. Instances change, more frequently than ids. 2: why do you grab the handle to a window and then use a window class to identify the window? if you have the specific handle, use it.
    1 point
  8. No worries, we were all on Day 1 once
    1 point
  9. If that is how you're running ControlClick, there is no question you are going to get an error. Look at the entry for ControlClick in the help file, specifically the examples provide, to see how to correctly use the syntax.
    1 point
  10. Good luck, but realize there is nothing vbscript can do that AutoIt cannot. You are just making things more complicated for yourself mixing languages.
    1 point
  11. Your regex can't do that and it tries to use invalid syntax. You need to use this: Removing Unicode accentuation boils down to convert the string to norm form D (or KD) then remove all diacritic and/or modifier codepoints. In your case, removing combining diacritics works fine. ; Unicode Normalization Forms Global Enum $UNF_NormC = 1, $UNF_NormD, $UNF_NormKC = 5, $UNF_NormKD Func _UNF_Change($sIn, $iForm) If $iForm = $UNF_NormC Or $iForm = $UNF_NormD Or $iForm = $UNF_NormKC Or $iForm = $UNF_NormKD Then Local $aRet = DllCall("Normaliz.dll", "int", "NormalizeString", "int", $iForm, "wstr", $sIn, "int", -1, "ptr", 0, "int", 0) Local $tOut = DllStructCreate("wchar[" & $aRet[0] & "]") $aRet = DllCall("Normaliz.dll", "int", "NormalizeString", "int", $iForm, "wstr", $sIn, "int", -1, "ptr", DllStructGetPtr($tOut, 1), "int", $aRet[0]) Return DllStructGetData($tOut, 1) Else SetError(1, 0, $sIn) EndIf EndFunc ;==>_UNF_Change Local $sInput = "Árvíztűrő tükörfúrógép" Local $sFormD = _UNF_Change($sInput, $UNF_NormD) Local $sOutput = StringRegExpReplace($sFormD, "(*UCP)\p{Mn}", "") Display($sInput, $sOutput) Func Display($sInput, $sOutput) ; Format the output. Local $sMsg = StringFormat("Input:\t%s\n\nOutput:\t%s", $sInput, $sOutput) MsgBox($MB_SYSTEMMODAL, "Results", $sMsg) EndFunc ;==>Display Just in case there may be other codepoints having category Mn that you don't want removed, you can restrict removal to just the latin diacritics codepoints range. Replace the regex line by this one: Local $sOutput = StringRegExpReplace($sFormD, "(*UCP)[\x{300}-\x{36F}]", "")
    1 point
  12. Posted new version 0.7 udf and examples in first post
    1 point
  13. #include <Array.au3> #include <EditConstants.au3> #include <File.au3> #include <GUIConstantsEx.au3> #include <GuiEdit.au3> Global $sFileSelectFolder, $aFolderPaths Global $sKeepDir = "00000000000" Global $sIniFile = @ScriptDir & "\Folders.ini" Global $gLogFile = @ScriptDir & "\Deleted.ini" Global $FileLog = FileOpen($gLogFile, 1) Global $aDirList _FileReadToArray($sIniFile, $aDirList, 0) If @error Then Exit MsgBox(0,"Error","Error Reading Path!") $aDirList[0] = UBound($aDirList) - 1 #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form", 590, 419, 268, 226) GUISetBkColor(0xD7D7D2) $Input = GUICtrlCreateInput("", 16, 50, 385, 20) GUICtrlSetState($Input, $GUI_DISABLE) $Fpath = GUICtrlCreateButton("Path Folder", 400, 48, 89, 25) $Fdelte = GUICtrlCreateButton("Folder Delete", 498, 48, 89, 25) $LogView = GUICtrlCreateButton("Log Viewer", 14, 368, 97, 33) $ExitBut = GUICtrlCreateButton("Close", 497, 368, 89, 33) $g_idEdit = GUICtrlCreateEdit("", 17, 75, 568, 290, BitOr($GUI_SS_DEFAULT_EDIT, $ES_READONLY)) _GUICtrlEdit_SetLimitText($g_idEdit, 64000) _GUICtrlEdit_LineScroll($g_idEdit, 0, _GUICtrlEdit_GetLineCount($g_idEdit)) GUICtrlSetColor($g_idEdit, 0x5B0000) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $ExitBut Exit Case $LogView ShellExecute($gLogFile) Case $Fpath $sFileSelectFolder = FileSelectFolder("Select for your Folder-Source!", "::{7be9d83c-a729-4d97-b5a7-1b7313c39e0a}") If @error Then MsgBox(64, "Warning", "No folder was selected.") Back() Else GUICtrlSetData($Input, $sFileSelectFolder) GUICtrlSetState($Input, $GUI_Disable) EndIf Case $Fdelte $sInput = GUICtrlRead($Input) If FileExists($sInput) = 0 Then ContinueLoop MsgBox(4096, "Error", "Unable to find path: " & $sInput) $aFolderPaths = _FileListToArrayRec($sInput, _ArrayToString($aDirList, "*;", 1, -1, "*;", 0, 0) & "*", 2, 0, 0, 2) If @error Then ContinueLoop MsgBox(4096, "Error", "Error: " & _FileListToArrayError(@error)) For $i = 1 To $aFolderPaths[0] If FileExists($aFolderPaths[$i]) Then $aSubFolders = _FileListToArrayRec($aFolderPaths[$i], "*|" & $sKeepDir & "*", 2, 0, 0, 0) If @error Then ContinueLoop For $j = 1 To $aSubFolders[0] If StringLeft($aSubFolders[$j], StringLen($sKeepDir)) = $sKeepDir Then ContinueLoop ;~ Shouldn't exist as it's already filtered out. $_sLogData = "Delete: " & $aFolderPaths[$i] & "\" & $aSubFolders[$j] _GUICtrlEdit_AppendText ($g_idEdit, $_sLogData & @CRLF) DirRemove($aFolderPaths[$i] & "\" & $aSubFolders[$j], 1) Next EndIf Next FileWrite($FileLog, "Username: " & @UserName & @CRLF & "ProcessDate: " & @MON & "/" & @MDAY & "/" & @YEAR & @CRLF & "Time: " & @HOUR & ":" & @MIN & ":" & @SEC & @CRLF & "====================" & @CRLF & GUICtrlRead($g_idEdit) &@CRLF& "===================="& @CRLF) MsgBox(0,"Completed","Done Processing!") Back() EndSwitch WEnd Func Back() Return EndFunc Func _FileListToArrayError($iError) Local $sError Switch $iError Case 1 $sError = "Path not found or invalid" Case 2 $sError = "Invalid Include parameter" Case 3 $sError = "Invalid Exclude parameter" Case 4 $sError = "Invalid Exclude_Folders parameter" Case 5 $sError = "Invalid $iReturn parameter" Case 6 $sError = "Invalid $iRecur parameter" Case 7 $sError = "Invalid $iSort parameter" Case 8 $sError = "Invalid $iReturnPath parameter" Case 9 $sError = "No files/folders found" Case Else $sError = "Unknown" EndSwitch Return $sError EndFunc
    1 point
  14. Using the actual strings to be compared in the export function appears to work even though msdn says the parameters of "StrCmpLogicalW" are pointers to a null-terminated string. ; See 'StrCmpLogicalW' https://msdn.microsoft.com/en-us/library/windows/desktop/bb759947%28v=vs.85%29.aspx #include <array.au3> Local $aFL = ["3string", "2string", "20string", "st3ring", "st2ring", "st20ring", "string3", "string2", "string20"] _ArraySort1D($aFL, 1, 1) ; Sort array ascending, recognise digits in string elements _ArrayDisplay($aFL, "Ascend, Digits") _ArraySort1D($aFL, 1, 0) ; Sort array ascending, recognise all characters as string. _ArrayDisplay($aFL, "Ascend, String Only") ; Sort a one dimensional array ; Default parameters all zero for descending, string only. Func _ArraySort1D(ByRef $aArray, $iAsc = 0, $iDigits = 0) Local $SHLWapi = DllOpen('shlwapi.dll'), $Temp, $Flag = 0 Do $Flag = 0 For $i = 0 To UBound($aArray) - 2 If (($iAsc = 0 And ($aArray[$i] < $aArray[$i + 1]) And $iDigits = 0) Or _ ; Sort strings, descending ($iAsc = 1 And ($aArray[$i] > $aArray[$i + 1]) And $iDigits = 0) Or _ ; Sort strings, ascending ($iAsc = 0 And (DllCall($SHLWapi, 'int', 'StrCmpLogicalW', 'wstr', $aArray[$i], 'wstr', $aArray[$i + 1])[0] = -1) And $iDigits = 1) Or _ ; Sort strings with digits in the strings considered as numerical content rather than text, descending. ($iAsc = 1 And (DllCall($SHLWapi, 'int', 'StrCmpLogicalW', 'wstr', $aArray[$i], 'wstr', $aArray[$i + 1])[0] = 1) And $iDigits = 1)) Then ; Sort strings with digits in the strings considered as numerical content rather than text, ascending. ; Swap routine $Temp = $aArray[$i + 1] $aArray[$i + 1] = $aArray[$i] $aArray[$i] = $Temp $Flag = 1 EndIf Next Until $Flag = 0 DllClose($SHLWapi) EndFunc ;==>_ArraySortiD
    1 point
×
×
  • Create New...