Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/24/2024 in all areas

  1. [BUGFIX VERSION] - 6 Apr 24 Fixed: UDF failed if header colours were initialised but not specifically set. New UDF in the zip below. -------------------------------------------------------------------------------------- Note: This is a new recoded and expanded version of my earlier UDF of the same name. If you move to this new version there might well be several script-breaking changes, particularly when setting which columns are to be editable. Please read the "Beginner's Guide" and look at the included example scripts to see where things have changed. -------------------------------------------------------------------------------------- This UDF allows you to do much more with ListView controls (either native or UDF created): Edit the content with plain text, combos or date-time pickers - and edit the headers too Move rows within the ListView Drag rows both within the ListView and to other ListViews in the same GUI (or not as required) Insert and delete columns and rows Sort columns by simply clicking the header Colour individual ListView items and headers Only select a single cell rather then the entire row Save and load entire ListViews For the advanced user: If you use certain Windows message handlers (In particular WM_NOTIFY) in your script, please read the function headers for the equivalent handlers within the UDF. Here is the UDF, with 6 examples and the guide, in zip format: GUIListViewEx.zip Credit to: martin (basic drag code), Array.au3 authors (array functions), KaFu and ProgAndy (font function), LarsJ (colouring code) Happy to take compliments or criticism - preferably the former! M23
    1 point
  2. It's good to report these quirks so I can check them, but just to have a period of time to sit down a go over this whole indent function.
    1 point
  3. That whole Ident-fix routine is still on my todo list to fix/review/rewrite....
    1 point
  4. 1 #include <StaticConstants.au3> Local $MyGui = GUICreate("TaskPin GUI", 640, 480, -1, -1) GUICtrlCreateLabel("", 0, 0, 640, 480, $SS_GRAYFRAME) GUISetState(@SW_SHOW) MouseMove(@DesktopWidth / 2, @DesktopHeight / 2, 1) ;********************************** While 1 Switch GUIGetMsg() Case -3 ;$GUI_EVENT_CLOSE ExitLoop EndSwitch $aTrigger = GUIGetCursorInfo($MyGui) If $aTrigger[4] = 0 Then ConsoleWrite("mouse outside a Window region" & @CRLF) Sleep(10) WEnd ;********************************** 2 #include <StaticConstants.au3> Local $MyGui = GUICreate("TaskPin GUI", 640, 480, -1, -1) GUISetState(@SW_SHOW) MouseMove(@DesktopWidth / 2, @DesktopHeight / 2, 1) ;********************************** While 1 Switch GUIGetMsg() Case -3 ;$GUI_EVENT_CLOSE ExitLoop EndSwitch If Not IsMouseOverWin($MyGui) Then ConsoleWrite("mouse outside a Window region" & @CRLF) Sleep(10) WEnd ;********************************** Func IsMouseOverWin($hWnd) Local $aMPos = MouseGetPos() Local $aWPos = WinGetPos($hWnd) ;$aWPos[0]=Xposition ;$aWPos[1]=Yposition ;$aWPos[2]=Width ;$aWPos[3]=Height If $aMPos[0] > $aWPos[0] And $aMPos[1] > $aWPos[1] And $aMPos[0] < $aWPos[0] + $aWPos[2] And $aMPos[1] < $aWPos[1] + $aWPos[3] Then Return True EndIf Return False EndFunc ;==>IsMouseOverWin
    1 point
  5. Melba23

    Autoit password style

    1stPK, M23
    1 point
  6. Ok... is see which option you refer to. No idea why that works the way it does as it simply seems to deselect at pressing RightMouse.
    1 point
  7. I need to test a bit more but you could test the change I think is the reason for this by replacing line 821 in AutoItAutoComplete.lua with: table.insert(tStartKeywords, ddsort .. ' ~#~' .. ddentry) ... adding a space before the tiled sign forcing the ddsort keyword to end with an space for proper sorting.
    1 point
  8. I will have a look, but sorting is not as straightforward as simply sorting an array: the logic adds an key in front of the keyword to determine the priority depending on the start position of the found typed string in the keyword.
    1 point
  9. Updated the initial post with a link to the latest updated SciTE4AutoIt3 beta installer and portable zip file. These contain all the current/latest versions so no need for other stuff after the update. Don't forget to make a Backup first to ensure there is an easy rollback in case of issues. Jos
    1 point
  10. water

    Read out excel to array

    Use _Excel_RangeFind to get the row where your key is located. Then use the Offset method to get the value of the column right to it. $aResult = _Excel_RangeFind($oExcel, "key", "column:column") $vValue = $oExcel.Range($aResult[0][2]).Offset(0, 1).Value
    1 point
  11. Try this function: ;code by Eukalyptus Func _GDIPlus_ImageLoadFromMultiPageImage($sPath) Local $hImage = _GDIPlus_ImageLoadFromFile($sPath) If @error Then Return SetError(1, 1, False) Local $iCount = _GDIPlus_ImageGetFrameDimensionsCount($hImage) If Not $iCount Then Return SetError(1, 2, False) Local $aList = _GDIPlus_ImageGetFrameDimensionsList($hImage) If @error Or Not IsArray($aList) Then Return SetError(1, 3, False) Local $iPixelFormat, $iImageW, $iImageH Local $aReturn[1], $iCnt = 0 For $i = 1 To $aList[0] $iCount = _GDIPlus_ImageGetFrameCount($hImage, $aList[$i]) For $j = 1 To $iCount _GDIPlus_ImageSelectActiveFrame($hImage, $aList[$i], $j) $iCnt += 1 ReDim $aReturn[$iCnt + 1] $iPixelFormat = _GDIPlus_ImageGetPixelFormat($hImage) $iImageW = _GDIPlus_ImageGetWidth($hImage) $iImageH = _GDIPlus_ImageGetHeight($hImage) $aReturn[$iCnt] = _GDIPlus_BitmapCloneArea($hImage, 0, 0, $iImageW, $iImageH, $iPixelFormat) Next Next _GDIPlus_ImageDispose($hImage) $aReturn[0] = $iCnt Return $aReturn EndFunc ;==>_GDIPlus_ImageLoadFromMultiPageImage Func _GDIPlus_ImageGetFrameDimensionsCount($hImage) Local $aResult = DllCall($ghGDIPDll, "int", "GdipImageGetFrameDimensionsCount", "handle", $hImage, "uint*", 0) If @error Then Return SetError(@error, @extended, -1) If $aResult[0] Then Return SetError(10, $aResult[0], False) Return $aResult[2] EndFunc ;==>_GDIPlus_ImageGetFrameDimensionsCount Func _GDIPlus_ImageGetFrameDimensionsList($hImage) Local $iI, $iCount, $tBuffer, $pBuffer, $aPropertyIDs[1], $aResult $iCount = _GDIPlus_ImageGetFrameDimensionsCount($hImage) If @error Then Return SetError(@error, @extended, -1) $tBuffer = DllStructCreate("byte[" & $iCount * 16 & "]") $pBuffer = DllStructGetPtr($tBuffer) $aResult = DllCall($ghGDIPDll, "int", "GdipImageGetFrameDimensionsList", "handle", $hImage, "ptr", $pBuffer, "int", $iCount) If @error Then Return SetError(@error, @extended, -1) If $aResult[0] Then Return SetError(10, $aResult[0], False) ReDim $aPropertyIDs[$iCount + 1] $aPropertyIDs[0] = $iCount For $iI = 1 To $iCount $aPropertyIDs[$iI] = _WinAPI_StringFromGUID($pBuffer) $pBuffer += 16 Next Return $aPropertyIDs EndFunc ;==>_GDIPlus_ImageGetFrameDimensionsList Func _GDIPlus_ImageSaveAddImage($hImage, $hImageNew, $pParams) Local $aResult = DllCall($ghGDIPDll, "int", "GdipSaveAddImage", "handle", $hImage, "handle", $hImageNew, "ptr", $pParams) If @error Then Return SetError(@error, @extended, False) If $aResult[0] Then Return SetError(10, $aResult[0], False) Return $aResult[0] = 0 EndFunc ;==>_GDIPlus_ImageSaveAddImage Func _GDIPlus_ImageGetFrameCount($hImage, $sDimensionID) Local $tGUID, $pGUID, $aResult $tGUID = _WinAPI_GUIDFromString($sDimensionID) $pGUID = DllStructGetPtr($tGUID) $aResult = DllCall($ghGDIPDll, "int", "GdipImageGetFrameCount", "handle", $hImage, "ptr", $pGUID, "uint*", 0) If @error Then Return SetError(@error, @extended, -1) If $aResult[0] Then Return SetError(10, $aResult[0], -1) Return $aResult[3] EndFunc ;==>_GDIPlus_ImageGetFrameCount Func _GDIPlus_ImageSelectActiveFrame($hImage, $sDimensionID, $iFrameIndex) Local $pGUID, $tGUID, $aResult $tGUID = DllStructCreate($tagGUID) $pGUID = DllStructGetPtr($tGUID) _WinAPI_GUIDFromStringEx($sDimensionID, $pGUID) $aResult = DllCall($ghGDIPDll, "uint", "GdipImageSelectActiveFrame", "handle", $hImage, "ptr", $pGUID, "uint", $iFrameIndex) If @error Then Return SetError(@error, @extended, False) If $aResult[0] Then Return SetError(10, $aResult[0], False) Return True EndFunc ;==>_GDIPlus_ImageSelectActiveFrame It will return an array with bitmap handles. Br, UEZ
    1 point
  12. I've been looking at some C++ function that did this by saving an image to a stream and doing it in memory, lead me to a post by the one and only UEZ, modified the function I found and surprisingly enough, it's exactly what I needed. Func _GDIPlus_SaveImageToStream($hBitmap, $iQuality = 50, $Encoder = "jpg") ;coded by Andreik, modified by UEZ, FS Local $tParams Local $tData Local $pData Local $pParams Local $sImgCLSID = _GDIPlus_EncodersGetCLSID($Encoder) Local $tGUID = _WinAPI_GUIDFromString($sImgCLSID) Local $pEncoder = DllStructGetPtr($tGUID) If $Encoder == "jpg" Or $Encoder == "jpeg" Then $tParams = _GDIPlus_ParamInit(1) $tData = DllStructCreate("int Quality") DllStructSetData($tData, "Quality", $iQuality) ;quality 0-100 $pData = DllStructGetPtr($tData) _GDIPlus_ParamAdd($tParams, $GDIP_EPGQUALITY, 1, $GDIP_EPTLONG, $pData) $pParams = DllStructGetPtr($tParams) Else $pParams = 0 EndIf Local $hStream = DllCall("ole32.dll", "uint", "CreateStreamOnHGlobal", "ptr", 0, "bool", True, "ptr*", 0) If @error Then Return SetError(1, 0, 0) $hStream = $hStream[3] DllCall($ghGDIPDll, "uint", "GdipSaveImageToStream", "ptr", $hBitmap, "ptr", $hStream, "ptr", $pEncoder, "ptr", $pParams) _GDIPlus_BitmapDispose($hBitmap) Local $hMemory = DllCall("ole32.dll", "uint", "GetHGlobalFromStream", "ptr", $hStream, "ptr*", 0) If @error Then Return SetError(2, 0, 0) $hMemory = $hMemory[2] Local $iMemSize = _MemGlobalSize($hMemory) Local $pMem = _MemGlobalLock($hMemory) $tData = DllStructCreate("byte[" & $iMemSize & "]", $pMem) Local $bData = DllStructGetData($tData, 1) Local $tVARIANT = DllStructCreate("word vt;word r1;word r2;word r3;ptr data;ptr") DllCall("oleaut32.dll", "long", "DispCallFunc", "ptr", $hStream, "dword", 8 + 8 * @AutoItX64, "dword", 4, "dword", 23, "dword", 0, "ptr", 0, "ptr", 0, "ptr", DllStructGetPtr($tVARIANT)) ;http://msdn.microsoft.com/en-us/library/windows/desktop/ms221473(v=vs.85).aspx _MemGlobalFree($hMemory) Return $bData EndFunc ;==>_GDIPlus_SaveImageToStream P.S. Thanks for the "help".
    1 point
  13. After I saw this example I´ve decided to change a litle here and add a litle more there and make a MultiTiff To PDF creator script. I´ve changed a litle the Comment ... I hope you don´t mind Who knows ... maybe we shall make a PDFCreator clone in AutoIt Just kiding ... Keep the good work #cs TIFF2PDF --------- Multi-Page TIFF to PDF file converter THIS SCRIPT NEEDS THE FREEIMAGE LIBRARY DLL FILE (FreeImage.dll) IN THE SCRIPT DIRECTORY AND ALSO THE PDFFORGE LYBRARY DLL FILE (pdfforge.dll) AND iText LIBRARY DLL (itextsharp.dll) FreeImage library is at http://freeimage.sourceforge.net/download.html PdfForge libraries are at http://pdfcreator.svn.sourceforge.net/viewvc/pdfcreator/tags/Version%201.2.1/PlugIns/pdfforge/ #ce ;Input file to split $input = FileOpenDialog("Choose a TIFF file", @ScriptDir, "TIFF files (*.TIF)") ;Output file convention is simple: I remove the extension, append an underscore '_'. ;The loop (below) will further append the page number and add the ".jpg" extension. ;If I picked a file named "IMAGE.TIF", the output will be "IMAGE_1.JPG", "IMAGE_2.JPG" and so on. $output = StringTrimRight($input,4) & "_" ;Filename of the FreeImage Dll. $FI_DLL = @ScriptDir & "\FreeImage.dll" ;Create PDFForge.dll instance $PdfForge = ObjCreate("pdfforge.pdf.pdf") ;Theses are constants used by FreeImage. ;I got the values from the header file (FreeImage.h) included with the FreeImage dll download. ;Global const $FIF_JPEG = 2 Global const $FIF_TIFF = 18 ;Some basic check... does the TIFF file exists? if FileExists($input) then ;Yet another check - does the FreeImage DLL is there? if FileExists($FI_DLL) then ;At this point, I start the process! ;Opens the FreeImage DLL $FI = DllOpen($FI_DLL) ;Initialize the library (mandatory according to the documentation0 DllCall($FI,"none","_FreeImage_Initialise@4","dword",1) ;Opens the input TIFF file. $TIFF_IMAGE = DllCall($FI,"long_ptr","_FreeImage_OpenMultiBitmap@24","dword", $FIF_TIFF, "str", $input, "dword", 0, "dword", 1, "dword", 0, "dword", 0) ;Gets the number of pages from the TIFF image $PAGE_COUNT = DllCall($FI, "int", "_FreeImage_GetPageCount@4", "long_ptr", $TIFF_IMAGE[0]) ;Page index are 0-based. For a loop, I'll need to go from 0 to (PAGE_COUNT -1) $PAGE_COUNT = $PAGE_COUNT[0] -1 ;Declare Image2PDF array Dim $imageFilenames[$PAGE_COUNT+1] ;The way FreeImage lib works, you need to "lock" a single page at a time to work with it. ;I understands that this will actually copy the page into a separate bitmap, so I can play with it ;In my case, I just want to save each page into an individual JPG file for $i = 0 to $PAGE_COUNT ;Get a page from the multi-page TIFF file $BITMAP = DllCall($FI, "long_ptr", "_FreeImage_LockPage@8", "long_ptr", $TIFF_IMAGE[0], "dword", $i) ;Save it as a JPG file $ret = DllCall($FI, "dword", "_FreeImage_Save@16","dword", $FIF_TIFF, "long_ptr", $BITMAP[0], "str", $i &".tiff", "dword", 0) ;Save the file´s names into array $imageFilenames[$i] = @ScriptDir &"\" &$i &".tiff" ;Unlock the page. $ret = DllCall($FI, "none", "_FreeImage_UnlockPage@12", "long_ptr", $TIFF_IMAGE[0], "long_ptr", $BITMAP[0], "dword", 0) ;Free the RAM? AutoIT tends to crash at the end if I do not do this (Can't tell - I'm no developper) $BITMAP = 0 next ;Output the PDF file $PdfForge.Images2PDF_2($imageFilenames, StringTrimRight($input, 4) &".pdf", 1) ;MsgBox(64,"Info","Process is done." & @crlf & $input & " were splitted into " & $PAGE_COUNT+1 & " individual TIF files") MsgBox(64,"Info","Process is done." &StringTrimRight($input, 4) &".pdf has been created with " &$PAGE_COUNT+1 &" pages from " &StringTrimRight($input, 4) &" file") ;Close the TIFF file $ret = DllCall($FI,"long","_FreeImage_CloseMultiBitmap@8","long_ptr", $TIFF_IMAGE[0], "dword", 0) ;Again, if I do not reassign some variables like this, I usually have a crash when the program ends. $TIFF_IMAGE = 0 ;This will "DeInitialize" the FreeImage lib ;I *think* this does more or less the same as DllClose(), but I can be wrong. DllCall($FI,"none","_FreeImage_DeInitialise@0") Else MsgBox(16,"FreeImage DLL not found","The FreeImage DLL was not found in the script directory." & @crlf & "(" & $FI_DLL & ")" & @crlf & @crlf & "You can get if from this website:" & @crlf & "http://freeimage.sourceforge.net/download.html") EndIf Else MsgBox(16,"File not found","You should have a TIFF file named " & $input & " in this script directory. Check this and try again") EndIf
    1 point
×
×
  • Create New...