Leaderboard
Popular Content
Showing content with the highest reputation on 12/11/2013 in all areas
-
I started to work on this UDF and I'd like to discuss, test and improve it with other interested users. The idea is to create a UDF similar to FTPEx, but to support SFTP protocol. Given that this protocol is not natively supported by Windows, I found some candidates to manage it: cURL: http://curl.haxx.se/ PSFTP: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html FZSFTP: http://filezilla-project.org/ I'm trying to use the second one (realied by PuTTY team) and the result is the following code. It is not complete and needs to be widely tested, but main functions work and could be considered as a draft to start the discussion. A possible alternative could be to use FZSFTP (a modified version of PSFTP realized for FileZilla), that includes some interesting improvements to be used by external programs, but does not offer a related documentation. Code version: 1.0 beta 9 (not complete) Previous downloads: 132 SFTPEx.au31 point
-
LAST VERSION - 1.2 27-Dec-11 This UDF helps you to create animated icon in the system tray (only one icon can be used). Very easy to use! I hope that it will be useful for someone. To work properly the example which is shown below, you need to download an archive containing the necessary icons. Any feedback and suggestions please. Available functions Animate UDF Library v1.2 Previous downloads: 1112 Animate.zip Example #Include <GUIConstantsEx.au3> #Include <SliderConstants.au3> #Include <StaticConstants.au3> #Include <WindowsConstants.au3> #Include "Animate.au3" Opt('MustDeclareVars', 1) Opt('TrayAutoPause', 0) Global $Button, $Slider, $Msg _Animate_LoadFromFile(@ScriptDir & '\Flag.png') ;~For $i = 1 To 12 ;~ _Animate_AddIcon(@ScriptDir & '\Flag\' & $i & '.ico', 0) ;~Next _Animate_SetDelay(50) _Animate_ShowIcon() GUICreate('Animation Test', 400, 110) GUICtrlCreateLabel('Fast', 10, 30, 28, 14, $SS_RIGHT) GUICtrlCreateLabel('Slow', 355, 30, 28, 14) $Slider = GUICtrlCreateSlider(42, 25, 310, 26, BitOR($TBS_AUTOTICKS, $WS_TABSTOP)) GUICtrlSendMsg(-1, $TBM_SETTICFREQ, 10, 0) GUICtrlSetLimit(-1, 250, 10) GUICtrlSetData(-1, 50) $Button = GUICtrlCreateButton('Start', 160, 75, 80, 25) GUICtrlSetState(-1, BitOR($GUI_DEFBUTTON, $GUI_FOCUS)) GUISetState() While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE ExitLoop Case $Slider _Animate_SetDelay(GUICtrlRead($Slider)) Case $Button If _Animate_IsAnimate() Then GUICtrlSetData($Button, 'Start') _Animate_Stop() Else GUICtrlSetData($Button, 'Stop') _Animate_Start() EndIf EndSwitch WEnd1 point
-
#include <WindowsConstants.au3> #include <Array.au3> #include <FileOperations.au3> #include <GuiTreeView.au3> Local $aListTree[3] $aListTree[0] = '|.....' $aListTree[1] = '+' $aListTree[2] = '-' ; Глобальные просмотрщика файлов Local $g_aExtAssot[1] = [0] ; Белый список ассоциаций Local $g_aExtBlack[6] = [5, 'exe', 'scr', 'ico', 'ani', 'cur'] ; Чёрный список ассоциаций Local $g_hImgAssot, $hTreeView, $iBtnSave Local $Gui1 Global $sList _ViewListFiles() Func _ViewListFiles() Local $ListFile = FileSelectFolder('', '', 3, @WorkingDir) If @error Then Return Local $aLastPath, $aList, $GP, $i, $sep, $timer, $TreeView, _ $aLastPath[125][3] = [[0]] ; (массив = "папка | дескриптор пункта | счётчик папок") $Gui1 = GUICreate('', 540, 560, -1, -1, BitOR($WS_CAPTION, $WS_SYSMENU, $WS_POPUP, $WS_OVERLAPPEDWINDOW)) GUICtrlCreateTreeView(0, 0, 540, 530, -1, $WS_EX_CLIENTEDGE) GUICtrlSetResizing(-1, 2 + 4 + 32 + 64) $hTreeView = GUICtrlGetHandle(-1) If Not $g_hImgAssot Then ; Создаём список только при первом запуске $g_hImgAssot = _GUIImageList_Create(16, 16, 5, 1) ; Создаём список иконок _GUIImageList_AddIcon($g_hImgAssot, @SystemDir & '\shell32.dll', -4) _GUIImageList_AddIcon($g_hImgAssot, @SystemDir & '\shell32.dll', 0) EndIf _GUICtrlTreeView_SetNormalImageList($hTreeView, $g_hImgAssot) $aLastPath[0][1] = _GUICtrlTreeView_Add($hTreeView, 0, '0', 0, 0) ; добавляем корневой пункт ; $aList = _FO_FileSearch($ListFile, '*.dll', True, 125, 0) $aList = _FO_FileSearch($ListFile, '*', True, 125, 0) If @error Then Exit MsgBox(0, 'Сообщение', 'Ошибка') ; $aList = StringSplit(StringReplace(FileRead($ListFile), ':', ''), @CRLF, 1) ; читаем список в массив $sep = Opt("GUIDataSeparatorChar", "\") $timer = TimerInit() _ArraySort($aList, 0, 1) ; сортируем список, обязательно если не сортированный _AddFileList($aList, $aLastPath, $hTreeView) WinSetTitle($Gui1, '', ' ' & Round(TimerDiff($timer) / 1000, 2) & ' ') Opt("GUIDataSeparatorChar", $sep) ControlTreeView($Gui1, '', $hTreeView, 'Expand', '0') ; раскрыть корневой GUISetState() _SaveList() EndFunc ;==>_ViewListFiles Func _SaveList() Local $sPath = FileSaveDialog('', @WorkingDir, '(*.htm)', 16, 's+', $Gui1) If @error Then Return Local $aLastPath[125] = [0] ; (массив = "папка | дескриптор пункта | счётчик папок") $sList = '' $hItem = _GUICtrlTreeView_GetFirstItem($hTreeView) If Not $hItem Then Return __TreeViewToText($hItem, '', $aLastPath) If StringRight($sPath, 4) <> '.htm' Then $sPath &= '.htm' Local $hFile = FileOpen($sPath, 2) FileWrite($hFile, $sList) FileClose($hFile) Exit EndFunc ;==>_SaveList Func __TreeViewToText($hItem, $sIndent, ByRef $aLastPath) $hItem = _GUICtrlTreeView_GetFirstChild($hTreeView, $hItem) ; Запрашиваем первый дочерний пункт If Not $hItem Then Return ; Теоритически это можно не проверять, так как _GUICtrlTreeView_GetChildren не позволит проверить пункт без дочерних. Local $f, $fFlag, $tmp = $sIndent & $aListTree[0] Do $fFlag = _GUICtrlTreeView_GetChildren($hTreeView, $hItem) ; Также проверяет, запускать ли запрос вложенных пунктов If $fFlag Then $f = $aListTree[1] $aLastPath[0] += 1 Else $f = $aListTree[2] EndIf $tmpPath = '' For $i = 1 To $aLastPath[0] $tmpPath &= $aLastPath[$i] & '\' Next $tmpText = _GUICtrlTreeView_GetText($hTreeView, $hItem) If $fFlag Then $sList &= $sIndent & $f & ' ' & $tmpText & '<br>' & @CRLF ; Текст пункта Else $sList &= $sIndent & $f & ' <a href="' & $tmpPath & '\' & $tmpText & '">' & $tmpText & '</a><br>' & @CRLF ; Текст пункта EndIf If $fFlag Then $aLastPath[$aLastPath[0]] = $tmpText __TreeViewToText($hItem, $tmp, $aLastPath) EndIf $hItem = _GUICtrlTreeView_GetNextSibling($hTreeView, $hItem) ; Запрашиваем следующий пункт Until Not $hItem ; Если не дескриптор, то выход EndFunc ;==>__TreeViewToText Func _AddFileList($aList, ByRef $aLastPath, $hTreeView) Local $hItem, $i, $ind, $j, $tmp, $ext, $iExeNum = 0, $ind, $z For $z = 1 To $aList[0] $tmp = StringSplit($aList[$z], '\') ; делим путь For $i = 1 To $tmp[0] If $tmp[$i] <> $aLastPath[$i][0] Then ; ищем последнее различие в пути, то есть уровень вложения, на котором новый пункт не совпадает с предыдущим For $j = $i To $tmp[0] $aLastPath[$j][0] = $tmp[$j] ; кэшируем новый путь в двумерный массив $aLastPath[$j + 1][2] = 0 ; сбрасываем счётчик папок в 0 Next ExitLoop EndIf Next For $i = $i To $tmp[0] ; отсчёт цикла начинается с индекса на котором было несовпадение, а значит они ещё не созданы If $i = $tmp[0] Then ; если последний элемент пути (то есть файл), то... (условие для определения иконки пункту) $ext = StringRegExpReplace($tmp[$i], '.+\.(\w+)$', '\1') ; ищем расширение $ind = _Get_Num_ICO($ext) If @error Then $ind = 0 $aLastPath[$i][1] = _GUICtrlTreeView_AddChild($hTreeView, $aLastPath[$i - 1][1], $tmp[$i], $ind + 1, $ind + 1) ; добавляем пункт (файл) в конец списка Else $ind = 0 ; если папка If $aLastPath[$i][2] Then $hItem = _GUICtrlTreeView_GetItemByIndex($hTreeView, $aLastPath[$i - 1][1], $aLastPath[$i][2] - 1) ; десриптор последнего пункта папки $aLastPath[$i][1] = _GUICtrlTreeView_InsertItem($hTreeView, $tmp[$i], $aLastPath[$i - 1][1], $hItem, $ind, $ind) Else ; иначе если индекс 0, добавляем первым в список, так как Insert не может добавить в самое начало $aLastPath[$i][1] = _GUICtrlTreeView_AddChildFirst($hTreeView, $aLastPath[$i - 1][1], $tmp[$i], $ind, $ind) ; добавляем пункт EndIf $aLastPath[$i][2] += 1 ; увеличиваем счётчик папок на 1 для вставки папок оп индексу EndIf Next Next EndFunc ;==>_AddFileList Func _GetTab($c) If Not $c Then Return '' Return StringReplace(StringFormat('%0' & $c & 'd', '0'), '0', $aListTree[0], 0, 2) EndFunc ;==>_GetTab Func _Get_Num_ICO($sExt) Local $ind, $ico1 $ind = _ArraySearch2($g_aExtAssot, $sExt) If @error Then $ico1 = _FileDefaultIcon('.' & $sExt) If @error Then Return SetError(1, 0, -1) Else Switch UBound($ico1) Case 2 If _ArraySearch2($g_aExtBlack, $sExt) > 0 Then ; Если в чёрном списке, тогда ошибка Return SetError(1, 0, -1) Else _GUIImageList_AddIcon($g_hImgAssot, $ico1[1], 0) If @error Then _ArrayAdd2($g_aExtBlack, $sExt) ; Если ошибка, то добавляем расширение в чёрный список Return SetError(1, 0, -1) EndIf EndIf Case 3 _GUIImageList_AddIcon($g_hImgAssot, $ico1[1], $ico1[2]) If @error Then _ArrayAdd2($g_aExtBlack, $sExt) ; Если ошибка, то добавляем расширение в чёрный список Return SetError(1, 0, -1) EndIf EndSwitch _ArrayAdd2($g_aExtAssot, $sExt) ; Иначе добавляем расширение в белый список Return SetError(0, 0, $g_aExtAssot[0]) EndIf Else Return SetError(0, 0, $ind) EndIf EndFunc ;==>_Get_Num_ICO Func _ArrayAdd2(ByRef $Array, $ext) $Array[0] += 1 ReDim $Array[$Array[0] + 1] $Array[$Array[0]] = $ext EndFunc ;==>_ArrayAdd2 Func _ArraySearch2(ByRef $Array, $ext) For $i = 1 To $Array[0] If $ext = $Array[$i] Then Return SetError(0, 0, $i) Next Return SetError(1, 0, -1) EndFunc ;==>_ArraySearch2 Func _FileDefaultIcon($sExt) If $sExt = '' Or StringInStr($sExt, ':') Then Return SetError(1) Local $aCall = DllCall("shlwapi.dll", "int", "AssocQueryStringW", _ "dword", 0x00000040, _ ;$ASSOCF_VERIFY "dword", 15, _ ;$ASSOCSTR_DEFAULTICON "wstr", $sExt, _ "ptr", 0, _ "wstr", "", _ "dword*", 65536) If @error Then Return SetError(1, 0, "") If Not $aCall[0] Then $sExt = StringReplace($aCall[5], '"', '') $sExt = StringSplit($sExt, ',') Opt('ExpandEnvStrings', 1) $sExt[1] = $sExt[1] Opt('ExpandEnvStrings', 0) Return SetError(0, 0, $sExt) ElseIf $aCall[0] = 0x80070002 Then Return SetError(1, 0, "{unknown}") ElseIf $aCall[0] = 0x80004005 Then Return SetError(1, 0, "{fail}") Else Return SetError(2, $aCall[0], "") EndIf EndFunc ;==>_FileDefaultIcon1 point
-
There are a few links that give many of the registry keys you will need to either create or alter... http://www.tomshardware.com/forum/170215-46-default-browser-registry http://forums.techarena.in/technology-internet/1112113.htm1 point
-
Hi, Unfortunately I don't have this issue It should be fixed by the repaint triggered on some WM (VSCROLL, HSCROLL, MOUSEWHEEL, KEYDOWN). I suggest you to check if one of the above is not triggered or if there is a WM I forgot to add (make a ConsoleWrite of the $uMsg in the _MyEdit_Proc function). Have you tried the richedit solution in the thread you linked? Br, FireFox.1 point
-
Thank you czardas and kylomas this seems to have fixed my problem. I guess I didn't understand that I wasn't deleting the items from the array but needed to reference the path first? I am still trying to learn all of the ins and outs. Thank you both again for all of your time and help.1 point
-
swstrau118, Here's one way... #include <ButtonConstants.au3> #include <Constants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <GuiButton.au3> #include <array.au3> #AutoIt3Wrapper_Add_Constants=n local $gui010 = guicreate('') local $aSize = wingetclientsize($gui010) local $lbl010 = guictrlcreatelabel('Some meaningful text',0,20,$aSize[0],20,bitor($ss_sunken, $SS_CENTER)) local $aButtons[16], $idx = 0 for $1 = 1 to 4 for $2 = 1 to 4 $aButtons[$idx] = guictrlcreatebutton('#' & $idx+1,$2*55,$1*55,35,35) $idx += 1 Next next guisetstate() while 1 switch guigetmsg() case $gui_event_close Exit case $aButtons[0] to $aButtons[ubound($aButtons)-1] for $1 = 0 to ubound($aButtons) - 1 if bitand(_GUICtrlButton_GetState($aButtons[$1]),$BST_FOCUS) = $BST_FOCUS then _Button_action($1+1) next EndSwitch WEnd func _Button_action($button_number) switch msgbox($MB_OKCANCEL,'','Button Pushed = ' & $button_number & @LF) case 1 ConsoleWrite('Doing something with button #' & $button_number & @LF) return case 2 ConsoleWrite('Returning without doing anything with button #' & $button_number & @LF) Return endswitch endfunc kylomas edit: corrected return placement1 point
-
Read from FTP server
3aberxcs reacted to dedekpredek for a topic
Hi Mouse, you need to open file before read... and check _FTP_FileRead in help $Open = _FTP_Open('MyFTP Control') $Conn = _FTP_Connect($Open, $server, $username, $pass) $Ftpo = _FTP_FileOpen($Conn,"test.txt") $Ftpp = _FTP_FileRead($Ftpo,100000) _FTP_FileClose($Ftpo) $Ftpc = _FTP_Close($Open)1 point -
@Champak, When you would have tried you know that this line adds the extra option in the Tools dropdown menu: command.name.36.$(au3)=Toggle Fold #Region Just read trough the code and try to understand what it does. You would see that it will find all occurrences or #Region, does a "Goto the position of the word" and performs a toggle Fold. So changing this to do a fold on other words is just a matter of doing a proper Regex. Jos1 point
-
Then try this here: #AutoIt3Wrapper_Version=beta ;should be at least AutoIt version 3.3.9.21+ #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WinAPITheme.au3> Const $STM_SETIMAGE = 0x0172 _GDIPlus_Startup() $hGUI = GUICreate("Test", 468, 324) $iLabel = GUICtrlCreatePic("c:\Program Files (x86)\AutoIt3\Examples\GUI\msoobe.jpg", 0, 0, 468, 323) GUICtrlSetState(-1, $GUI_DISABLE) $iButton = GUICtrlCreateButton("Button", 17, 23, 70, 67) $iInput = GUICtrlCreateInput("Input", 109, 28, 338, 62) $iRadio = GUICtrlCreateRadio("Radio", 17, 114, 78, 18) _WinAPI_SetWindowTheme(GUICtrlGetHandle($iRadio), "", "") GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor(-1, 0xFFFFFF) $iRadio2 = GUICtrlCreateRadio("Radio", 17, 140, 55, 19) _WinAPI_SetWindowTheme(GUICtrlGetHandle($iRadio2), "", "") GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor(-1, 0xFFFFFF) $iCheckbox = GUICtrlCreateCheckbox("Checkbox", 109, 114, 83, 18) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor(-1, 0xFFFFFF) _WinAPI_SetWindowTheme(GUICtrlGetHandle($iCheckbox), "", "") $iProgress = GUICtrlCreateProgress(109, 140, 338, 29) GUICtrlSetData(-1, 50) $iLabel_Pseudo = GUICtrlCreatePic("", 17, 184, 430, 88) $iButton2 = GUICtrlCreateButton("Exit", 391, 284, 56, 29) GUISetState() AdlibRegister("LabelFader", 13) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $iButton2 AdlibUnRegister("LabelFader") _GDIPlus_Shutdown() Exit EndSwitch WEnd Func LabelFader() Local Static $iColor = 0x00, $iDir = 2, $c = 0 Local $aText[2] = ["AutoIt rulez!", "coded by UEZ"] Local $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000 + $iColor * 0x10000 + $iColor * 0x100 + $iColor) Local $hBitmap = _GDIPlus_BitmapCreateFromScan0(430, 88) Local $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hCtxt, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetTextRenderingHint($hCtxt, $GDIP_TEXTRENDERINGHINT_ANTIALIASGRIDFIT) _GDIPlus_GraphicsClear($hCtxt, 0xFFFFFFFF) Local $hFormat = _GDIPlus_StringFormatCreate() Local $hFamily = _GDIPlus_FontFamilyCreate("Comic Sans MS") Local $hFont = _GDIPlus_FontCreate($hFamily, 45) Local $tLayout = _GDIPlus_RectFCreate(0, 0, 430, 88) _GDIPlus_StringFormatSetAlign($hFormat, 1) $iColor += $iDir If $iColor > 0xFD Then $c += 1 $iDir *= -1 ElseIf $iColor < 0x02 Then $iDir *= -1 EndIf _GDIPlus_GraphicsDrawStringEx($hCtxt, $aText[Mod($c, 2)], $hFont, $tLayout, $hFormat, $hBrush) _GDIPlus_BrushDispose($hBrush) _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_GraphicsDispose($hCtxt) Local $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _GDIPlus_BitmapDispose($hBitmap) _WinAPI_DeleteObject(GUICtrlSendMsg($iLabel_Pseudo, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap)) _WinAPI_DeleteObject($hHBitmap) EndFunc ;==>LabelFader AutoIt version 3.3.9.21+ is required Br, UEZ1 point