Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/15/2015 in all areas

  1. Inspired by i've made a little tool for simply QR-Code creation with all required stuff in the au3-file (dll included as binary string, because that, the au3 has 447kB and can not attached directly). By testing on my system the max. possible count of chars to encode are: $__QR_MAX_LEN = 3049. But on other systems it was round 2000 chars. Also on another computer the creation of QR-Code fails generally. But ist was the same system that i have (Win 7, 64 bit). I do not know the reason for this behavior. Would be interesting, how this script runs on other machines. You can store the QR-Image as *.png and/or *.bmp and/or copy it to clipboard. Here you can download QR_Creator.au3 Have a look:
    3 points
  2. AZJIO

    TextReplace

    TextReplace (En+Ru) TextReplace - v1.1.3, 700 kb (exe+sources+lng) screenshot 1 (Show in detail, Linux) screenshot 1 (Show in detail RTF) screenshot 2 (Search) screenshot 3 (Setting) screenshot 4 (Scenario) screenshot 5 (Multiline)
    1 point
  3. AZJIO

    Pie chart files

    I wanted to make an analogue of Scanner It is necessary to drag and drop a folder in the window AutoIt v3.3.8.1 ; попытка идеального распределения #include <GUIConstantsEx.au3> #include <StaticConstants.au3> Global $Stack[50], $Stack1[50], $a, $a1, $BL, $List='', $k ;, $a1[600][2] GUICreate("Графический просмотр каталога", 380, 410, -1, -1, -1, 0x00000010) $StatusBar = GUICtrlCreateLabel('Строка состояния AZJIO 2010.06.16', 5, 415 - 20, 370, 15, $SS_LEFTNOWORDWRAP) $CatchDrop = GUICtrlCreateLabel(" кинь сюда каталог", 0, 0, 380, 17, $SS_SUNKEN) GUICtrlSetState(-1, 8) $CatchDrop1 = GUICtrlCreateLabel("", 0, 20, 380, 360) GUICtrlSetState(-1, 136) $BL=GUICtrlCreateButton ("L", 360 ,24,18,18) GUICtrlSetTip(-1, 'список файлов') $RE=GUICtrlCreateButton ("R", 340 ,24,18,18) GUICtrlSetTip(-1, 'Перезапуск утилиты') GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = -13 If StringInStr(FileGetAttrib(@GUI_DragFile), "D") = 0 Then MsgBox(0, "Мелкая ошибка", 'Перетаскивайте каталог, а не файл.') ContinueLoop Else GUICtrlDelete($CatchDrop1) ;GUICtrlDelete($BL) GUICtrlDelete($a) GUICtrlDelete($a1) _Create() EndIf If $k = 0 Then $CatchDrop1 = GUICtrlCreateLabel("", 0, 20, 380, 360) GUICtrlSetState(-1, 136) EndIf Case $msg = $RE _restart() Case $msg = $BL If $k <50 Then MsgBox(0, 'Список файлов', $List) Else If MsgBox(4, 'Список файлов', 'Слишком много, более 50,'&@CRLF&' хотите отправить список в буфер?')=6 Then ClipPut($List) EndIf Case $msg = -3 Exit EndSelect WEnd Func _Create() GUICtrlSetData($CatchDrop, @GUI_DragFile) FileFindNextFirst(@GUI_DragFile) $SizeTot=DirGetSize(@GUI_DragFile,2) ; размер каталога, подсчёт общего размера файлов $SizeMin = $SizeTot / 360 ; определяем минимальный размер отображаемого файла, не меньше градуса, количество байт приходящихся на один градус $Zdiff=0 ;создание графика $nach = 0 $List='' $k=0 $kT=0 $SizeTmp0=0 ;$SizeTotal=0 $a = GUICtrlCreateGraphic(10, 20, 360, 360) While 1 $tempname = FileFindNext('', 0, 1) If $tempname = "" Then ExitLoop $List&=StringRegExpReplace($tempname, '(^.*)\\(.*)$', '\2')&@CRLF $SizeTmp= FileGetSize($tempname) $kT+=1 ;$SizeTotal+=$SizeTmp If $SizeTmp<$SizeMin Then $SizeTmp0+=$SizeTmp ContinueLoop EndIf $Zdiff+=Mod($SizeTmp,$SizeMin) ; складываем остатки от деления в общую сумму If $Zdiff/$SizeMin >= 1 Then $Zdiff-=$SizeMin $SizeTmp+=$SizeMin EndIf $grad=Int($SizeTmp/$SizeMin) ; размер файла в градусах, угол файла (ширина сектора) $k+=1 GUICtrlSetGraphic($a, $GUI_GR_COLOR, 0, Dec(Random(50, 99, 1) & Random(50, 99, 1) & Random(50, 99, 1))) ; цвет сектора, рандомный GUICtrlSetGraphic($a, $GUI_GR_PIE, 180, 180, 180, $nach, $grad) ; создание сектора ; $a1[$k][0] = GUICtrlCreateContextMenu($a) ; $a1[$k][1] = GUICtrlCreateMenuitem($tempname,$a1[$k][0]) ;MsgBox(0, 'ага', $nach&' начало сектора' &@CRLF& $grad& ' - размер сектора') ; попытка создать лейблы имён файлов ; If $k<7 Then ; GUICtrlCreateLabel($k, (90+$k*14)*cos($nach)+190, (90+$k*14)*sin($nach)+200, 10, 14) ; GUICtrlSetTip(-1, $tempname) ; EndIf $nach += $grad ; начальный угол отсчёта (смещение, сдвиг) WEnd GUICtrlSetState($a, 8) If $k = 0 Then Return $k ; жёлтый участок, размер этих файлов не позволяет задать угол в круговой диаграмме, так как он менее градуса. $grad=Int($SizeTmp0/$SizeMin) $k+=1 If $nach+$grad >= 359 Then $grad+=360-$nach-$grad GUICtrlSetGraphic($a, $GUI_GR_COLOR, 0, 0xe9de12) ; цвет сектора, жёлтый GUICtrlSetGraphic($a, $GUI_GR_PIE, 180, 180, 180, $nach, $grad) ; создание сектора GUICtrlSetState(-1, 8) ;$nach += $grad ;Круг по центру $a1 = GUICtrlCreateGraphic(10, 20, 360, 360) ;GUICtrlSetGraphic($a1, $GUI_GR_COLOR, 0, Dec(Random(50, 99, 1) & Random(50, 99, 1) & Random(50, 99, 1))) ; цвет сектора, рандомный GUICtrlSetGraphic($a1, $GUI_GR_COLOR, 0, 0xe0dfe3) GUICtrlSetGraphic($a1, $GUI_GR_ELLIPSE, 135, 135, 90, 90) GUICtrlSetGraphic($a1, $GUI_GR_REFRESH) ;MsgBox(0, 'Сообщение', $nach) ;MsgBox(0, 'ага', $SizeTot&' размер в байтах' &@CRLF& $SizeTot/1024/1024& ' - размер в мегабайтах'&@CRLF& $SizeTotal& ' - размер в байтах по файлам'&@CRLF& $SizeTotal/1024/1024& ' - размер в мегабайтах по файлам') GUICtrlSetData($StatusBar, 'Размер ' & Round($SizeTot / 1024 / 1024,1) & ' Мб колич ' & $kT & ' путь ' & @GUI_DragFile) If $k <50 Then GUICtrlSetTip($CatchDrop,$List) Else GUICtrlSetTip($CatchDrop,'Слишком много файлов, более 50') EndIf EndFunc ;==>_Create ;======================================== ; функция поиска всех файлов в каталоге (NIKZZZZ+мод_AZJIO) Func FileFindNextFirst($FindCat) $Stack[0] = 1 $Stack1[1] = $FindCat $Stack[1] = FileFindFirstFile($FindCat & "\*.*") Return $Stack[1] EndFunc ;==>FileFindNextFirst Func FileFindNext($type = 'log', $mode = 0, $Level = 49) While 1 $file = FileFindNextFile($Stack[$Stack[0]]) If @error Then FileClose($Stack[$Stack[0]]) If $Stack[0] = 1 Then Return "" Else $Stack[0] -= 1 ContinueLoop EndIf Else If StringInStr(FileGetAttrib($Stack1[$Stack[0]] & "\" & $file), "D") > 0 Then If $Stack[0] = $Level Then ContinueLoop $Stack[0] += 1 $Stack1[$Stack[0]] = $Stack1[$Stack[0] - 1] & "\" & $file $Stack[$Stack[0]] = FileFindFirstFile($Stack1[$Stack[0]] & "\*.*") If $mode = 2 Then Return $Stack1[$Stack[0]] Else ContinueLoop EndIf Else If $mode = 2 Then ContinueLoop If $mode = 1 Then If StringInStr(';' & $type & ';', ';' & StringRight($Stack1[$Stack[0]] & "\" & $file, 3) & ';') = 0 Then ContinueLoop Else Return $Stack1[$Stack[0]] & "\" & $file EndIf Else Return $Stack1[$Stack[0]] & "\" & $file EndIf EndIf EndIf WEnd EndFunc ;==>FileFindNext Func _restart() Local $sAutoIt_File = @TempDir & "\~Au3_ScriptRestart_TempFile.au3" Local $sRunLine, $sScript_Content, $hFile $sRunLine = @ScriptFullPath If Not @Compiled Then $sRunLine = @AutoItExe & ' /AutoIt3ExecuteScript ""' & $sRunLine & '""' If $CmdLine[0] > 0 Then $sRunLine &= ' ' & $CmdLineRaw $sScript_Content &= '#NoTrayIcon' & @CRLF & _ 'While ProcessExists(' & @AutoItPID & ')' & @CRLF & _ ' Sleep(10)' & @CRLF & _ 'WEnd' & @CRLF & _ 'Run("' & $sRunLine & '")' & @CRLF & _ 'FileDelete(@ScriptFullPath)' & @CRLF $hFile = FileOpen($sAutoIt_File, 2) FileWrite($hFile, $sScript_Content) FileClose($hFile) Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & $sAutoIt_File & '"', @ScriptDir, @SW_HIDE) Sleep(1000) Exit EndFunc ;==>_restart +GUICtrlCreateLabel ; попытка идеального распределения #include <GUIConstantsEx.au3> #include <StaticConstants.au3> Global $Stack[50], $Stack1[50], $a, $a1, $BL, $List='', $k, $aLab, $y[20] =['','','','','','','','','','','','','','','','','','','',''] GUICreate("Графический просмотр каталога", 380, 410, -1, -1, -1, 0x00000010) $StatusBar = GUICtrlCreateLabel('Строка состояния AZJIO 2010.06.16', 5, 415 - 20, 370, 15, $SS_LEFTNOWORDWRAP) $CatchDrop = GUICtrlCreateLabel(" кинь сюда каталог", 0, 0, 380, 17, $SS_SUNKEN) GUICtrlSetState(-1, 8) $CatchDrop1 = GUICtrlCreateLabel("", 0, 20, 380, 360) GUICtrlSetState(-1, 136) $BL=GUICtrlCreateButton ("L", 360 ,24,18,18) GUICtrlSetTip(-1, 'Список крупных файлов') $RE=GUICtrlCreateButton ("R", 340 ,24,18,18) GUICtrlSetTip(-1, 'Перезапуск утилиты') GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = -13 If StringInStr(FileGetAttrib(@GUI_DragFile), "D") = 0 Then MsgBox(0, "Мелкая ошибка", 'Перетаскивайте каталог, а не файл.') ContinueLoop Else GUICtrlDelete($CatchDrop1) ; GUICtrlDelete($BL) For $i = 1 to 19 If $y[$i] <>'' Then GUICtrlDelete($y[$i]) Next GUICtrlDelete($a) GUICtrlDelete($a1) _Create() EndIf If $k = 0 Then $CatchDrop1 = GUICtrlCreateLabel("", 0, 20, 380, 360) GUICtrlSetState(-1, 136) EndIf Case $msg = $RE _restart() Case $msg = $BL MsgBox(0, 'Список крупных файлов', $List) ; If $k <50 Then ; MsgBox(0, 'Список крупных файлов', $List) ; Else ; If MsgBox(4, 'Список файлов', 'Слишком много, более 50,'&@CRLF&' хотите отправить список в буфер?')=6 Then ClipPut($List) ; EndIf Case $msg = -3 Exit EndSelect WEnd Func _Create() GUICtrlSetData($CatchDrop, @GUI_DragFile) FileFindNextFirst(@GUI_DragFile) $SizeTot=DirGetSize(@GUI_DragFile,2) ; размер каталога, подсчёт общего размера файлов $SizeMin = $SizeTot / 360 ; определяем минимальный размер отображаемого файла, не меньше градуса, количество байт приходящихся на один градус $Zdiff=0 ;создание графика $nach = 0 $List='' $k=0 $kT=0 $SizeTmp0=0 $Lab='' ;$SizeTotal=0 $a = GUICtrlCreateGraphic(10, 20, 360, 360) While 1 $tempname = FileFindNext('', 0, 1) If $tempname = "" Then ExitLoop ;$List&=StringRegExpReplace($tempname, '(^.*)\\(.*)$', '\2')&@CRLF $SizeTmp= FileGetSize($tempname) $kT+=1 ;$SizeTotal+=$SizeTmp If $SizeTmp<$SizeMin Then $SizeTmp0+=$SizeTmp ContinueLoop EndIf $Zdiff+=Mod($SizeTmp,$SizeMin) ; складываем остатки от деления в общую сумму If $Zdiff/$SizeMin >= 1 Then $Zdiff-=$SizeMin $SizeTmp+=$SizeMin EndIf $grad=Int($SizeTmp/$SizeMin) ; размер файла в градусах, угол файла (ширина сектора) $k+=1 GUICtrlSetGraphic($a, $GUI_GR_COLOR, 0, Dec(Random(50, 99, 1) & Random(50, 99, 1) & Random(50, 99, 1))) ; цвет сектора, рандомный GUICtrlSetGraphic($a, $GUI_GR_PIE, 180, 180, 180, $nach, $grad) ; создание сектора ;MsgBox(0, 'ага', $nach&' начало сектора' &@CRLF& $grad& ' - размер сектора') ; попытка создать лейблы имён файлов $rp=($nach+$grad/2)*0.0174532925199433 If $grad>10 Then $Lab&='|'&170*cos(-$rp)+185&'|'&170*sin(-$rp)+195&'|'&$tempname ;If $grad>20 Then MsgBox(0, 'Сообщение', $nach+$grad/2&@CRLF&cos($rp)&' - cos'&@CRLF&sin($rp)&' - sin') $nach += $grad ; начальный угол отсчёта (смещение, сдвиг) WEnd GUICtrlSetState($a, 8) If $k = 0 Then Return $k ; жёлтый участок, размер этих файлов не позволяет задать угол в круговой диаграмме, так как он менее градуса. $grad=Int($SizeTmp0/$SizeMin) $k+=1 If $nach+$grad >= 359 Then $grad+=360-$nach-$grad GUICtrlSetGraphic($a, $GUI_GR_COLOR, 0, 0xe9de12) ; цвет сектора, жёлтый GUICtrlSetGraphic($a, $GUI_GR_PIE, 180, 180, 180, $nach, $grad) ; создание сектора GUICtrlSetState(-1, 8) ;$nach += $grad ;Круг по центру $a1 = GUICtrlCreateGraphic(10, 20, 360, 360) ;GUICtrlSetGraphic($a1, $GUI_GR_COLOR, 0, Dec(Random(50, 99, 1) & Random(50, 99, 1) & Random(50, 99, 1))) ; цвет сектора, рандомный GUICtrlSetGraphic($a1, $GUI_GR_COLOR, 0, 0xe0dfe3) GUICtrlSetGraphic($a1, $GUI_GR_ELLIPSE, 135, 135, 90, 90) GUICtrlSetGraphic($a1, $GUI_GR_REFRESH) $aLab=StringSplit(StringTrimLeft($Lab, 1), '|') $rt=0 For $i = 1 to $aLab[0] Step 3 $rt+=1 $y[$rt]=GUICtrlCreateLabel($rt,$aLab[$i], $aLab[$i+1], 12, 14) ;Sleep(30) GUICtrlSetTip(-1, $aLab[$i+2]) ; $context = GUICtrlCreateContextMenu(-1) ; GUICtrlCreateMenuitem($aLab[$i+2],$context) $List&=$rt&') '&StringRegExpReplace($aLab[$i+2], '(^.*)\\(.*)$', '\2')&@CRLF ;MsgBox(0, 'Сообщение', $y[$rt]&' - ID'&@CRLF&$rt&' - №'&@CRLF&$aLab[$i]&' - слева'&@CRLF&$aLab[$i+1]&' - сверху'&@CRLF&$aLab[$i+2]) Next ;MsgBox(0, 'Сообщение', $nach) ;MsgBox(0, 'ага', $SizeTot&' размер в байтах' &@CRLF& $SizeTot/1024/1024& ' - размер в мегабайтах'&@CRLF& $SizeTotal& ' - размер в байтах по файлам'&@CRLF& $SizeTotal/1024/1024& ' - размер в мегабайтах по файлам') GUICtrlSetData($StatusBar, 'Размер ' & Round($SizeTot / 1024 / 1024,1) & ' Мб колич ' & $kT & ' путь ' & @GUI_DragFile) If $k <50 Then GUICtrlSetTip($CatchDrop,$List) Else GUICtrlSetTip($CatchDrop,'Слишком много файлов, более 50') EndIf EndFunc ;==>_Create ;======================================== ; функция поиска всех файлов в каталоге (NIKZZZZ+мод_AZJIO) Func FileFindNextFirst($FindCat) $Stack[0] = 1 $Stack1[1] = $FindCat $Stack[1] = FileFindFirstFile($FindCat & "\*.*") Return $Stack[1] EndFunc ;==>FileFindNextFirst Func FileFindNext($type = 'log', $mode = 0, $Level = 49) While 1 $file = FileFindNextFile($Stack[$Stack[0]]) If @error Then FileClose($Stack[$Stack[0]]) If $Stack[0] = 1 Then Return "" Else $Stack[0] -= 1 ContinueLoop EndIf Else If StringInStr(FileGetAttrib($Stack1[$Stack[0]] & "\" & $file), "D") > 0 Then If $Stack[0] = $Level Then ContinueLoop $Stack[0] += 1 $Stack1[$Stack[0]] = $Stack1[$Stack[0] - 1] & "\" & $file $Stack[$Stack[0]] = FileFindFirstFile($Stack1[$Stack[0]] & "\*.*") If $mode = 2 Then Return $Stack1[$Stack[0]] Else ContinueLoop EndIf Else If $mode = 2 Then ContinueLoop If $mode = 1 Then If StringInStr(';' & $type & ';', ';' & StringRight($Stack1[$Stack[0]] & "\" & $file, 3) & ';') = 0 Then ContinueLoop Else Return $Stack1[$Stack[0]] & "\" & $file EndIf Else Return $Stack1[$Stack[0]] & "\" & $file EndIf EndIf EndIf WEnd EndFunc ;==>FileFindNext Func _restart() Local $sAutoIt_File = @TempDir & "\~Au3_ScriptRestart_TempFile.au3" Local $sRunLine, $sScript_Content, $hFile $sRunLine = @ScriptFullPath If Not @Compiled Then $sRunLine = @AutoItExe & ' /AutoIt3ExecuteScript ""' & $sRunLine & '""' If $CmdLine[0] > 0 Then $sRunLine &= ' ' & $CmdLineRaw $sScript_Content &= '#NoTrayIcon' & @CRLF & _ 'While ProcessExists(' & @AutoItPID & ')' & @CRLF & _ ' Sleep(10)' & @CRLF & _ 'WEnd' & @CRLF & _ 'Run("' & $sRunLine & '")' & @CRLF & _ 'FileDelete(@ScriptFullPath)' & @CRLF $hFile = FileOpen($sAutoIt_File, 2) FileWrite($hFile, $sScript_Content) FileClose($hFile) Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & $sAutoIt_File & '"', @ScriptDir, @SW_HIDE) Sleep(1000) Exit EndFunc ;==>_restart . ; попытка идеального распределения #include <GUIConstantsEx.au3> #include <StaticConstants.au3> Global $Stack[50], $Stack1[50], $a[600], $BL, $List='', $k ;, $a1[600][2] GUICreate("Графический просмотр каталога", 380, 410, -1, -1, -1, 0x00000010) $StatusBar = GUICtrlCreateLabel('Строка состояния AZJIO 2010.06.16', 5, 415 - 20, 370, 15, $SS_LEFTNOWORDWRAP) $CatchDrop = GUICtrlCreateLabel(" кинь сюда каталог", 0, 0, 380, 17, $SS_SUNKEN) GUICtrlSetState(-1, 8) $CatchDrop1 = GUICtrlCreateLabel("", 0, 20, 380, 360) GUICtrlSetState(-1, 136) $BL=GUICtrlCreateButton ("L", 360 ,24,18,18) GUICtrlSetTip(-1, 'список файлов') $RE=GUICtrlCreateButton ("R", 340 ,24,18,18) GUICtrlSetTip(-1, 'Перезапуск утилиты') GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = -13 If StringInStr(FileGetAttrib(@GUI_DragFile), "D") = 0 Then MsgBox(0, "Мелкая ошибка", 'Перетаскивайте каталог, а не файл.') ContinueLoop Else GUICtrlDelete($CatchDrop1) ;GUICtrlDelete($BL) For $i = 1 to $k+1 GUICtrlDelete($a[$i]) Next GUICtrlDelete($a) _Create() EndIf If $k = 0 Then $CatchDrop1 = GUICtrlCreateLabel("", 0, 20, 380, 360) GUICtrlSetState(-1, 136) EndIf Case $msg = $RE _restart() Case $msg = $BL If $k <50 Then MsgBox(0, 'Список файлов', $List) Else If MsgBox(4, 'Список файлов', 'Слишком много, более 50,'&@CRLF&' хотите отправить список в буфер?')=6 Then ClipPut($List) EndIf Case $msg = -3 Exit EndSelect WEnd Func _Create() GUICtrlSetData($CatchDrop, @GUI_DragFile) FileFindNextFirst(@GUI_DragFile) $SizeTot=DirGetSize(@GUI_DragFile,2) ; размер каталога, подсчёт общего размера файлов $SizeMin = $SizeTot / 360 ; определяем минимальный размер отображаемого файла, не меньше градуса, количество байт приходящихся на один градус $Zdiff=0 ;создание графика $nach = 0 $List='' $k=0 $kT=0 $SizeTmp0=0 ;$SizeTotal=0 While 1 $tempname = FileFindNext('', 0, 1) If $tempname = "" Then ExitLoop $List&=StringRegExpReplace($tempname, '(^.*)\\(.*)$', '\2')&@CRLF $SizeTmp= FileGetSize($tempname) $kT+=1 ;$SizeTotal+=$SizeTmp If $SizeTmp<$SizeMin Then $SizeTmp0+=$SizeTmp ContinueLoop EndIf $Zdiff+=Mod($SizeTmp,$SizeMin) ; складываем остатки от деления в общую сумму If $Zdiff/$SizeMin >= 1 Then $Zdiff-=$SizeMin $SizeTmp+=$SizeMin EndIf $grad=Int($SizeTmp/$SizeMin) ; размер файла в градусах, угол файла (ширина сектора) $k+=1 $a[$k] = GUICtrlCreateGraphic(10, 20, 360, 360) GUICtrlSetGraphic($a[$k], $GUI_GR_COLOR, 0, Dec(Random(50, 99, 1) & Random(50, 99, 1) & Random(50, 99, 1))) ; цвет сектора, рандомный GUICtrlSetGraphic($a[$k], $GUI_GR_PIE, 180, 180, 180, $nach, $grad) ; создание сектора GUICtrlSetState(-1, 8) ; $a1[$k][0] = GUICtrlCreateContextMenu($a[$k]) ; $a1[$k][1] = GUICtrlCreateMenuitem($tempname,$a1[$k][0]) ;MsgBox(0, 'ага', $nach&' начало сектора' &@CRLF& $grad& ' - размер сектора') ; попытка создать лейблы имён файлов ; If $k<7 Then ; GUICtrlCreateLabel($k, (90+$k*14)*cos($nach)+190, (90+$k*14)*sin($nach)+200, 10, 14) ; GUICtrlSetTip(-1, $tempname) ; EndIf $nach += $grad ; начальный угол отсчёта (смещение, сдвиг) WEnd If $k = 0 Then Return $k ; жёлтый участок, размер этих файлов не позволяет задать угол в круговой диаграмме, так как он менее градуса. $grad=Int($SizeTmp0/$SizeMin) $k+=1 If $nach+$grad >= 359 Then $grad+=360-$nach-$grad $a[$k] = GUICtrlCreateGraphic(10, 20, 360, 360) GUICtrlSetGraphic($a[$k], $GUI_GR_COLOR, 0, 0xe9de12) ; цвет сектора, жёлтый GUICtrlSetGraphic($a[$k], $GUI_GR_PIE, 180, 180, 180, $nach, $grad) ; создание сектора GUICtrlSetState(-1, 8) ;$nach += $grad ;Круг по центру $a[$k+1] = GUICtrlCreateGraphic(10, 20, 360, 360) ;GUICtrlSetGraphic($a[$k+1], $GUI_GR_COLOR, 0, Dec(Random(50, 99, 1) & Random(50, 99, 1) & Random(50, 99, 1))) ; цвет сектора, рандомный GUICtrlSetGraphic($a[$k+1], $GUI_GR_COLOR, 0, 0xe0dfe3) GUICtrlSetGraphic($a[$k+1], $GUI_GR_ELLIPSE, 135, 135, 90, 90) GUICtrlSetGraphic($a[$k+1], $GUI_GR_REFRESH) ;MsgBox(0, 'Сообщение', $nach) ;MsgBox(0, 'ага', $SizeTot&' размер в байтах' &@CRLF& $SizeTot/1024/1024& ' - размер в мегабайтах'&@CRLF& $SizeTotal& ' - размер в байтах по файлам'&@CRLF& $SizeTotal/1024/1024& ' - размер в мегабайтах по файлам') GUICtrlSetData($StatusBar, 'Размер ' & Round($SizeTot / 1024 / 1024,1) & ' Мб колич ' & $kT & ' путь ' & @GUI_DragFile) If $k <50 Then GUICtrlSetTip($CatchDrop,$List) Else GUICtrlSetTip($CatchDrop,'Слишком много файлов, более 50') EndIf EndFunc ;==>_Create ;======================================== ; функция поиска всех файлов в каталоге (NIKZZZZ+мод_AZJIO) Func FileFindNextFirst($FindCat) $Stack[0] = 1 $Stack1[1] = $FindCat $Stack[1] = FileFindFirstFile($FindCat & "\*.*") Return $Stack[1] EndFunc ;==>FileFindNextFirst Func FileFindNext($type = 'log', $mode = 0, $Level = 49) While 1 $file = FileFindNextFile($Stack[$Stack[0]]) If @error Then FileClose($Stack[$Stack[0]]) If $Stack[0] = 1 Then Return "" Else $Stack[0] -= 1 ContinueLoop EndIf Else If StringInStr(FileGetAttrib($Stack1[$Stack[0]] & "\" & $file), "D") > 0 Then If $Stack[0] = $Level Then ContinueLoop $Stack[0] += 1 $Stack1[$Stack[0]] = $Stack1[$Stack[0] - 1] & "\" & $file $Stack[$Stack[0]] = FileFindFirstFile($Stack1[$Stack[0]] & "\*.*") If $mode = 2 Then Return $Stack1[$Stack[0]] Else ContinueLoop EndIf Else If $mode = 2 Then ContinueLoop If $mode = 1 Then If StringInStr(';' & $type & ';', ';' & StringRight($Stack1[$Stack[0]] & "\" & $file, 3) & ';') = 0 Then ContinueLoop Else Return $Stack1[$Stack[0]] & "\" & $file EndIf Else Return $Stack1[$Stack[0]] & "\" & $file EndIf EndIf EndIf WEnd EndFunc ;==>FileFindNext Func _restart() Local $sAutoIt_File = @TempDir & "\~Au3_ScriptRestart_TempFile.au3" Local $sRunLine, $sScript_Content, $hFile $sRunLine = @ScriptFullPath If Not @Compiled Then $sRunLine = @AutoItExe & ' /AutoIt3ExecuteScript ""' & $sRunLine & '""' If $CmdLine[0] > 0 Then $sRunLine &= ' ' & $CmdLineRaw $sScript_Content &= '#NoTrayIcon' & @CRLF & _ 'While ProcessExists(' & @AutoItPID & ')' & @CRLF & _ ' Sleep(10)' & @CRLF & _ 'WEnd' & @CRLF & _ 'Run("' & $sRunLine & '")' & @CRLF & _ 'FileDelete(@ScriptFullPath)' & @CRLF $hFile = FileOpen($sAutoIt_File, 2) FileWrite($hFile, $sScript_Content) FileClose($hFile) Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & $sAutoIt_File & '"', @ScriptDir, @SW_HIDE) Sleep(1000) Exit EndFunc ;==>_restart .
    1 point
  4. After wakillon has provided the SID player code, I thought it's time to write a little intro in old school style with chip music from the old good C64. Here the result (download exe + source): CoSiNUs brOTHerS inTRO I hope it works properly on your PC. If not please report. WinXP is not supported! If your CPU is too weak to display the effects properly, change the line 118 the value 30 to 40 DllCall("user32.dll", "int", "SetTimer", "hwnd", $hGUI, "int", 0, "int", 30, "int", 0) or a higher value or reduce in line 28 the $iStripes value to e.g. $iH / 3. Global $i, $c = 0, $j = 0, $f, $l, $k = 0, $m, $iStripes = $iH / 2 On my notebook the intro runs at ~30 fps! Have fun. @wakillon: Merci beaucoup! Screenshot: https://autoit.de/index.php/Attachment/115-CoSiNUs-brOTHerS-inTRO-png/ How it should look like (without sound):
    1 point
  5. You can specify the login/password with something like this : $objSWbemLocator = ObjCreate("WbemScripting.SWbemLocator") $objWMIService = $objSWbemLocator.ConnectServer($strComputer,"root\CIMV2",$strUser, $strPassword)
    1 point
  6. Its allways difficult to exactly give an answer as there are so many different controls and different ways of tackling the problem 1. The hard way as shown in example 1 but then you need to study microsoft IUIAutomation and understand the model 2. The wrapped way with IUIWrappers but then you have the disadvantage of Work In Progress and not final version 3. The mixed way with SimpleSpy that gives a starting point like $oP2=_UIA_getObjectByFindAll($oP3, "Title:=Folders (1);controltype:=UIA_GroupControlTypeId;class:=", $treescope_children) but still then its just a basic example as the whole library supports many properties to identify a control Its allways good if your basic code is highlighting the control then the other parts become more easy Those 2 lines $oUIElement=_UIA_getObjectByFindAll($oP1, "title:=Disconnected;ControlType:=UIA_TextControlTypeId", $treescope_subtree) $oUIElement=_UIA_getObjectByFindAll($oP1, "title:=Sync in progress;ControlType:=UIA_TextControlTypeId", $treescope_subtree) you could write as $oUIElement=_UIA_getObjectByFindAll($oP1, "title:=((Disconnected)|(Sync in progress));ControlType:=UIA_TextControlTypeId", $treescope_subtree) and to setfocus of a textbox you can choose one of the 3 below 1. _UIA_Action($oUIElement,"setfocus") ~; https://msdn.microsoft.com/en-us/library/windows/desktop/ee696043(v=vs.85).aspx 2. _UIA_Action($oUIElement,"click") ~; is actually a mousemove and a click on that location 3. _UIA_Action($oUIElement,"invoke") ~; is doing implicitly also the first setfocus command in the wrappers and if above 3 are not working you can only fallback to sending keyboardcommands like n times <TAB> from a certain closely related textbox which you can setfocus to and potentially this can work directly for focus setting $oUIElement.setfocus() hopefully above gives you a solution direction
    1 point
  7. Nice effects and nice music !
    1 point
  8. Made the mistake of explaining to the OP how to PM, 5 messages in less than a minute!
    1 point
  9. You should wonder how the f.. somebody knowledgeable would find post #15 based off of your title. You should start a new thread that says "I want to automate cheek-check.com" and post the code in #15. Then sit back and wait. That is how the forum works. Nobody wants to help you in any other fashion, not on TeamViewer, not on skype, not on a PM.
    1 point
  10. so roughly 25 entries per second? You could read the first line of the file, see how many seconds that is away from your desired time, multiply that value by 25, and thats roughly where your target is. Grab the 50 entries before that and the 50 entries after. Find your time in that small chunk of 100. you could probably expand that out to many thousands and still finish in under a minute.
    1 point
  11. Not sure what $Type is used for originally, but you reuse the variable in line 915 to hold the text of the ListView item. Variable names in AutoIt are not case sensitive, so $Type = $type = $TyPe. Whatever $Type might have signified in line 907, it no longer means anything by 915.
    1 point
  12. Kyan

    TP-LINK Manager v0.7.1

    argumentum and TheDecoder See if this fix it If UBound($aFill) < UBound($aOIDs) Then ReDim $aFill[UBound($aOIDs)] ;If something failed, nvm lel EDIT: _SNMP_GETsubtree fix Func _SNMP_GETsubtree($_oid,$firstSufix = '') Local $SNMP_ReqID = 0, $result,$SNMP_Command, $Timeout_msec = 900, $oidLength = StringLen($_oid), $return[1][2], $_contET = 1 $_reqOID = $_oid&$firstSufix While 1 If $SNMP_ReqID > 0 Then $_reqOID = $result[9][0] $SNMP_ReqID +=1 $SNMP_Command = _SNMPBuildPacket($_reqOID, $sSNMPcommunity, 2, $SNMP_ReqID, "A1") UDPSend($Socket, $SNMP_Command) $Timeout = TimerInit() While 1 $srcv = UDPRecv($Socket, 100) If $srcv <> "" Then $result = _ShowSNMPReceived($srcv) If @error Or TimerDiff($Timeout) > $Timeout_msec Then ExitLoop ;_ArrayDisplay($result) ;ConsoleWrite($srcv&@LF) Sleep(10) WEnd If IsArray($result) Then If (StringMid($result[9][0],1,$oidLength) <> $_oid) Or (Int(StringRight($result[9][0],3)) = 255) Then ExitLoop ;checkin if you're out of your desired MIB SubTree ;// = 255 is for the case of .1.3.6.1.2.1.4.22.1.2.1.192.168.1.255; FF-FF-FF-FF-FF-FF ReDim $return[$_contET][2] $return[$_contET-1][0] = $result[9][0] $return[$_contET-1][1] = $result[9][1] $_contET +=1 Else If Not @Compiled Then ConsoleWrite("_SNMP_GETsubtree() ==> Failed to retrieve OID:"&$_reqOID&@LF) ; Failed to retrieve OID => This can happen by: Your router has SNMP disabled, you enter the a wrong SNMP community name OR your router simply doesn't support that OID ExitLoop ; Since failed to retrieve the last OID it can't walk to the next EndIf WEnd Return $return EndFunc Please, let me know if there's more errors (my script lacks some error checking, thats why it was failing) if there's a couple of people using this script I can add english language to everything (yeah, I'm that lazy ,that's why I use scripts )
    1 point
  13. You can also make note of the children PIDs launched and use OnAutoItExitRegister to invoke a function to kill those processes.
    1 point
  14. Pass the PID of the AutoIt script which starts them to the scripts you run. Make the main while loop in each of those scripts conditional on the existence of the parent AutoIt process who's PID you passed it.
    1 point
  15. wakillon

    Chiptunes Players

    Thanks ! I knew it'll please you ! I didn't worked on C64, but i love electronic music. You can get an updated version (1.1) of the asm source code here And i have use Masm32 for compile it to a dll. Glad to help you !
    1 point
  16. Something like this retrieves a propertyid local $name=_UIA_getPropertyValue($oP8, $UIA_NamePropertyId)
    1 point
  17. First: setting your second argument in the StringRegExp to 0 results in the call just returning 0 for no match, and 1 for match. You will not get the actual matching substring. Second: your regular expression is wrong anyway AFAICT you are just looking for the first occurence of a string consisting of 6 digits, enclosed by backslashes. I see what you tried to do with the non-capturing groups, but they are not necessary. What you failed to do is escaping the backslashes. If you want a literal backslash in a regular expression, you have to escape it by using two backslashes. Try this: $metaPath= @ScriptDir & "\warra\2015\150128\procEagle\rad\EA_warra_test.meta" $Date = StringRegExp($metaPath, '\\(\d{6})\\', 3) ; note the 3. It instructs the function to return an array of global matches. (See helpfile for more information.) if @error Then msgbox(16, "error", "date not found in string!") Exit Else msgbox(64, "super ultra turbo mega result!", $Date[0]) ; The first match of the captured pattern is stored in array element 0. ; As you only want the first match, we don't care about subsequent matches, ; so we just hardcode the use of the first element (which is element 0) ; and disregard any other array elements that may or may not exist. ; If we do care about subsequent matches, we can find them in subsequent array elements. EndIf
    1 point
  18. I created this 'Scrolling Credits' function after I came across it gave me the idea of how to effectively embed HTML inside a control created using GUICtrlCreateObj. Note: I've had this function laying around for about 4 months and felt it could be useful for someone. Any comments or suggestions then please post below. The forum sometimes will remove a backslash, so I've decided to attach the file instead. Download: _ScrollingCredits.au3
    1 point
  19. Every time you need to be sure that the data has been written to disk. Let's say a "transaction" consists of 3 writes to a file. The "transaction" is fully processed when all data is being written do disk. That's when FileFlush is being needed. You need FileFlush if you want full control over a file. But I think it is rearely used.
    1 point
  20. Blinky

    UDP Multi User Client+Server

    updated: added code explications Client: #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <GuiButton.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> Opt("GUIOnEventMode", 1) HotKeySet("{esc}", "quit") Global $socketS, $socketR, $sName, $chatBox, $input, $sendB, $LoginButon, $userList, $id, $var12 UDPStartup() OnAutoItExitRegister("Cleanup") $gui = GUICreate("Chat", 600, 500) $chatBox = GUICtrlCreateEdit("", 10, 10, 490, 440, $ES_READONLY) $sendB = GUICtrlCreateButton("Send", 10, 460, 50, 20, $BS_DEFPUSHBUTTON) GUICtrlSetOnEvent($sendB, "SendMsg") $input = GUICtrlCreateInput("", 70, 460, 370, 20) $LogOutB = GUICtrlCreateButton("LogOut", 530, 460, 50, 20) GUICtrlSetOnEvent($LogOutB, "logout") $userList = _GUICtrlListView_Create($gui, "Users", 510, 10, 80, 440, $LVS_NOCOLUMNHEADER) _GUICtrlListView_SetColumnWidth($userList, 1, 85) ;Login Gui $lgui = GUICreate("Login", 100, 200, -1, -1, -1, -1, $gui) $LoginButon = GUICtrlCreateButton("Login", 10, 75, 80, 20, $BS_DEFPUSHBUTTON) GUICtrlSetOnEvent($LoginButon, "login") $LoginInput = GUICtrlCreateInput("", 10, 45, 80, 20) GUICtrlCreateLabel("Pls Write Your Name To Login", 10, 5, 80, 40) $IpInput = GUICtrlCreateInput("127.0.0.1", 10, 105, 80, 20) GUICtrlCreateLabel("Server Ip", 10, 135, 80, 40) GUISetState(@SW_SHOW, $lgui) Func login() ;recive $port = Random(60000, 65532, 1);Random port $ip = "127.0.0.1" $socketR = UDPBind($ip, $port);Recive soket If @error <> 0 Then Exit ;send $sIp = GUICtrlRead($IpInput);server ip $socketS = UDPOpen($sIp, 65533);send socket If @error <> 0 Then Exit $sName = GUICtrlRead($LoginInput) UDPSend($socketS, "login " & $ip & " " & $sName & " " & $port); send login comand, IP, Name and PORT GUISetState(@SW_SHOW, $gui) GUISetState(@SW_HIDE, $lgui) EndFunc Func logout() $status = UDPSend($socketS, "logout " & $id) ;send logout command and id Exit EndFunc Func SendMsg() $sData = GUICtrlRead($input) GUICtrlSetData($input, "") $status = UDPSend($socketS, $sName & ": " & $sData); Sends name and mssg If $status = 0 Then MsgBox(0, "ERROR", "Error Server Down : " & @error) EndIf EndFunc While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit $data = UDPRecv($socketR, 1024) ;wait for data If $data <> "" Then ;if data is recived start data analys $rData = StringSplit($data, " ") If $rData[1] = "update" Then ;if update heather is recived update($data) ;update user list Else If $rData[1] = "id" Then ;if id heather is recived $id = $rData[2] ;store ID Else GUICtrlSetData($chatBox, GUICtrlRead($chatBox) & @CRLF & $data);Write data to chat EndIf EndIf EndIf Sleep(1) WEnd Func update($string) $users = StringSplit($string, " ") _GUICtrlListView_DeleteAllItems($userList) ;delete old list For $i = 2 To $users[0] _GUICtrlListView_AddItem($userList, $users[$i]);add new list Next EndFunc Func Cleanup(); cleen open sockets UDPCloseSocket($socketR) UDPCloseSocket($socketS) UDPShutdown() EndFunc Func quit() Exit EndFunc Server: #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) Global $socket[21], $socketR, $id = "" Global $user[21][4] ; Set all arrays with nul values $i = 0 Do $i = $i + 1 For $j = 1 To 20 $user[$j][$i] = "" $socket[$j] = "" Next Until $i = 3 UDPStartup() OnAutoItExitRegister("Cleanup") ;Function to run if program is closing $socketR = UDPBind("127.0.0.1", 65533) ;Create listen soket on local host If @error Then Exit While 1 $sdata = UDPRecv($socketR, 200) ;Wait to recive data If $sdata <> "" Then ;Data recived $rData = StringSplit($sdata, " ") If $rData[1] = "login" Then ;If data contains a login opp For $i = 1 To 20 If $user[$i][1] = "" Then;Search for empty user slot and seting an unique id to user $id = $i ExitLoop EndIf Next $socket[$id] = UDPOpen($rData[2], $rData[4]) ;Open conectoin to the recieved IP and PORT ; Store data to user array $user[$id][1] = $rData[3];Name $user[$id][2] = $rData[2];PORT $user[$id][3] = $rData[4];IP update($id, 1) Else If $rData[1] = "logout" Then ;If data contains a logout opp $id = $rData[2] ;set user logout id update($id, 0) ;update and send active user list $user[$id][1] = "" ;clear User data Else For $i = 1 To 20 If $user[$i][1] <> "" Then $status = UDPSend($socket[$i], $sdata) ;if no comands are recived loop msg to all users Next EndIf EndIf EndIf Sleep(1) If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit WEnd Func update($var1, $var2) $userData = "update" ; set comand heather to update For $i = 1 To 20 If $var2=0 Then If $user[$i][1] <> "" and $var1<>$i Then $userData = String($userData & " " & $user[$i][1]) ;create string of users without the logout user Else If $user[$i][1] <> "" Then $userData = String($userData & " " & $user[$i][1]); Create user list EndIf Next For $i = 1 To 20 If $user[$i][1] <> "" Then UDPSend($socket[$i], $userData) ;send user list If $var2 = 1 Then UDPSend($socket[$i], $user[$var1][1] & "--- Joined The Chanel") ;send login info If $var2 = 0 and $var1<>$i Then UDPSend($socket[$i], $user[$var1][1] & "--- Left The Chanel") ;send logout info EndIf Next If $var2 = 1 Then UDPSend($socket[$var1], "id " & $var1) ;sent back to the new user his Id If $var2 = 0 Then UDPCloseSocket($socket[$var1]) ;close socket for logout EndFunc Func Cleanup() ;close recive socket befor exit UDPCloseSocket($socketR) UDPShutdown() EndFunc
    1 point
  21. AlchemistZim, A radio button is selected when GUICtrlRead returns 1 - like this: #include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) $hRadio_1 = GUICtrlCreateRadio("One", 10, 10, 80, 20) GUICtrlSetState(-1, $GUI_CHECKED) $hRadio_2 = GUICtrlCreateRadio("Two", 90, 10, 80, 20) $hButton = GUICtrlCreateButton("Test", 10, 100, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton If GUICtrlRead($hRadio_1) = 1 Then ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< MsgBox(0, "Test", "One was checked") Else MsgBox(0, "Test", "Two was checked") EndIf EndSwitch WEndAll clear? M23
    1 point
  22. rover

    _GUICtrlStatusBar_SetText

    statusbar text colour is a bit more problematic as it requires ownerdrawing and more code this example is a modified version of Rasim's demo with ownerdraw code added for statusbar part text and background colour Cheers to whom it may concern: please refrain from posting this code in the example scripts forum without author attribution. Edit Hi Rasim ;to whom it may concern: please refrain from posting this code in the example scripts forum with no attribution to the author. ;Author: rover ;Ownerdrawn StatusBar text font and colour demo ;set text colour and font for StatusBar parts ;modified version of demo by Rasim for setting StatusBar font ;http://www.autoitscript.com/forum/index.php?showtopic=88063 #include <GUIConstantsEX.au3> #include <Constants.au3> #include <WindowsConstants.au3> #include <GuiStatusBar.au3> #include <FontConstants.au3> #include <WinAPI.au3> Opt('MustDeclareVars', 1) Global $hFont Global $aParts[3] = [125, 250] Global $aPartsText[2] = ["RED on Transparent", "BLUE on Transparent"] Global $hGUI = GUICreate("Statusbar custom font and colour demo", 400, 300) GUISetBkColor(0xE0FFFF) Global $hStatus = _GUICtrlStatusBar_Create($hGUI) _GUICtrlStatusBar_SetParts($hStatus, $aParts) ; add text and color to struct called in WM_DRAWITEM message handler Global $tPart0 = _GUICtrlStatusBar_SetColor($hStatus, $aPartsText[0], 0, 0xFF0000); Red on transparent background Global $tPart1 = _GUICtrlStatusBar_SetColor($hStatus, $aPartsText[1], 1, 0x0C0DC0); Blue on transparent background ;_GUICtrlStatusBar_SetText($hStatus, "", 0, $SBT_OWNERDRAW); text not set when ownerdrawn ;_GUICtrlStatusBar_SetText($hStatus, "", 1, $SBT_OWNERDRAW) _GUICtrlStatusBar_SetText($hStatus, "Not ownerdrawn", 2) _GUICtrlStatusBar_SetFont($hStatus, 16, 800, 0, "Comic Sans MS") GUIRegisterMsg($WM_DRAWITEM, "_WM_DRAWITEM") GUISetState() Sleep(3000) ;you can use the above _GUICtrlStatusBar_SetText() lines and set text and colour in the message handler ;or use _GUICtrlStatusBar_SetColor() to change text, text colour and part background colour more easily Local $iCnt = 0 Do $iCnt +=1 $tPart0 = _GUICtrlStatusBar_SetColor($hStatus, "GOLD on BLACK", 0, 0xFFD700, 0) $tPart1 = _GUICtrlStatusBar_SetColor($hStatus, "BLUE on GOLD", 1, 0x0C0DC0, 0xFFD700) Sleep(500) $tPart0 = _GUICtrlStatusBar_SetColor($hStatus, $aPartsText[0], 0, 0xFF0000) $tPart1 = _GUICtrlStatusBar_SetColor($hStatus, $aPartsText[1], 1, 0x0C0DC0) Sleep(500) Until $iCnt = 5 Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _WinAPI_DeleteObject($hFont) Func _GUICtrlStatusBar_SetFont($hWnd, $iHeight = 15, $iWeight = 400, $iFontAtrributes = 0, $sFontName = "Arial") ;Author: Rasim $hFont = _WinAPI_CreateFont($iHeight, 0, 0, 0, $iWeight, BitAND($iFontAtrributes, 2), BitAND($iFontAtrributes, 4), _ BitAND($iFontAtrributes, 8), $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, _ $DEFAULT_QUALITY, 0, $sFontName) _SendMessage($hWnd, $WM_SETFONT, $hFont, 1) EndFunc ;==>_GUICtrlStatusBar_SetFont Func _WM_DRAWITEM($hWnd, $Msg, $wParam, $lParam) #forceref $hWnd, $Msg, $wParam, $lParam Local $tagDRAWITEMSTRUCT = DllStructCreate("uint cType;uint cID;uint itmID;" & _ "uint itmAction;uint itmState;hwnd hItm;hwnd hDC;int itmRect[4];dword itmData", $lParam) Local $hItm = DllStructGetData($tagDRAWITEMSTRUCT, "hItm"); retrieve statusbar handle Switch _WinAPI_GetClassName($hItm);an example of how message handler does not have to rely on having global variable for statusbar in advance ;Switch $hItm Case "msctls_statusbar32" ;Case $hStatus Local $hDC = DllStructGetData($tagDRAWITEMSTRUCT, "hDC") ; device context for statusbar for color and/or font Local $iID = DllStructGetData($tagDRAWITEMSTRUCT, "itmID"); statusbar part number ; get 32-bit value in itmData when text has SBT_OWNERDRAW drawing type - pointer to struct with text and color Local $pParam = DllStructGetData($tagDRAWITEMSTRUCT, "itmData") Local $tParam = DllStructCreate("wchar[512];dword;dword;dword", $pParam) ; create RECT structure from itmRect byte array for part metrics Local $tRECT = DllStructCreate("int Left;int Top;int Right;int Bottom") ; metrics not same as non-ownerdrawn part for some reason, so 1 added for alignment DllStructSetData($tRECT, "Left", DllStructGetData($tagDRAWITEMSTRUCT, "itmRect", 1)+1) DllStructSetData($tRECT, "Top", DllStructGetData($tagDRAWITEMSTRUCT, "itmRect", 2)+1) DllStructSetData($tRECT, "Right", DllStructGetData($tagDRAWITEMSTRUCT, "itmRect", 3)) DllStructSetData($tRECT, "Bottom", DllStructGetData($tagDRAWITEMSTRUCT, "itmRect", 4)) _WinAPI_SetBkMode($hDC, $TRANSPARENT); otherwise text background set to 0xFFFFFF _WinAPI_SetTextColor($hDC, DllStructGetData($tParam, 2)); set part text colour from struct If Not DllStructGetData($tParam, 4) Then; check if background should be transparent Local $iBkColor = DllStructGetData($tParam, 3), $hStatusDC, $hBrushBk $hStatusDC = _WinAPI_GetDC($hItm) $hBrushBk = _WinAPI_CreateSolidBrush($iBkColor) _WinAPI_FillRect($hStatusDC, DllStructGetPtr($tRect), $hBrushBk) _WinAPI_DeleteObject($hBrushBk) _WinAPI_ReleaseDC($hItm, $hStatusDC) EndIf ; draw text to DC (can also use gdi32 TextOutW and ExtTextOut API's) _WinAPI_DrawText($hDC, DllStructGetData($tParam, 1), $tRect, $DT_LEFT) EndSwitch Return $GUI_RUNDEFMSG EndFunc Func _GUICtrlStatusBar_SetColor($hWnd, $sText = "", $iPart = 0, $iColor = 0, $iBkColor = -1) ;Author: rover - modified ownerdraw version of _GUICtrlStatusBar_SetText() from GuiStatusBar.au3 ;Includes RGB2BGR() - Author: Siao - http://www.autoitscript.com/forum/index.php?s=&showtopic=57161&view=findpost&p=433593 ;sets itmData element of statusbar DRAWITEMSTRUCT with pointer to struct with text and colour for part number If $Debug_SB Then _GUICtrlStatusBar_ValidateClassName($hWnd) Local $ret, $tStruct, $pStruct, $iBuffer ; In Microsoft Windows XP and earlier, the text for each part is limited to 127 characters. ; This limitation has been removed in Windows Vista. ; set sufficiently large buffer for use with Vista (can exceed XP limit of 128 chars) $tStruct = DllStructCreate("wchar Text[512];dword Color;dword BkColor;dword Trans") Switch $iBkColor Case -1 DllStructSetData($tStruct, "Trans", 1) Case Else $iBkColor = BitAND(BitShift(String(Binary($iBkColor)), 8), 0xFFFFFF) DllStructSetData($tStruct, "Trans", 0) DllStructSetData($tStruct, "BkColor", $iBkColor) EndSwitch $iColor = BitAND(BitShift(String(Binary($iColor)), 8), 0xFFFFFF); From RGB2BGR() Author: Siao DllStructSetData($tStruct, "Text", $sText) DllStructSetData($tStruct, "Color", $iColor) $pStruct = DllStructGetPtr($tStruct) If _GUICtrlStatusBar_IsSimple($hWnd) Then $iPart = $SB_SIMPLEID ;FOR INTERNAL STATUSBARS ONLY If _WinAPI_InProcess($hWnd, $__ghSBLastWnd) Then $ret = _SendMessage($hWnd, $SB_SETTEXTW, BitOR($iPart, $SBT_OWNERDRAW), $pStruct, 0, "wparam", "ptr") Return $tStruct; returns struct to global variable EndIf Return 0 EndFunc ;==>_GUICtrlStatusBar_SetColor
    1 point
×
×
  • Create New...