Leaderboard
Popular Content
Showing content with the highest reputation on 01/26/2016 in all areas
-
Features: Create modern looking borderless and resizable GUIs with control buttons (Close,Maximize/Restore,Minimize, Fullscreen, Menu) True borderless, resizeable GUI with full support for aerosnap etc. Many color schemes/themes included. See MetroThemes.au3 for more details. 3 type of Windows 8/10 style buttons. Modern checkboxes, radios, toggles and progressbar. All buttons, checkboxes etc. have hover effects! Windows 10 style modern MsgBox. Windows 10/Android style menu that slides in from left. Windows 10 style right click menu Credits: @UEZ, for the function to create buttons with text using GDIPlus. @binhnx for his SSCtrlHover UDF Changelog: Download UDF with example:1 point
-
1 point
-
Sorry, i forgot the slash in RemotePath and the backslash in LocalPath. InetGet("ftp://68.142.166.18/TUSC_GIS_FTP/Tus157_gis-mapdatastore/" & GUICtrlRead($cmb010), "C:\Users\j\Downloads\" & GUICtrlRead($cmb010)) And here the solution with LV: #include <ListViewConstants.au3> #include <GuiListView.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <ButtonConstants.au3> #include <ie.au3> #include <array.au3> Global $sDL_URL="ftp://68.142.166.18/TUSC_GIS_FTP/Tus157_gis-mapdatastore" Global $hGui=GUICreate('MapFiles DL',640,480) Global $idLV=GUICtrlCreateListView('DL|RemoteFilename',5,5,630,430,$LVS_REPORT,BitOR($LVS_EX_CHECKBOXES,$LVS_EX_FULLROWSELECT)) Global $idtnDL=GUICtrlCreateButton('&Download checked Files',5,445,630,25,BitOR($BS_CENTER,$BS_DEFPUSHBUTTON)) Global $oIE = _IECreate($sDL_URL,0,0) Global $links = _IELinkGetCollection($oIE) Global $sItemText, $sLPath, $sRPath, $iBytes For $link In $links $sItemText=stringregexpreplace($link.href,'.*/(.*)','$1') If $sItemText <> '' Then GUICtrlCreateListViewItem('|' & $sItemText,$idLV) Next _GUICtrlListView_SetColumnWidth($idLV,0, $LVSCW_AUTOSIZE_USEHEADER) _GUICtrlListView_SetColumnWidth($idLV,1, $LVSCW_AUTOSIZE) GUISetState() while 1 switch guigetmsg() case $gui_event_close Exit Case $idtnDL $sDownloads=FileSelectFolder("Choose folder you want to save the file's","") ConsoleWrite($sDownloads&@CRLF) If $sDownloads<>'' Then For $x = 0 To _GUICtrlListView_GetItemCount($idLV) If _GUICtrlListView_GetItemChecked($idLV,$x) Then $sItemText=_GUICtrlListView_GetItemText($idLV,$x,1) $sRPath=$sDL_URL&'/'&$sItemText $sLPath=$sDownloads&'\'&$sItemText ConsoleWrite($sRPath&@TAB&$sLPath&@TAB) $iBytes=InetGet($sRPath,$sLPath,0,0) ;1. 0= Get the file from local cache if available ;2. 0=waiting DL for File is comlete ConsoleWrite($iBytes&' Bytes'&@CRLF) EndIf Next ConsoleWrite('DL finished'&@CRLF) EndIf EndSwitch WEnd1 point
-
aa2zz6, Just rip the file names from the FTP site like this... #include <ie.au3> #include <array.au3> Local $oIE = _IECreate("ftp://68.142.166.18/TUSC_GIS_FTP/Tus157_gis-mapdatastore ",0,0) Local $links = _IELinkGetCollection($oIE), $out For $link In $links $out &= stringregexpreplace($link.href,'.*/(.*)','$1') & @CRLF Next ConsoleWrite($out & @CRLF) then create a gui and present the data in whatever way you want. kylomas edit: Example creating a dropdown list (combo)... #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <ie.au3> #include <array.au3> Local $oIE = _IECreate("ftp://68.142.166.18/TUSC_GIS_FTP/Tus157_gis-mapdatastore ",0,0) Local $links = _IELinkGetCollection($oIE), $out For $link In $links $out &= stringregexpreplace($link.href,'.*/(.*)','$1') & '|' Next #AutoIt3Wrapper_Add_Constants=n local $gui010 = guicreate('') local $aSize = wingetclientsize($gui010) local $cmb010 = guictrlcreatecombo('',20,20,200,250) guisetstate() guictrlsetdata($cmb010,$out,stringregexpreplace($out,'\|(.*?)\|.*','$1')) while 1 switch guigetmsg() case $gui_event_close Exit EndSwitch WEnd1 point
-
A graphic handle is something like a canvas whereas a bitmap is like a picture which you are putting on the canvas. A graphic handle is a device only whereas a bitmap is a structe which held the information in the memory. #include <GDIPlus.au3> #include <String.au3> _GDIPlus_Startup() Global Const $aNibbles[16][2] = [ _ ["0000", "0"], _ ["0001", "1"], _ ["0010", "2"], _ ["0011", "3"], _ ["0100", "4"], _ ["0101", "5"], _ ["0110", "6"], _ ["0111", "7"], _ ["1000", "8"], _ ["1001", "9"], _ ["1010", "A"], _ ["1011", "B"], _ ["1100", "C"], _ ["1101", "D"], _ ["1110", "E"], _ ["1111", "F"]] ; Global Const $aDOS_color[16] = [ _ 0xFF000000, _ ; 0x0 = 00 = Black 0XFF000080, _ ; 0x1 = 01 = Blue 0XFF008000, _ ; 0x2 = 02 = Green 0XFF008080, _ ; 0x3 = 03 = Aqua 0XFF800000, _ ; 0x4 = 04 = Red 0XFF800080, _ ; 0x5 = 05 = Purple 0XFF808000, _ ; 0x6 = 06 = Yellow 0XFFC0C0C0, _ ; 0x7 = 07 = White 0XFF808080, _ ; 0x8 = 08 = Gray 0XFF0000FF, _ ; 0x9 = 09 = Light Blue 0XFF00FF00, _ ; 0xA = 10 = Light Green 0XFF00FFFF, _ ; 0xB = 11 = Light Aqua 0XFFFF0000, _ ; 0xC = 12 = Light Red 0XFFFF00FF, _ ; 0xD = 13 = Light Purple 0XFFFFFF00, _ ; 0xE = 14 = Light Yellow 0xFFFFFFFF]; ; 0xF = 15 = Bright White ; Global $iPixSide = 1, _ ; side of char's pixels $iVtab = 0, _ ; Vertical position of cursor $iHtab = 0, _ ; Horizontal position of cursor $iBG_DefaultColor = 0, _ ; Default Background color 0 = Black $iFG_DefaultColor = 10, _ ; Default Foreground color 7 = White $ahColors[2] = [ _ ; Array of brush handles _GDIPlus_BrushCreateSolid($aDOS_color[$iBG_DefaultColor]), _ ; default background for chars (Format AARRGGBB) _GDIPlus_BrushCreateSolid($aDOS_color[$iFG_DefaultColor])], _ ; default foreground for chars. $iWidth, _ ; Width in bit of char $iHeight ; height in bit of char HotKeySet("{ESC}", "_Terminate") ; ------------------ Local $iWinWidth = 500 Local $iWinHeight = 400 Local $hScreen = GUICreate("", $iWinWidth, $iWinHeight, 10, 10) GUISetState(@SW_SHOW, $hScreen) Local $hCanvas = _GDIPlus_GraphicsCreateFromHWND($hScreen) Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iWinWidth, $iWinHeight) Local $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hCtxt, 2) _GDIPlus_GraphicsSetPixelOffsetMode($hCtxt, 2) Local $aFont, $tGraphic While 1 $aFont = _LoadFont() If IsArray($aFont) Then For $i = 0 To UBound($aFont) - 1 ; just for test, it prints all chars contained in the font _CharGen($hCanvas, $aFont[$i]); print a bitmapped char on the graphic object ; update cursor position $tGraphic = DllStructCreate("long width;long height", $hCanvas + 24) ; thanks to Danyfirex! $iHtab += ($iWidth * $iPixSide) If $iHtab > $tGraphic.width - ($iWidth * $iPixSide) Then $iVtab += ($iHeight * $iPixSide) $iHtab = 0 If $iVtab > $tGraphic.height - ($iHeight * $iPixSide) Then $iVtab = 0 EndIf Next EndIf _CharColor(Random(1, 15, 1)) ; random foreground color WEnd _Terminate() Func _CharGen($hCanvas, $vBits, $iBase = 8) If IsArray($vBits) Then ; if argument is an array then third parameter is ignored since it can be inferred from array dim and array content itself For $iRow = UBound($vBits) - 1 To 0 Step -1 ; UBound of array is the number of rows For $iBit = StringLen($vBits[$iRow]) To 1 Step -1;StringLen of array's content is the number of horizontal pixels _GDIPlus_GraphicsFillRect($hCtxt, _ ; it draws a single pixel at a time $iHtab + $iPixSide * $iBit, _ ; Horizontal pixel position within the matrix $iVtab + $iPixSide * $iRow, _ ; Vertical pixel position within the matrix $iPixSide, $iPixSide, _ ; pixel is a square $ahColors[StringMid($vBits[$iRow], $iBit, 1)]) ; bit 0 = background; bit 1 = foreground Next ; next horizontal pixel Next ; next row Else For $iBit = StringLen($vBits) - 1 To 0 Step -1 ; get all bits one by one _GDIPlus_GraphicsFillRect($hCtxt, _ ; it draws a single pixel at a time $iHtab + $iPixSide * Mod($iBit, $iBase), _ ; Horizontal pixel position within the matrix $iVtab + $iPixSide * Int($iBit / $iBase), _ ; Vertical pixel position within the matrix $iPixSide, $iPixSide, _ ; pixel is a square $ahColors[StringMid($vBits, $iBit + 1, 1)]) Next EndIf _GDIPlus_GraphicsDrawImageRect($hCanvas, $hBitmap, 0, 0, $iWinWidth, $iWinHeight) Local Static $iCounter = 0 _GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & "\MatrixFont" & $iCounter & ".jpg") $iCounter += 1 EndFunc ;==>_CharGen ; ------------------------------------------------------------ ; set Background and foreground colors for chars ; for DOS style pass 0x00 to 0xFF as single argument ; for custom colors use 0xAARRGGBB format for both arguments ; for reset to default colors just call func without arguments ; ------------------------------------------------------------ Func _CharColor($vBackGr = "", $vForeGr = "") If $vBackGr == "" And $vForeGr == "" Then ; set default _GDIPlus_BrushSetSolidColor($ahColors[0], $aDOS_color[$iBG_DefaultColor]) ; background _GDIPlus_BrushSetSolidColor($ahColors[1], $aDOS_color[$iFG_DefaultColor]) ; foreground ElseIf $vBackGr < 256 And $vForeGr = "" Then ; set as in DOS (use 0xNN N_=backgroung _N=foreground) $vForeGr = Dec(Hex($vBackGr, 1)) $vBackGr = Dec(StringLeft(String(Hex($vBackGr, 2)), 1)) _GDIPlus_BrushSetSolidColor($ahColors[0], $aDOS_color[$vBackGr]) ; background _GDIPlus_BrushSetSolidColor($ahColors[1], $aDOS_color[$vForeGr]) ; foreground Else ; set custom colors _GDIPlus_BrushSetSolidColor($ahColors[0], $vBackGr) ; background _GDIPlus_BrushSetSolidColor($ahColors[1], $vForeGr) ; foreground EndIf EndFunc ;==>_CharColor Func _LoadFont() ; Display an open dialog to select a list of file(s). Local $sFile = FileOpenDialog("Select a font file?", "", "All (*.c)", $FD_FILEMUSTEXIST) ; ; Read the file.c Local $hFile = FileOpen($sFile) Local $sFont = FileRead($hFile) FileClose($hFile) ; $aBytes = _StringBetween($sFont, "0x", ",") ; extract only binary bytes ; $iWidth = Dec($aBytes[0]) ; Width in bit of each single char $iHeight = Dec($aBytes[1]) ; height Local $iWhatis = Dec($aBytes[2]) ; ? Local $iChars = Dec($aBytes[3]) ; nr of chars in this font Local $iBytesPerChar = ($iWidth * $iHeight) / 8 Local $aFontMatrix[$iChars] Local $aTemp[$iHeight] Local $iNdx0 = 0, $iNdx1 = 0 ; ; Transform Hex bytes to binary digits For $i = 4 To UBound($aBytes) - 1 $aTemp[$iNdx1] &= _TextToBinaryString($aBytes[$i]) If StringLen($aTemp[$iNdx1]) = $iWidth Then $iNdx1 += 1 If $iNdx1 < $iHeight Then $aTemp[$iNdx1] = "" Else $aFontMatrix[$iNdx0] = $aTemp $iNdx0 += 1 $iNdx1 = 0 $aTemp[$iNdx1] = "" EndIf EndIf Next Return $aFontMatrix EndFunc ;==>_LoadFont Func _TextToBinaryString($sHexText) Local $sBits = "" For $i = 1 To StringLen($sHexText) $sBits &= $aNibbles[Dec(StringMid($sHexText, $i, 1))][0] Next Return $sBits EndFunc ;==>_TextToBinaryString Func _Terminate() If WinActive($hScreen) Then ; Clean up resources _GDIPlus_GraphicsDispose($hCanvas) _GDIPlus_BrushDispose($ahColors[0]) _GDIPlus_BrushDispose($ahColors[1]) _GDIPlus_GraphicsDispose($hCtxt) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_Shutdown() MsgBox(0, "Debug", "Bye bye", 1) Exit EndIf EndFunc ;==>_Terminate1 point
-
cres, As you have the function code in your script, surely you already know the number of required/optional parameters? You can very easily add UserCallTips (the popup that SciTE produces when you enter a function name) for your most commonly used functions using the CallTipManager available in the full SciTE4AutoIt3 package (as well as getting lots of other utilities to help you code in AutoIt). M231 point
-
david1337, Not that hard to do: #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <WinAPI.au3> Global $aButton[9] Mainscript() Func Mainscript() GUICreate("", 1265, 625) ; will create a dialog box that when displayed is centered Opt("GUICoordMode", 4) ; Get the button controlIDs into an array $aButton[1] = GUICtrlCreateButton("Button 1", 50, 30, 262, 262) $aButton[2] = GUICtrlCreateButton("Button 2", 350, 30, 262, 262) $aButton[3] = GUICtrlCreateButton("Button 3", 650, 30, 262, 262) $aButton[4] = GUICtrlCreateButton("Button 4", 950, 30, 262, 262) $aButton[5] = GUICtrlCreateButton("Button 5", 50, 330, 262, 262) $aButton[6] = GUICtrlCreateButton("Button 6", 350, 330, 262, 262) $aButton[7] = GUICtrlCreateButton("Button 7", 650, 330, 262, 262) $aButton[8] = GUICtrlCreateButton("Button 8", 950, 330, 262, 262) $cDummy_Up = GUICtrlCreateDummy() $cDummy_Dn = GUICtrlCreateDummy() GUISetState() GUICtrlSetState($aButton[1], $GUI_FOCUS) ; Set the Up/Down keys as accelerators - they will only act like this when your GUI is active Local $aAccelKeys[2][2] = [["{UP}", $cDummy_Up], ["{DOWN}", $cDummy_Dn]] GUISetAccelerators($aAccelKeys) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $cDummy_Up _Vertical_TabStop() Case $msg = $cDummy_Dn _Vertical_TabStop() EndSelect WEnd #cs ; Perhaps easier to use a Switch structure: While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $cDummy_Up, $cDummy_Dn _Vertical_TabStop() EndSwitch WEnd #ce EndFunc ;==>Mainscript Func _Vertical_TabStop() ; Get active control $hActive = _WinAPI_GetFocus() For $i = 1 To 8 ; If it is a button If $hActive = GUICtrlGetHandle($aButton[$i]) Then ; Then determine index of the button above/below $iIndex = Mod($i + 4, 8) ; This is the magic bit <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ; and set focus GUICtrlSetState($aButton[$iIndex], $GUI_FOCUS) ; No point in looking further ExitLoop EndIf Next EndFunc Please ask if you have any questions. M231 point