Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/16/2017 in all areas

  1. @Iczer asked how to get information about XML encoding. Thanks to @Danyfirex we have a solution: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7 #Tidy_Parameters=/sort_funcs /reel #include <array.au3> #include <date.au3> #include <MsgBoxConstants.au3> #include "XML.au3" ; This COM Error Hanlder will be used globally (excepting inside UDF Functions) ;~ Global $oErrorHandler = ObjEvent("AutoIt.Error", ErrFunc_CustomUserHandler_MAIN) ;~ #forceref $oErrorHandler ; This is SetUp for the transfer UDF internal COM Error Handler to the user function ;~ _XML_ComErrorHandler_UserFunction(ErrFunc_CustomUserHandler_XML) Example_GetProcessingInstructionLister() #Region XML__Examples.au3 - Function Func Example_GetProcessingInstructionLister() ; first you must create $oXmlDoc object Local $oXMLDoc = _XML_CreateDOMDocument(3) If Not @error Then Local $sXML_Content = _ '<?xml version="1.0" encoding="utf-8"?>' & _ '<Checkin>' & _ '</Checkin>' & _ '' _XML_LoadXml($oXMLDoc, $sXML_Content, "", False, False) If Not @error Then If $oXMLDoc.firstChild.nodeType = 7 And $oXMLDoc.firstChild.nodeName = "xml" Then ; Thanks to Danyfirex findings ; https://www.autoitscript.com/forum/topic/187883-com-method-to-get-xml-encoding/?do=findComment&comment=1350438 ; Local $sEncoding = $oXMLDoc.FirstChild().Attributes.GetNamedItem("encoding").Value ; ; MSDN Reference Documentation ; https://msdn.microsoft.com/en-us/library/ms767592(v=vs.85).aspx Local $oAttrib_coll = $oXMLDoc.FirstChild().Attributes ; here we get encoding Local $sEncoding = $oAttrib_coll.GetNamedItem("encoding").Value ConsoleWrite("! $sEncoding = " & $sEncoding & @CRLF) ; here we enumerates all attributes in two ways For $iAttrib_idx = 0 To $oAttrib_coll.length - 1 ConsoleWrite("- " & $iAttrib_idx & '/' & $oAttrib_coll.length & @CRLF) ConsoleWrite($oAttrib_coll.item($iAttrib_idx).name & '=' & $oAttrib_coll.item($iAttrib_idx).value & @CRLF) ConsoleWrite($oAttrib_coll.item($iAttrib_idx).xml & @CRLF) Next ; simple display $oXmlDoc - for checking only MsgBox($MB_ICONINFORMATION, '$oXMLDoc endcoding is: ' & $sEncoding, $oXMLDoc.xml) EndIf EndIf EndIf EndFunc ;==>Example_GetProcessingInstructionLister #EndRegion XML__Examples.au3 - Function
    1 point
  2. Hello. try this: $sEncoding=$oXML.FirstChild().Attributes.GetNamedItem("encoding").Value Saludos
    1 point
  3. This should do it. Won't redraw and refresh while it's being sized but it will be updated after you release the size box and will be updated upon Maximize/restore. Gets rid of the flashing #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <Array.au3> #include <WinAPI.au3> _GDIPlus_Startup() #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 437, 192, 124, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_TABSTOP, $WS_SIZEBOX)) Global $picImage = GUICtrlCreatePic("", 615 / 2, 437 / 2, 615 / 2, 437 / 2) GUICtrlSetResizing($picImage, $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM) Global $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\img.jpg") Global $hBitmap = _GDIPlus_BitmapCreateFromScan0(@DesktopWidth, @DesktopHeight) Global $hGraphics = _GDIPlus_ImageGetGraphicsContext($hBitmap) Resize() GUISetState(@SW_SHOW, $Form1) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_ImageDispose($hImage) Exit Case $GUI_EVENT_RESIZED, $GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESTORE Resize() EndSwitch WEnd Func Resize() Local $aSize = ControlGetPos($Form1, "", $picImage) _GDIPlus_GraphicsClear($hGraphics, 0x00000000) _GDIPlus_GraphicsDrawImageRect($hGraphics, $hImage, 0, 0, $aSize[2], $aSize[3]) Local $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _WinAPI_DeleteObject(GUICtrlSendMsg($picImage, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap)) EndFunc Been a long time since I've draw graphics in memory, not directly on the HWND, and then set an image from memory. So I had to remember the order of the bitmaps/graphics lol Idk what your project entails but maybe you might want a complex GDI+ intensive project to look at to see how you can manage objects. I started this a long time ago, before I left for basic, and never finished it. It was going to be a puzzle style game. I finished the menu portion of it but never finished the puzzle part of it. I used a lot of structs to hold all of my GDI+ objects, windows, etc. As well as using array of string with the function calls to manage the structs (Why have 20 lines to destroy my GDI+ objects when I could have 1 for loop going through and calling the function needed for the struct specified). It's pretty cool though. Creating a context menu (right click) on the GUI and the options displayed are specific to the image you're over (or no image if you're not over one). http://www.mediafire.com/file/2t37tatmogjg33y/PuzzleIt.7z
    1 point
  4. Here's how you would do it if you want the image to fit the width and height of the window #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <Array.au3> #include <WinAPI.au3> Global Const $SIZE_RESTORED = 0 Global Const $SIZE_MAXIMIZED = 2 #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 437, 192, 124, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_TABSTOP, $WS_SIZEBOX)) _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\img.jpg") $hGraphics = _GDIPlus_GraphicsCreateFromHWND($Form1) Global $resimg = _GDIPlus_ImageResize($hImage, 615, 437) _GDIPlus_GraphicsDrawImage($hGraphics, $resimg, 0, 0) GUIRegisterMsg($WM_PAINT, MY_WM_PAINT) GUIRegisterMsg($WM_SIZE, WM_SIZE) GUISetState(@SW_SHOW, $Form1) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func MY_WM_PAINT($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam _GDIPlus_GraphicsDrawImage($hGraphics, $resimg, 0, 0) _WinAPI_RedrawWindow($Form1, 0, 0, $RDW_VALIDATE) Return $GUI_RUNDEFMSG EndFunc ;==>MY_WM_PAINT Func WM_SIZE($hWndFrom, $iMsg, $wParam, $lParam) Local $iLoWord = _WinAPI_LoWord($lParam) ; Width Local $iHiWord = _WinAPI_HiWord($lParam) ; Height Switch ($hWndFrom) Case $Form1 Switch ($wParam) Case $SIZE_RESTORED, $SIZE_MAXIMIZED ; The old graphic is based off the size of the old size, destroy it _GDIPlus_GraphicsDispose($hGraphics) ; And recreate it with the size of the new size $hGraphics = _GDIPlus_GraphicsCreateFromHWND($Form1) ; resize the image to the new width/height $resimg = _GDIPlus_ImageResize($hImage, $iLoWord, $iHiWord) ; Implicitly calls MY_WM_PAINT after this, based on the order of window messages received from Windows EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_SIZE And here's how you could draw it in the bottom right quadrant of the GUI #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <Array.au3> #include <WinAPI.au3> Global Const $SIZE_RESTORED = 0 Global Const $SIZE_MAXIMIZED = 2 Global $iWidth = 615 Global $iHeight = 437 #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", $iWidth, $iHeight, 192, 124, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_TABSTOP, $WS_SIZEBOX)) _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\img.jpg") $hGraphics = _GDIPlus_GraphicsCreateFromHWND($Form1) Global $resimg = _GDIPlus_ImageResize($hImage, $iWidth / 2, $iHeight / 2) _GDIPlus_GraphicsDrawImage($hGraphics, $resimg, 0, 0) GUIRegisterMsg($WM_PAINT, MY_WM_PAINT) GUIRegisterMsg($WM_SIZE, WM_SIZE) GUISetState(@SW_SHOW, $Form1) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func MY_WM_PAINT($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam _GDIPlus_GraphicsDrawImage($hGraphics, $resimg, $iWidth / 2, $iHeight / 2) _WinAPI_RedrawWindow($Form1, 0, 0, $RDW_VALIDATE) Return $GUI_RUNDEFMSG EndFunc ;==>MY_WM_PAINT Func WM_SIZE($hWndFrom, $iMsg, $wParam, $lParam) Local $iLoWord = _WinAPI_LoWord($lParam) ; Width Local $iHiWord = _WinAPI_HiWord($lParam) ; Height Switch ($hWndFrom) Case $Form1 Switch ($wParam) Case $SIZE_RESTORED, $SIZE_MAXIMIZED $iWidth = $iLoWord $iHeight = $iHiWord ; The old graphic is based off the size of the old size, destroy it _GDIPlus_GraphicsDispose($hGraphics) ; And recreate it with the size of the new size $hGraphics = _GDIPlus_GraphicsCreateFromHWND($Form1) ; resize the image to the new width/height $resimg = _GDIPlus_ImageResize($hImage, $iLoWord / 2, $iHiWord / 2) ; Implicitly calls MY_WM_PAINT after this, based on the order of window messages received from Windows EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_SIZE
    1 point
  5. Not sure I understand. Do you want the image to be drawn to fit the GUI window or do you want the image to be drawn starting at the exact midpoint of the GUI (width and height)? Making it be drawn in the bottom right corner of the GUI.
    1 point
  6. Hello. just for fun. #include <Array.au3> #include <StringConstants.au3> Local $iTypeSupport = " Format Module Mode Description" & @CRLF $iTypeSupport &= "-------------------------------------------------------------------------------" & @CRLF $iTypeSupport &= " 3FR DNG r-- Hasselblad CFV/H3D39II" & @CRLF $iTypeSupport &= " 3G2 MPEG r-- Media Container" & @CRLF $iTypeSupport &= " 3GP MPEG r-- Media Container" & @CRLF $iTypeSupport &= " AAI* AAI rw+ AAI Dune image" & @CRLF $iTypeSupport &= " AI PDF rw- Adobe Illustrator CS2" & @CRLF $iTypeSupport &= " ART* ART rw- PFS: 1st Publisher Clip Art" & @CRLF $iTypeSupport &= " ARW DNG r-- Sony Alpha Raw Image Format" & @CRLF $iTypeSupport &= " AVI MPEG r-- Microsoft Audio/Visual Interleaved" & @CRLF $iTypeSupport &= " AVS* AVS rw+ AVS X image" & @CRLF $iTypeSupport &= " BGR* BGR rw+ Raw blue, green, and red samples" & @CRLF $iTypeSupport &= " BGRA* BGR rw+ Raw blue, green, red, and alpha samples" & @CRLF $iTypeSupport &= " BGRO* BGR rw+ Raw blue, green, red, and opacity samples" & @CRLF $iTypeSupport &= " BIE* JBIG --- Joint Bi-level Image experts Group interchange format" & @CRLF $iTypeSupport &= "" & @CRLF $iTypeSupport &= " BMP* BMP rw- Microsoft Windows bitmap image" & @CRLF $iTypeSupport &= " BMP2* BMP -w- Microsoft Windows bitmap image (V2)" & @CRLF $iTypeSupport &= " BMP3* BMP -w- Microsoft Windows bitmap image (V3)" & @CRLF $iTypeSupport &= " BRF* BRAILLE -w- BRF ASCII Braille format" & @CRLF $iTypeSupport &= " CAL* CALS rw- Continuous Acquisition and Life-cycle Support Type 1" & @CRLF $iTypeSupport &= " Specified in MIL-R-28002 and MIL-PRF-28002" & @CRLF $iTypeSupport &= " CALS* CALS rw- Continuous Acquisition and Life-cycle Support Type 1" & @CRLF $iTypeSupport &= " Specified in MIL-R-28002 and MIL-PRF-28002" & @CRLF $iTypeSupport &= " CANVAS* XC r-- Constant image uniform color" & @CRLF $iTypeSupport &= " CAPTION* CAPTION r-- Caption" & @CRLF $iTypeSupport &= " CIN* CIN rw- Cineon Image File" & @CRLF $iTypeSupport &= " CIP* CIP -w- Cisco IP phone image format" & @CRLF $iTypeSupport &= " CLIP* CLIP rw+ Image Clip Mask" & @CRLF $iTypeSupport &= "CLIPBOARD* CLIPBOARD rw- The system clipboard" & @CRLF $iTypeSupport &= " CMYK* CMYK rw+ Raw cyan, magenta, yellow, and black samples" & @CRLF $iTypeSupport &= " CMYKA* CMYK rw+ Raw cyan, magenta, yellow, black, and alpha samples" & @CRLF $iTypeSupport &= " CR2 DNG r-- Canon Digital Camera Raw Image Format" & @CRLF $iTypeSupport &= " CRW DNG r-- Canon Digital Camera Raw Image Format" & @CRLF $iTypeSupport &= " CUR* ICON rw- Microsoft icon" & @CRLF $iTypeSupport &= " CUT* CUT r-- DR Halo" & @CRLF $iTypeSupport &= " DCM* DCM r-- Digital Imaging and Communications in Medicine image" & @CRLF $iTypeSupport &= " DICOM is used by the medical community for images like X-rays. The specification, " & @CRLF $iTypeSupport &= " 'Digital Imaging and Communications in Medicine (DICOM)', is available at http://medical.nema.org/. " & @CRLF $iTypeSupport &= " In particular, see part 5 which describes the image encoding (RLE, JPEG, JPEG-LS), and supplement 61 which adds JPEG-2000 encoding." & @CRLF $iTypeSupport &= " DCR DNG r-- Kodak Digital Camera Raw Image File" & @CRLF $iTypeSupport &= " DCX* PCX rw+ ZSoft IBM PC multi-page Paintbrush" & @CRLF $iTypeSupport &= " DDS* DDS rw+ Microsoft DirectDraw Surface" & @CRLF $iTypeSupport &= " DFONT* TTF r-- Multi-face font package (Freetype 2.6.3)" & @CRLF $iTypeSupport &= " DJVU* DJVU --- Deja vu" & @CRLF $iTypeSupport &= " See http://www.djvuzone.org/ for details about the DJVU format. The" & @CRLF $iTypeSupport &= " DJVU 1.2 specification is available there and at ftp://swrinde.nde.swri.edu/pub/djvu/documents/." & @CRLF $iTypeSupport &= " DNG DNG r-- Digital Negative" & @CRLF $iTypeSupport &= " DOT DOT --- Graphviz" & @CRLF $iTypeSupport &= " DPS DPS --- Display Postscript Interpreter" & @CRLF $iTypeSupport &= " DPX* DPX rw- SMPTE 268M-2003 (DPX 2.0)" & @CRLF $iTypeSupport &= " Digital Moving Picture Exchange Bitmap, Version 2.0." & @CRLF $iTypeSupport &= " See SMPTE 268M-2003 specification at http://www.smtpe.org" & @CRLF $iTypeSupport &= "" & @CRLF $iTypeSupport &= " DXT1* DDS rw+ Microsoft DirectDraw Surface" & @CRLF $iTypeSupport &= " DXT5* DDS rw+ Microsoft DirectDraw Surface" & @CRLF $iTypeSupport &= " EMF EMF r-- Windows Enhanced Meta File" & @CRLF $iTypeSupport &= " EPDF PDF rw- Encapsulated Portable Document Format" & @CRLF $iTypeSupport &= " EPI PS rw- Encapsulated PostScript Interchange format" & @CRLF $iTypeSupport &= " EPS PS rw- Encapsulated PostScript" & @CRLF $iTypeSupport &= " EPS2* PS2 -w- Level II Encapsulated PostScript" & @CRLF $iTypeSupport &= " EPS3* PS3 -w+ Level III Encapsulated PostScript" & @CRLF $iTypeSupport &= " EPSF PS rw- Encapsulated PostScript" & @CRLF $iTypeSupport &= " EPSI PS rw- Encapsulated PostScript Interchange format" & @CRLF $iTypeSupport &= " EPT EPT rw- Encapsulated PostScript with TIFF preview" & @CRLF $iTypeSupport &= " EPT2 EPT rw- Encapsulated PostScript Level II with TIFF preview" & @CRLF $iTypeSupport &= " EPT3 EPT rw+ Encapsulated PostScript Level III with TIFF preview" & @CRLF $iTypeSupport &= " ERF DNG r-- Epson RAW Format" & @CRLF $iTypeSupport &= " EXR EXR rw- High Dynamic-range (HDR)" & @CRLF $iTypeSupport &= " FAX* FAX rw+ Group 3 FAX" & @CRLF $iTypeSupport &= " FAX machines use non-square pixels which are 1.5 times wider than they are tall but computer displays use square pixels, therefore" & @CRLF $iTypeSupport &= " FAX images may appear to be narrow unless they are explicitly resized using a geometry of 150x100%." & @CRLF $iTypeSupport &= "" & @CRLF $iTypeSupport &= " FILE* URL r-- Uniform Resource Locator (file://)" & @CRLF $iTypeSupport &= " FITS* FITS rw- Flexible Image Transport System" & @CRLF $iTypeSupport &= " FLIF* FLIF rw+ Free Lossless Image Format (libflif 0.0.2 [0000])" & @CRLF $iTypeSupport &= " FPX FPX --- FlashPix Format" & @CRLF $iTypeSupport &= " FRACTAL* PLASMA r-- Plasma fractal image" & @CRLF $iTypeSupport &= " FTP* URL r-- Uniform Resource Locator (ftp://)" & @CRLF $iTypeSupport &= " FTS* FITS rw- Flexible Image Transport System" & @CRLF $iTypeSupport &= " G3* FAX rw- Group 3 FAX" & @CRLF $iTypeSupport &= " G4* FAX rw- Group 4 FAX" & @CRLF $iTypeSupport &= " GIF* GIF rw+ CompuServe graphics interchange format" & @CRLF $iTypeSupport &= " GIF87* GIF rw- CompuServe graphics interchange format (version 87a)" & @CRLF $iTypeSupport &= " GRADIENT* GRADIENT r-- Gradual linear passing from one shade to another" & @CRLF $iTypeSupport &= " GRAY* GRAY rw+ Raw gray samples" & @CRLF $iTypeSupport &= " GROUP4* TIFF rw- Raw CCITT Group4" & @CRLF $iTypeSupport &= " GV DOT --- Graphviz" & @CRLF $iTypeSupport &= " HALD* HALD r-- Identity Hald color lookup table image" & @CRLF $iTypeSupport &= " HDR* HDR rw+ Radiance RGBE image format" & @CRLF $iTypeSupport &= "HISTOGRAM* HISTOGRAM -w- Histogram of the image" & @CRLF $iTypeSupport &= " HRZ* HRZ rw- Slow Scan TeleVision" & @CRLF $iTypeSupport &= " HTM* HTML -w- Hypertext Markup Language and a client-side image map" & @CRLF $iTypeSupport &= "" & @CRLF $iTypeSupport &= " HTML* HTML -w- Hypertext Markup Language and a client-side image map" & @CRLF $iTypeSupport &= "" & @CRLF $iTypeSupport &= " HTTP* URL r-- Uniform Resource Locator (http://)" & @CRLF $iTypeSupport &= " HTTPS* URL r-- Uniform Resource Locator (https://)" & @CRLF $iTypeSupport &= " ICB* TGA rw- Truevision Targa image" & @CRLF $iTypeSupport &= " ICO* ICON rw+ Microsoft icon" & @CRLF $iTypeSupport &= " ICON* ICON rw- Microsoft icon" & @CRLF $iTypeSupport &= " IIQ DNG r-- Phase One Raw Image Format" & @CRLF $iTypeSupport &= " INFO INFO -w+ The image format and characteristics" & @CRLF $iTypeSupport &= " INLINE* INLINE rw+ Base64-encoded inline images" & @CRLF $iTypeSupport &= " IPL* IPL rw+ IPL Image Sequence" & @CRLF $iTypeSupport &= " ISOBRL* BRAILLE -w- ISO/TR 11548-1 format" & @CRLF $iTypeSupport &= " ISOBRL6* BRAILLE -w- ISO/TR 11548-1 format 6dot" & @CRLF $iTypeSupport &= " J2C* JP2 rw- JPEG-2000 Code Stream Syntax (2.1.2)" & @CRLF $iTypeSupport &= " J2K* JP2 rw- JPEG-2000 Code Stream Syntax (2.1.2)" & @CRLF $iTypeSupport &= " JBG* JBIG --- Joint Bi-level Image experts Group interchange format" & @CRLF $iTypeSupport &= "" & @CRLF $iTypeSupport &= " JBIG* JBIG --- Joint Bi-level Image experts Group interchange format" & @CRLF $iTypeSupport &= "" & @CRLF $iTypeSupport &= " JNG* PNG rw- JPEG Network Graphics" & @CRLF $iTypeSupport &= " See http://www.libpng.org/pub/mng/ for details about the JNG format." & @CRLF $iTypeSupport &= " JNX* JNX r-- Garmin tile format" & @CRLF $iTypeSupport &= " JP2* JP2 rw- JPEG-2000 File Format Syntax (2.1.2)" & @CRLF $iTypeSupport &= " JPC* JP2 rw- JPEG-2000 Code Stream Syntax (2.1.2)" & @CRLF $iTypeSupport &= " JPE* JPEG rw- Joint Photographic Experts Group JFIF format (62)" & @CRLF $iTypeSupport &= " JPEG* JPEG rw- Joint Photographic Experts Group JFIF format (62)" & @CRLF $iTypeSupport &= " JPG* JPEG rw- Joint Photographic Experts Group JFIF format (62)" & @CRLF $iTypeSupport &= " JPM* JP2 rw- JPEG-2000 File Format Syntax (2.1.2)" & @CRLF $iTypeSupport &= " JPS* JPEG rw- Joint Photographic Experts Group JFIF format (62)" & @CRLF $iTypeSupport &= " JPT* JP2 rw- JPEG-2000 File Format Syntax (2.1.2)" & @CRLF $iTypeSupport &= " JSON JSON -w+ The image format and characteristics" & @CRLF $iTypeSupport &= " K25 DNG r-- Kodak Digital Camera Raw Image Format" & @CRLF $iTypeSupport &= " KDC DNG r-- Kodak Digital Camera Raw Image Format" & @CRLF $iTypeSupport &= " LABEL* LABEL r-- Image label" & @CRLF $iTypeSupport &= " M2V MPEG rw+ MPEG Video Stream" & @CRLF $iTypeSupport &= " M4V MPEG rw+ Raw MPEG-4 Video" & @CRLF $iTypeSupport &= " MAC* MAC r-- MAC Paint" & @CRLF $iTypeSupport &= " MAP* MAP rw- Colormap intensities and indices" & @CRLF $iTypeSupport &= " MASK* MASK rw+ Image Clip Mask" & @CRLF $iTypeSupport &= " MAT MAT rw+ MATLAB level 5 image format" & @CRLF $iTypeSupport &= " MATTE* MATTE -w+ MATTE format" & @CRLF $iTypeSupport &= " MEF DNG r-- Mamiya Raw Image File" & @CRLF $iTypeSupport &= " MIFF* MIFF rw+ Magick Image File Format" & @CRLF $iTypeSupport &= " MKV MPEG rw+ Multimedia Container" & @CRLF $iTypeSupport &= " MNG* PNG rw+ Multiple-image Network Graphics (libpng 1.6.26)" & @CRLF $iTypeSupport &= " See http://www.libpng.org/pub/mng/ for details about the MNG format." & @CRLF $iTypeSupport &= " MONO* MONO rw- Raw bi-level bitmap" & @CRLF $iTypeSupport &= " MOV MPEG rw+ MPEG Video Stream" & @CRLF $iTypeSupport &= " MP4 MPEG rw+ MPEG-4 Video Stream" & @CRLF $iTypeSupport &= " MPC* MPC rw+ Magick Persistent Cache image format" & @CRLF $iTypeSupport &= " MPEG MPEG rw+ MPEG Video Stream" & @CRLF $iTypeSupport &= " MPG MPEG rw+ MPEG Video Stream" & @CRLF $iTypeSupport &= " MRW DNG r-- Sony (Minolta) Raw Image File" & @CRLF $iTypeSupport &= " MSL* MSL rw+ Magick Scripting Language" & @CRLF $iTypeSupport &= " MSVG SVG rw+ ImageMagick's own SVG internal renderer" & @CRLF $iTypeSupport &= " MTV* MTV rw+ MTV Raytracing image format" & @CRLF $iTypeSupport &= " MVG* MVG rw- Magick Vector Graphics" & @CRLF $iTypeSupport &= " NEF DNG r-- Nikon Digital SLR Camera Raw Image File" & @CRLF $iTypeSupport &= " NRW DNG r-- Nikon Digital SLR Camera Raw Image File" & @CRLF $iTypeSupport &= " NULL* NULL rw- Constant image of uniform color" & @CRLF $iTypeSupport &= " ORF DNG r-- Olympus Digital Camera Raw Image File" & @CRLF $iTypeSupport &= " OTB* OTB rw- On-the-air bitmap" & @CRLF $iTypeSupport &= " OTF* TTF r-- Open Type font (Freetype 2.6.3)" & @CRLF $iTypeSupport &= " PAL* UYVY rw- 16bit/pixel interleaved YUV" & @CRLF $iTypeSupport &= " PALM* PALM rw+ Palm pixmap" & @CRLF $iTypeSupport &= " PAM* PNM rw+ Common 2-dimensional bitmap format" & @CRLF $iTypeSupport &= " PANGO* PANGO r-- Pango Markup Language (Pangocairo 1.40.1)" & @CRLF $iTypeSupport &= " PATTERN* PATTERN r-- Predefined pattern" & @CRLF $iTypeSupport &= " PBM* PNM rw+ Portable bitmap format (black and white)" & @CRLF $iTypeSupport &= " PCD* PCD rw- Photo CD" & @CRLF $iTypeSupport &= " PCDS* PCD rw- Photo CD" & @CRLF $iTypeSupport &= " PCL PCL rw+ Printer Control Language" & @CRLF $iTypeSupport &= " PCT* PICT rw- Apple Macintosh QuickDraw/PICT" & @CRLF $iTypeSupport &= " PCX* PCX rw- ZSoft IBM PC Paintbrush" & @CRLF $iTypeSupport &= " PDB* PDB rw+ Palm Database ImageViewer Format" & @CRLF $iTypeSupport &= " PDF PDF rw+ Portable Document Format" & @CRLF $iTypeSupport &= " PDFA PDF rw+ Portable Document Archive Format" & @CRLF $iTypeSupport &= " PEF DNG r-- Pentax Electronic File" & @CRLF $iTypeSupport &= " PES* PES r-- Embrid Embroidery Format" & @CRLF $iTypeSupport &= " PFA* TTF r-- Postscript Type 1 font (ASCII) (Freetype 2.6.3)" & @CRLF $iTypeSupport &= " PFB* TTF r-- Postscript Type 1 font (binary) (Freetype 2.6.3)" & @CRLF $iTypeSupport &= " PFM* PNM rw+ Portable float format" & @CRLF $iTypeSupport &= " PGM* PNM rw+ Portable graymap format (gray scale)" & @CRLF $iTypeSupport &= " PICON* XPM rw- Personal Icon" & @CRLF $iTypeSupport &= " PICT* PICT rw- Apple Macintosh QuickDraw/PICT" & @CRLF $iTypeSupport &= " PIX* PIX r-- Alias/Wavefront RLE image format" & @CRLF $iTypeSupport &= " PJPEG* JPEG rw- Joint Photographic Experts Group JFIF format (62)" & @CRLF $iTypeSupport &= " PLASMA* PLASMA r-- Plasma fractal image" & @CRLF $iTypeSupport &= " PNG* PNG rw- Portable Network Graphics (libpng 1.6.26)" & @CRLF $iTypeSupport &= " See http://www.libpng.org/ for details about the PNG format." & @CRLF $iTypeSupport &= " PNG00* PNG rw- PNG inheriting bit-depth, color-type from original, if possible" & @CRLF $iTypeSupport &= " PNG24* PNG rw- opaque or binary transparent 24-bit RGB (zlib 1.2.9)" & @CRLF $iTypeSupport &= " PNG32* PNG rw- opaque or transparent 32-bit RGBA" & @CRLF $iTypeSupport &= " PNG48* PNG rw- opaque or binary transparent 48-bit RGB" & @CRLF $iTypeSupport &= " PNG64* PNG rw- opaque or transparent 64-bit RGBA" & @CRLF $iTypeSupport &= " PNG8* PNG rw- 8-bit indexed with optional binary transparency" & @CRLF $iTypeSupport &= " PNM* PNM rw+ Portable anymap" & @CRLF $iTypeSupport &= " PPM* PNM rw+ Portable pixmap format (color)" & @CRLF $iTypeSupport &= " PS PS rw+ PostScript" & @CRLF $iTypeSupport &= " PS2* PS2 -w+ Level II PostScript" & @CRLF $iTypeSupport &= " PS3* PS3 -w+ Level III PostScript" & @CRLF $iTypeSupport &= " PSB* PSD rw+ Adobe Large Document Format" & @CRLF $iTypeSupport &= " PSD* PSD rw+ Adobe Photoshop bitmap" & @CRLF $iTypeSupport &= " PTIF* TIFF rw+ Pyramid encoded TIFF" & @CRLF $iTypeSupport &= " PWP* PWP r-- Seattle Film Works" & @CRLF $iTypeSupport &= "RADIAL-GRADIENT* GRADIENT r-- Gradual radial passing from one shade to another" & @CRLF $iTypeSupport &= " RAF DNG r-- Fuji CCD-RAW Graphic File" & @CRLF $iTypeSupport &= " RAS* SUN rw+ SUN Rasterfile" & @CRLF $iTypeSupport &= " RAW DNG r-- Raw" & @CRLF $iTypeSupport &= " RGB* RGB rw+ Raw red, green, and blue samples" & @CRLF $iTypeSupport &= " RGBA* RGB rw+ Raw red, green, blue, and alpha samples" & @CRLF $iTypeSupport &= " RGBO* RGB rw+ Raw red, green, blue, and opacity samples" & @CRLF $iTypeSupport &= " RGF* RGF rw- LEGO Mindstorms EV3 Robot Graphic Format (black and w" & @CRLF $iTypeSupport &= " SGI* SGI rw+ Irix RGB image" & @CRLF $iTypeSupport &= " SIX* SIX rw- DEC SIXEL Graphics Format" & @CRLF $iTypeSupport &= " SIXEL* SIXEL rw- DEC SIXEL Graphics Format" & @CRLF $iTypeSupport &= " SUN* SUN rw+ SUN Rasterfile" & @CRLF $iTypeSupport &= " SVG SVG rw+ Scalable Vector Graphics (RSVG 2.40.15)" & @CRLF $iTypeSupport &= " SVGZ SVG rw+ Compressed Scalable Vector Graphics (RSVG 2.40.15)" & @CRLF $iTypeSupport &= " TGA* TGA rw- Truevision Targa image" & @CRLF $iTypeSupport &= "THUMBNAIL* THUMBNAIL -w+ EXIF Profile Thumbnail" & @CRLF $iTypeSupport &= " TIFF* TIFF rw+ Tagged Image File Format (LIBTIFF, Version 4.0.7)" & @CRLF $iTypeSupport &= " TIFF64* TIFF rw- Tagged Image File Format (64-bit) (LIBTIFF, Version 4" & @CRLF $iTypeSupport &= " TXT* TXT rw+ Text" & @CRLF $iTypeSupport &= " UYVY* UYVY rw- 16bit/pixel interleaved YUV" & @CRLF $iTypeSupport &= " VDA* TGA rw- Truevision Targa image" & @CRLF $iTypeSupport &= " VICAR* VICAR rw- VICAR rasterfile format" & @CRLF $iTypeSupport &= " VID* VID rw+ Visual Image Directory" & @CRLF $iTypeSupport &= " VIFF* VIFF rw+ Khoros Visualization image" & @CRLF $iTypeSupport &= " VIPS* VIPS rw+ VIPS image" & @CRLF $iTypeSupport &= " VST* TGA rw- Truevision Targa image" & @CRLF $iTypeSupport &= " WBMP* WBMP rw- Wireless Bitmap (level 0) image" & @CRLF $iTypeSupport &= " WEBP* WEBP rw- WebP Image Format (libwebp 0.5.1 [0208])" & @CRLF $iTypeSupport &= " WMV MPEG rw+ Windows Media Video" & @CRLF $iTypeSupport &= " XBM* XBM rw- X Windows system bitmap (black and white)" & @CRLF $iTypeSupport &= " XPM* XPM rw- X Windows system pixmap (color)" & @CRLF $iTypeSupport &= " XV* VIFF rw+ Khoros Visualization image" & @CRLF $iTypeSupport &= " YCbCr* YCbCr rw+ Raw Y, Cb, and Cr samples" & @CRLF $iTypeSupport &= " YCbCrA* YCbCr rw+ Raw Y, Cb, Cr, and alpha samples" & @CRLF & @CRLF Local $aSplit = StringSplit($iTypeSupport, @CRLF, 1) ;~ _ArrayDisplay($aSplit) Local $sString = "" Local $sMode = "" Local $aArray[0][4] For $i = 3 To $aSplit[0] $sString = StringStripWS($aSplit[$i], $STR_STRIPLEADING + $STR_STRIPTRAILING + $STR_STRIPSPACES) $sMode = StringMid($sString, StringInStr($sString, " ", 0, 2) + 1, 3) ;Get mode --- If _IsValid($sMode) Then ConsoleWrite(">" & $sMode & @CRLF) ConsoleWrite($sString & @CRLF) _ArrayAdd($aArray, StringReplace($sString, ' ', '|', 3)) Else ConsoleWrite("!Is Part of description: " & $sString & @CRLF) $aArray[UBound($aArray)-1][3] &= ' ' & $sString EndIf Next _ArrayDisplay($aArray) Func _IsValid($sMode) Local $iFlagCount = 0 Local $aSplit = StringSplit($sMode, "") If $aSplit[0] = 3 Then If $aSplit[1] == '-' Or $aSplit[1] == 'r' Then $iFlagCount += 1 If $aSplit[2] == '-' Or $aSplit[2] == 'w' Then $iFlagCount += 1 If $aSplit[3] == '-' Or $aSplit[3] == '+' Then $iFlagCount += 1 EndIf Return ($iFlagCount = 3) EndFunc ;==>_IsValid Saludos
    1 point
  7. Are you sure? Try this little snippet which shows it has to be defined each time or am I missing something?: For $x = 1 To 5 Test() Next Func Test() If IsDeclared("testvar") Then ConsoleWrite("Already defined" & @CRLF) Else ConsoleWrite("Initialise $Testvar" & @CRLF) Static $testvar = "123" EndIf If IsDeclared("testvar") Then ConsoleWrite("testvar defined" & @CRLF & @CRLF) EndIf EndFunc ;==>Test
    1 point
  8. Deye, All that is taken care of automatically if you add the _EventMonitor function to your idle loop. My turn to apologise as I did not do that in the examples I posted. M23
    1 point
  9. SoyArcano

    exercices for autoit

    Thanks so much very useful for beginners
    1 point
  10. Deye, And here is a Beta version of the UDF which I think answers your request to locate controls inside each section relative to the section itself, together with the reworked example using the new functionality: <snip> #include <GUIConstantsEx.au3> #include "GUIExtender_Mod.au3" $hGUI = GUICreate("Parent GUI", 340, 360) ;~ _GUIExtender_Init($hGUI) _GUIExtender_Init($hGUI, 0, 0, True) ; This section starts at 0 and is 90 pixels deep $iSection_1 = _GUIExtender_Section_Create($hGUI, -1, 90) $Button = GUICtrlCreateButton(Chr(0x71), 208, 10, 115, 25, 0, 1) GUICtrlSetFont(-1, 10, 600, -1, "WingDings 3") $Label1 = GUICtrlCreateLabel("first-section", 216, 48, 70, 19) ;$iSection_2 = _GUIExtender_Section_Create($hGUI, 90, -1) ; You are asking the UDF to create this section starting at 90 and fill the remainder of the GUI $iSection_2 = _GUIExtender_Section_Create($hGUI, -1, 90) ; Now you are asking for a 90 pixel section to follow on from the previous $iSectionBaseCoord = _GUIExtender_Section_BaseCoord($hGUI, $iSection_2) ; Get the start coordinate of the section <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ; use that value to position the controls within the section relative to the start - no need to know the absolute value <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $Radio1 = GUICtrlCreateRadio("_Section_2.1", 170, $iSectionBaseCoord + 14, 89, 25) ; So these must be within the y coord range 90-180 - which they are $Radio2 = GUICtrlCreateRadio("_Section_2.2", 170, $iSectionBaseCoord + 36, 89, 25) $Radio3 = GUICtrlCreateRadio("_Section_2.3", 170, $iSectionBaseCoord + 58, 89, 25) GUICtrlSetState(-1, $GUI_CHECKED) ; You also need to activate the section _GUIExtender_Section_Activate($hGUI, $iSection_2) ; Now the section can be activated programatically by the button ;$iSection_3 = _GUIExtender_Section_Create($hGUI, 90, 160) ; you are sking this section to begin at 90 (which is where the previous started so the call will error $iSection_3 = _GUIExtender_Section_Create($hGUI, -1, 160) ; Now you will have section starting after the previous (180) and 160 deep $iSectionBaseCoord = _GUIExtender_Section_BaseCoord($hGUI, $iSection_3) ;$Radio4 = GUICtrlCreateRadio("_Section_3", 170, 104, 89, 25) ; So these are not within the section boundaries (180-340) and will not be recognised by the UDF ;$Radio5 = GUICtrlCreateRadio("_Section_3", 170, 136, 89, 25) ;$Radio6 = GUICtrlCreateRadio("_Section_3", 170, 168, 89, 25) $Radio4 = GUICtrlCreateRadio("_Section_3.1", 170, $iSectionBaseCoord + 44, 89) $Radio5 = GUICtrlCreateRadio("_Section_3.2", 170, $iSectionBaseCoord + 66, 89) $Radio6 = GUICtrlCreateRadio("_Section_3.3", 170, $iSectionBaseCoord + 88, 89) ; You also need to activate this sectiontoo _GUIExtender_Section_Activate($hGUI, $iSection_3) ; These need to be created in the section which will hold them, so I have moved them there Global $cInput = GUICtrlCreateInput("0", 92, 238, 10, 17) Global $cUpDown_Min = GUICtrlCreateUpdown($cInput) Global $cTimer_Label = GUICtrlCreateLabel("12", 56, 240, 30, 15) ; $iSection_4 = _GUIExtender_Section_Create($hGUI, 160, -1) ; Again you are asking the section to start in the wrong place which will error $iSection_4 = _GUIExtender_Section_Create($hGUI, -1, -1) ; All you can do is to ask it fill the remaoining space - all 20 pixels of it!!! $iSectionBaseCoord = _GUIExtender_Section_BaseCoord($hGUI, $iSection_4) ;$Radio4 = GUICtrlCreateRadio("_Section_4", 170, 204, 89, 25) ; And again these are outside the section boundaries (340-360) ;$Radio5 = GUICtrlCreateRadio("_Section_4", 170, 236, 89, 25) ;$Radio6 = GUICtrlCreateRadio("_Section_4", 170, 268, 89, 25) $Radio7 = GUICtrlCreateRadio("_Section_4.1", 170, $iSectionBaseCoord, 89, 20) ; This ection is not sctivated and so will remain static under whichever of 2 or 3 is showing _GUIExtender_Section_Create($hGUI, -99) ; And you never close the section definiton ; So where are these supposed to be? Looking at the coordinate they should be in Section 3, so put them there ;Global $cInput = GUICtrlCreateInput("0", 92, 238, 10, 17) ;Global $cUpDown_Min = GUICtrlCreateUpdown($cInput) ;Global $cTimer_Label = GUICtrlCreateLabel("12", 56, 240, 30, 15) GUISetState(@SW_SHOW) ;~ _GUIExtender_Section_Action($hGUI, $iSection_2, True) _GUIExtender_Section_Action($hGUI, $iSection_3, 0, 9) ; Closing section 3 ;_GUIExtender_Section_Action($hGUI, $iSection_4, 0, 0) ; This section is static so no point While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button ;MsgBox(0, _GUIExtender_Section_State($hGUI, $iSection_2), 'here it is showing as static - return of - 2') ; of course becasue you never activated it ;If _GUIExtender_Section_State($hGUI, $iSection_2) = 2 Then ; _GUIExtender_Section_Action($hGUI, $iSection_2, False) ; _GUIExtender_Section_Action($hGUI, $iSection_3, True) ;Else ; _GUIExtender_Section_Action($hGUI, $iSection_3, False) ; _GUIExtender_Section_Action($hGUI, $iSection_2, True) ;EndIf ; just toggle the sections _GUIExtender_Section_Action($hGUI, $iSection_2, 9) _GUIExtender_Section_Action($hGUI, $iSection_3, 9) EndSwitch WEnd Quite a useful functionality - thanks for suggesting it. I will now do some more testing on the function code and should release a new UDF before too long. M23
    1 point
  11. In that example I would use Local, unless that variable is used also within another scope i.e. a function declaration, which in that case it should be Global.
    1 point
  12. Even after nearly 2 years, I still like this approach to writing AutoIt code
    1 point
  13. Hmmm. So from now on I will explain to beginners : "you need a global variable ? then use Local, because Global is not reliable" And when they will ask me : "so what is the usefulness of this Global keyword mentioned a lot of times in the help file ?" I will answer : "I have a temporary headache. Please ask czardas"
    1 point
  14. Also, why not insert code snippets directly into word instead of attachments? TD
    1 point
  15. Or in C# // C# - Person example class Person { // Properties. How lovely these are! =) public int Age = { get; set; } public string Name = { get; set; } public Person(string name, int age) { Age = age; Name = name; } public override string ToString() { return String.Format("Name: %s, Age: %d", Name, Age); } }
    1 point
  16. This function, StringSplit, can be used also.
    1 point
×
×
  • Create New...