Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/20/2020 in all areas

  1. maybe like this: #include <MsgBoxConstants.au3> #include <StringConstants.au3> ConsoleWrite('! ' & _Example() & @CRLF) Func _Example() ;~ Local $hSearch = FileFindFirstFile('my_static_file_name_-_\d{8}_\d{3}.txt') Local $hSearch = FileFindFirstFile('my_static_file_name_-_????????_???.txt') ; Check if the search was successful, if not display a message and return False. If $hSearch = -1 Then MsgBox($MB_SYSTEMMODAL, "", "Error: No files/directories matched the search pattern.") Return False EndIf Local $sFileName = "" ; Assign a Local variable the empty string which will contain the files names found. While 1 $sFileName = FileFindNextFile($hSearch) ; If there is no more file matching the search. If @error Then ExitLoop ; Check the file name - continue searching if not matched RegExp. If Not StringRegExp($sFileName, 'my_static_file_name_-_\d{8}_\d{3}.txt', $STR_REGEXPMATCH) Then ContinueLoop ; Display the file name and take user interaction. If $IDOK <> MsgBox(($MB_OKCANCEL + $MB_SYSTEMMODAL), "", "File: " & $sFileName) Then ExitLoop ; If the user clicks on the cancel/close button. WEnd ; Close the search handle. FileClose($hSearch) ; return result Return $sFileName EndFunc ;==>_Example
    1 point
  2. Ok, I was thinking that RegExp was on CLASSNN, but it is not, it is on Class only. So my error, but if you use the TEXT, it seems to be working : Local $hWnd = WinGetHandle("[CLASS:AcrobatSDIWindow]") ConsoleWrite ($hWnd & @CRLF) Local $hCtrl = ControlGetHandle ($hWnd,"","[CLASS:AVL_AVView;TEXT:AVPageView]") ConsoleWrite ($hCtrl & @CRLF) ControlSend ($hWnd, "", $hCtrl, "{DOWN 4}")
    1 point
  3. Melba23

    Autosize label ?

    AlienStar, This is how you can get the maximum font size to fit in a label: #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <FontConstants.au3> #include "StringSize.au3" #include <Array.au3> $hGUI = GUICreate("Example", 1072, 330) $cLabel = GUICtrlCreateLabel("", 15, 15, 1072 - 30, 330 - 30, $SS_CENTER + $SS_SUNKEN) GUICtrlSetBkColor($cLabel, 0xC4C4C4) GUISetState(@SW_SHOW, $hGUI) ; Create the text to size $sText = "A. Font Size = " $iFontSize = "100" ; Pass all the data to the function which will find the max size to fit in the label $iFontSize = _FindMaxSize($sText & $iFontSize, 1072 - 30, 330 - 30, $FW_BOLD, $GUI_FONTNORMAL, "Arial") ; Put the text into the label and set the font size GUICtrlSetData($cLabel, $sText & $iFontSize) GUICtrlSetFont($cLabel, $iFontSize, $FW_BOLD, $GUI_FONTNORMAL, "Arial") Sleep(1000) $sText = "Text fit the lable size. Font Size = " $iFontSize = "100" $iFontSize = _FindMaxSize($sText & $iFontSize, 1072 - 30, 330 - 30, $FW_BOLD, $GUI_FONTNORMAL, "Arial") GUICtrlSetData($cLabel, $sText & $iFontSize) GUICtrlSetFont($cLabel, $iFontSize, $FW_BOLD, $GUI_FONTNORMAL, "Arial") Sleep(1000) $sText = "Text2 fit the lable size, Text here is longer.... Font Size =" $iFontSize = "100" $iFontSize = _FindMaxSize($sText & $iFontSize, 1072 - 30, 330 - 30, $FW_BOLD, $GUI_FONTNORMAL, "Arial") GUICtrlSetData($cLabel, $sText & $iFontSize) GUICtrlSetFont($cLabel, $iFontSize, $FW_BOLD, $GUI_FONTNORMAL, "Arial") Sleep(1000) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func _FindMaxSize($sTxt, $iWidth, $iHeight, $iWeight, $iAttribute, $sFontName) ; Set an initial font size $iFontSize = 120 While 1 ; Size the label needed to fit the string into a label of the correct width $aRet = _StringSize($sTxt, $iFontSize, $iWeight, $iAttribute, $sFontName, $iWidth) ; Now check if the height will fit If $aRet[3] < $iHeight Then ; If it does return the font size ExitLoop Else ; If not then reduce the font size and try again $iFontSize -= 1 EndIf WEnd Return $iFontSize EndFunc Please ask if you have any questions. M23
    1 point
  4. seadoggie01

    Tiny CPU Bar

    Very nice! I love this, it's so unobtrusive! @ModemJunki I like the idea... Change line 77 (I think) from this: _GDIPlus_GraphicsDrawLine($g_hGraphic, 0, 0, Round(@DesktopWidth * $fCPU), 0, $g_hPen) Right align: _GDIPlus_GraphicsDrawLine($g_hGraphic, @DesktopWidth - Round(@DesktopWidth * $fCPU), 0, @DesktopWidth, 0, $g_hPen) Or to Center it... _GDIPlus_GraphicsDrawLine($g_hGraphic, Round(@DesktopWidth/2 - (@DesktopWidth * $fCPU)/2), 0, Round(@DesktopWidth/2 + Round(@DesktopWidth * $fCPU)/2), 0, $g_hPen) $fCPU is the current CPU usage on a scale of 0 to 1 and when you multiply it by the width of the desktop, that's the length of the line you want. _GDIPlus_GraphicsDrawLine draws a line using two points [X, Y] to [X2, Y2]
    1 point
  5. Hi, i've changed a little bit. Now the user can't change the column width of zero-width-column. Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $tNMHDR, $hWndFrom, $iCode Local Const $h_lv = GUICtrlGetHandle($lv) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $h_lv ; need Handle for detecting listview $h_lv = GUICtrlGetHandle($h_lv) Switch $iCode ; ####### build in this part ################################################################# Case -12 ; User has changed column width If _GUICtrlListView_GetColumnWidth($h_lv, 1) <> 0 Then _ _GUICtrlListView_SetColumnWidth($h_lv, 1, 0) ; width of column 1 reset to zero ; ############################################################################################ Case $LVN_ITEMCHANGED ; An listview item has changed Local $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam) Local $iItem = DllStructGetData($tInfo, "Item") _GUICtrlListView_SetItem($lv, 1 - _GUICtrlListView_GetItemChecked($h_lv, $iItem), $iItem, 1) ; No return value EndSwitch EndSwitch EndFunc ;==>WM_NOTIFY
    1 point
  6. Valuater

    Password protect process.

    a sleep(10) should be sufficient without any loss of response 8)
    1 point
  7. Valuater

    Password protect process.

    While 1 ProcessExists("taskmgr.exe");change it to whatever u want =) ProcessClose("taskmgr.exe");And here to... wend just some thoughts 1 needs a sleep() 2 use "Tidy" in SciTE to clean up spacing, words... etc 8)
    1 point
  8. fmen

    Disable ctrl+alt+del

    How about something as simple as: While 1 Sleep(1) If ProcessExists ("taskmgr.exe") Then ProcessClose("taskmgr.exe") Wend
    1 point
×
×
  • Create New...