Jump to content

Search the Community

Showing results for tags 'image'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum
  • AutoIt

Calendars

  • Community Calendar

Found 70 results

  1. Howdy, I've gone through a lot of au3 forums, and I once had a working Imagesearch script that I got from here. However, and i'm just totally not sure how but my imagesearch scripts aren't working anymore. I'm not new to au3 but i'm not the most experienced with it's syntax/commands. Anyways, I've looked over the big threads involving imagesearch. Does anyone have a working Imagesearch x64 for win10 that is currently working as of the date with the post. Dll's and what not is fine, just when I tell the script to run, I want to be able to find the image on the screen! Can't find a working copy so if anyone has one please send it my way lol. I've taken all the imagesearch downloads and what not and have played with them but I can't get any of them working on my end, despite others saying they're working. Thanks.
  2. Special thanks: AdmiralAlkex, Melba23, MrCrearoR, Dragon Warrior 3, SDL MapIt is a tile world editor. MapIt was built around the concept of reversing Dragon Warrior map images. MapIt can take image input and produce a tile and world array. Changing and replacing tile / world data is easy. B/c tile world editor. CTRL+R in image above to signal replace tile action and I use "G" to Get the tile under mouse. A full list of hotkeys can be assigned in the: Help Menu\Hotkeys MapParser is a C++ project that scans images for unique tiles. MapIt can be downloaded without MapParser. MapParser can be toggled off in the Scan_Image dialog. Without MapParser, MapIt will use the Scan_Tiles() function written in AutoIt ; which is 100 * slower Idk. If MapParser.exe will not run for you: Installing Visual C++ Redistributable for Visual Studio 2015 should fix it: https://www.microsoft.com/en-us/download/details.aspx?id=48145 You can start with example world and tiles. Example world was made following these steps: Started with a tile map image of DragonWarrior3 town of: Reeve From MapIt World Menu \ New \ Scan_Image dialog, I set the area to exclude the key legend to the far right of image. After scanning the map image to world and tile array. I removed a few of the map artifacts. More work could be done on this world; removing unwanted tiles, but it is fine for now. I saved my world to disk. This creates folder: Worldname: Containing folder of Tiles and a Worldname.txt. Using The Gimp, I edited some tiles to have a transparent color: Stairs, Trees, Desk Tables, Chest-of-drawers, Chairs, Signs, Doors, Beds. I changed the world layers to 2: World Menu \ Properties. F9 Finds all selected tile on current layer and changes to a new selected tile on new layer. I used F9 to change all Trees on layer: 0 to Trees on layer: 1. Then I used F9 to change all Trees on layer: 0 to Grass on layer: 0 In this video you can see how I used the Tile Menu \ Replace From Disk option to remap tile images to my custom tiles. Conveniently my tiles already have a transparent pixel. See video for how that was done: To use the example world: First unzip the world save file: http://songersoft.com/programming/mapit/worlds/Reeve_Swapped.zip From the World Menu: choose \Load Navigate to the Reeve_Swapped.txt located in the extracted zip. Or you can scan any image. The map images I used are here: http://www.realmofdarkness.net/dq/games/nes/dw3/maps/world For download, videos, and example of created world file data; please visit the MapIt webpage: http://songersoft.com/programming/mapit/mapit_about.phtml
  3. HELLO GUYS I'm a work on a background see and click bot project I can complete it if your help me (using imagesearch , gdi+ and fastfind)
  4. I would like to know if it's possible to pass an image recognition (captcha) system. What are the ways to achieve this? Just the references or links is enough for me by now. Thanks by now! Thanks!
  5. Dear AutoIT Community. I am currently working on a program that will display lots of images in a scroll down GUI. I create the GUI based on the number of images, which works fine. But all images I place using GuiCtrlCreatePic above a threshold of around 32000 pixels (cant say exactly) are placed at negative locations and finally will reach 0 again and will then populate on top of the images placed there before. For $i = 1 To $Images[0] ; Get picture dimensions $hImage = _GDIPlus_ImageLoadFromFile($ImgRep & $Images[$i]) $iX = _GDIPlus_ImageGetWidth($hImage) $iY = _GDIPlus_ImageGetHeight($hImage) _GDIPlus_ImageDispose($hImage) ; Resize & place images in GUI $Pic[$i] = GUICtrlCreatePic($ImgRep & $Images[$i], $Spacer, Round($yPos, 0), $MaxImgWidth, $MaxImgWidth * ($iY / $iX)) $yPos = $yPos + $MaxImgWidth * ($iY / $iX) + $Spacer $log = $log & "|" & $yPos $currentlut = $Images[1] Next I have found a limit at 32767 pixels for some GUI elements when googling around. Can someone tell me how to circumvent that? thanks! cheers Felix
  6. If possible please add or edit the comments to explain how this works. ;includes functions from other things #include <GDIPlus.au3> #include <ScreenCapture.au3> ;hotkeys HotKeySet("{ESC}", _exit) HotKeySet("{F1}", _scan) ;global variables Global $win_title ;name of the window Global $area_x ; Global $area_y ; Global $area_w ; Global $area_h ; Global $cursor ; Global $rect_file ; Global $hbmpscreen ; Global $i= 1043 ;moves the rect Global $ii= 378 ;moves the rect Global $x=1044 ;inner rect offset Global $y=501 ;inner rect offset Global $hbmprect ;image inside rect Global $hscreen ;image whole screen _GDIPlus_Startup() ;? ;display hotkeys on screen ToolTip("Press F1 to scan | Press ESC to Exit",0,0) ;infinite loop to keep prog running While 1 Sleep(100) WEnd Func _scan() ;~ reads your screen area: _read() ;~ converts screen captured into bmp _convert() ;~ . Loads converted bmp to be read _loadBMP() ;~ compares the bmp of your scanned screen to the actual screen that is being displayed _compare() EndFunc ;reads screen Func _read() $hscreen = _ScreenCapture_CaptureWnd("", WinGetHandle($win_title), $area_x, $area_y, $area_x + $area_w, $area_y + $area_h, $cursor) EndFunc ;converts screen into bmp Func _convert() _GDIPlus_BitmapCreateFromHBITMAP($hscreen) EndFunc ;loads converted screen Func _loadBMP() _GDIPlus_BitmapCreateFromFile($rect_file) EndFunc ;compares savedBMP to current screen Func _compare() ;If( below code ) = ( below code ) Then If _GDIPlus_BitmapGetPixel($hbmpscreen, ($i + $x) - $area_x, ($ii + $y) - $area_y) = _GDIPlus_BitmapGetPixel($hbmprect, $x, $y) Then ;display message box titled found with a message of found MsgBox("","","found") ;if above is not correct then EndIf EndFunc ;exit func Func _exit() Exit EndFunc
  7. Hi, i searched some topics but cannot found a simple way to do that: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 615, 438, 192, 124) GUISetState(@SW_SHOW) ; I tried this but user reported that it work in 2006, not seems work actually $filemenu = GUICtrlCreateMenu ("&File") $fileitem = GUICtrlCreateMenuitem ("Open",$filemenu) GuiCtrlSetImage($fileitem, "shell32.dll", 4) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Also tried: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 615, 438, 192, 124) GUISetState(@SW_SHOW) $filemenu = TrayCreateMenu("&File") $fileitem = TrayCreateItem("Open",$filemenu) ;GuiCtrlSetImage($fileitem, "shell32.dll", 4) ;GuiCtrlSetImage(TrayItemGetHandle($fileitem), "shell32.dll", 4) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Well.. thanks in advance! Ok. I found this working example from Yashied. If i cannot find a simple then i will go with it #Include <GUIConstantsEx.au3> #Include <GUIMenu.au3> #Include <Constants.au3> #Include <WinAPI.au3> #Include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Global $hMenu, $hForm, $hFile = 1000, $idNew, $idExit $hForm = GUICreate('Menu', 400, 300) $hFile = _GUICtrlMenu_CreateMenu() _GUICtrlMenu_InsertMenuItem ($hFile, 0, ' &Favorites', $idNew) _GUICtrlMenu_InsertMenuItem ($hFile, 1, '', 0) _GUICtrlMenu_InsertMenuItem($hFile, 2, ' E&xit', $idExit) $hMenu = _GUICtrlMenu_CreateMenu() _GUICtrlMenu_InsertMenuItem($hMenu, 0, '&File', 0, $hFile) _GUICtrlMenu_SetMenu($hForm, $hMenu) _GUICtrlMenu_SetItemBmp($hFile, 0, _CreateBitmapFromIcon(_WinAPI_GetSysColor($COLOR_MENU), @SystemDir & '\shell32.dll', 43, 16, 16)) _GUICtrlMenu_SetItemBmp($hFile, 2, _CreateBitmapFromIcon(_WinAPI_GetSysColor($COLOR_MENU), @SystemDir & '\shell32.dll', 27, 16, 16)) GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func _CreateBitmapFromIcon($iBackground, $sIcon, $iIndex, $iWidth, $iHeight) Local $hDC, $hBackDC, $hBackSv, $hIcon, $hBitmap $hDC = _WinAPI_GetDC(0) $hBackDC = _WinAPI_CreateCompatibleDC($hDC) $hBitmap = _WinAPI_CreateSolidBitmap(0, $iBackground, $iWidth, $iHeight) $hBackSv = _WinAPI_SelectObject($hBackDC, $hBitmap) $hIcon = _WinAPI_PrivateExtractIcon($sIcon, $iIndex, $iWidth, $iHeight) If Not @error Then _WinAPI_DrawIconEx($hBackDC, 0, 0, $hIcon, 0, 0, 0, 0, $DI_NORMAL) _WinAPI_DestroyIcon($hIcon) EndIf _WinAPI_SelectObject($hBackDC, $hBackSv) _WinAPI_ReleaseDC(0, $hDC) _WinAPI_DeleteDC($hBackDC) Return $hBitmap EndFunc ;==>_CreateBitmapFromIcon Func _WinAPI_PrivateExtractIcon($sIcon, $iIndex, $iWidth, $iHeight) Local $hIcon, $tIcon = DllStructCreate('hwnd'), $tID = DllStructCreate('hwnd') Local $Ret = DllCall('user32.dll', 'int', 'PrivateExtractIcons', 'str', $sIcon, 'int', $iIndex, 'int', $iWidth, 'int', $iHeight, 'ptr', DllStructGetPtr($tIcon), 'ptr', DllStructGetPtr($tID), 'int', 1, 'int', 0) If (@error) Or ($Ret[0] = 0) Then Return SetError(1, 0, 0) EndIf $hIcon = DllStructGetData($tIcon, 1) If ($hIcon = Ptr(0)) Or (Not IsPtr($hIcon)) Then Return SetError(1, 0, 0) EndIf Return $hIcon EndFunc ;==>_WinAPI_PrivateExtractIcon Ok, i noticed that is a pain create submenu with _GUICtrlMenu_CreatePopup to do like in Tray, and Tray better located, then i need images/icon with Tray functions, some workaround??
  8. I am busy with building a solution for change monitoring of VOIP call program and to be properly automated means among others need for some limited OCR functionality. Current works of others are way too much overkill for this case what makes the need to build it myself. But to do it properly I significantly have to increase my knowledge about digital graphics management. For now I already have discovered here and there some mind blowing Autoit miracles what can be achieved with Windows own possibilities to manipulate that what is output to the monitor. And as far I can judge there are 2 options to process graphics without use of any external libraries like ImageMagick, FreeImage and so on. These are: WinAPI GDIPlus It is for me quite obvious to have various holes in general understanding of graphics and it is once more very clear what advantages gives consistent general study in 1 or another official institutions like University. Cause there you are introduced into certain domain of knowledge in a way which usually has been perfected over long period of time. So you are not overloaded by stuff which requires a certain amount of information to be initially clear for you. For example, before starting to solve physics you first learn to read, count and so on and then move to subjects like physics. Though in my case opportunity to study in such educational system I had only for 8 years, from my 7th to 15th year of age in the country that was falling apart now Ukraine but used to be USSR, was all what it was. After have immigrated to Netherlands possibilities to study further haven't occur. And this therefor causes often various implications when going deep in that or another field of practical knowledge acquiring for any needed physical result, like programming to perform enormous amount of tasks. In this particular case automating VOIP call program. Anyway, right now I think the best direction to move is to concentrate on as basic as possible image management and if someone would maybe explain in general what is a pixel will definitely help. Particularly I am very curious about how to do picture manipulations in Autoit. Especially would help a lot to produce eventually following functions: createImage($imageFileName, $width, $height, $color) readImagePixel($imageFileName, $x, $y) writeImagePixel($imageFileName, $x, $y) I do not know exactly how image is handled in computer but preferably above mentioned functions should deal with so far possible origin of graphics creation on computer. But nevertheless I definitely would love to hear any proposition for solution. The problem with explaining screenshots: VOIPConnect full Window Part of Window with control to monitor for changes Exact location of area where actual changes occur and have to be processed It comes down to a rectangle of approximately 51 pixel wide and 7 pixel high. In fact if I get to learn as far as to be able exactly read, write and compare 2 images consistently across different computers I could narrow down then even further the area to watch as little as a square of 2-5 pixels wide. To finish here is last detail about particularly no need for ultra fast solution at all. This because it is needed only once when it is first run on a new computer and to have to wait few minutes while it is being set instead of just a few seconds make no sence. This is it and what I too think to do beside this very particular case is to purify out beautiful generic Autoit functions for core image manipulation by using WinAPI or/and GDIPlus.
  9. Func dg_get_images() $x1=0 $y1=0 ;MsgBox(0,"start","start") do $result = _ImageSearch("C:\Users\Server\Desktop\my project\image.png",1,$x1,$y1,0) until $result = 1; if $result=1 Then MouseMove($x1,$y1,3) MouseClick("left", $x1,$y1, 1) WinWait("[Title:TightVNC File Transfer]", "", 10) EndIf this code works when i search the image, but when i change the location of the desktop icon it can't find the desktop icon anymore. i wanna try image search area. but i don't know how to use it because i cant understand the parameter for the image search area. please help me how to solve it thank you in advance.
  10. I would like to download the first 5 images in a folder. THX. #include <INet.au3> #include <String.au3> #include <Array.au3> Global $sSource, $aImgURL, $sKeyWord $sKeyWord = "pug" $sSource = _INetGetSource("http://www.google.com/search?q=" & $sKeyWord & "&tbm=isch") $aImgURL = _StringBetween($sSource, 'src="', '"') For $x = 1 to UBound($aImgURL)-1 ConsoleWrite($aImgURL[$x]&@CRLF) Next
  11. Hello everybody.. i have this picture here *attached* and this script here: $ImageToReadPath = @MyDocumentsDir & "\GDIPlus_Image2.jpg" $ResultTextPath = @MyDocumentsDir & "\Result" $OutPutPath = $ResultTextPath & ".txt" $TesseractExePath = @MyDocumentsDir & "\Tesseract.exe" ShellExecuteWait($TesseractExePath, '"' & $ImageToReadPath & '" "' & $ResultTextPath & '"', "", "", @SW_HIDE) If @error Then Exit MsgBox(0, "Error", @error) EndIf MsgBox(0, "Result", FileRead($OutPutPath)) FileDelete($OutPutPath) but tesseract doesnt recognized the correct word... and gives me trash back... this is the image >> and the result was >> "samm" the image was an normal jpg and generated with this code here: _ScreenCapture_Capture(@MyDocumentsDir & "\GDIPlus_Image2.jpg", 712,268,853,284) Could anybody give me a hint what i can do better to get this easy image to text? thank u very much!!! Edit: i also tried to capture the screen as bmp with a higher resolution... nothing changed... _ScreenCapture_SetBMPFormat(4) _ScreenCapture_Capture(@MyDocumentsDir & "\GDIPlus_Image.bmp", 712,279,853,295)
  12. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=car.ico #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GDIPlus.au3> #include <File.au3> #include <Array.au3> #include <ColorConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ProgressConstants.au3> ; Declare array Dim $Images[1] ; Gets all JPG files in the current directory (@ScriptDir). Local $search = FileFindFirstFile("*.jpg") ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No JPG files could be found.") Exit EndIf ; Resize array While 1 If IsArray($Images) Then Local $Bound = UBound($Images) ReDim $Images[$Bound+1] EndIf $Images[$Bound] = FileFindNextFile($search) If @error Then ExitLoop WEnd ; Close the search handle FileClose($search) ; Create directory "resized" if not there yet $nymappe = InputBox("Mappe / Bil Navn", "Mappe / Bil Navn") If NOT FileExists(@ScriptDir & "\" & $nymappe & "\") Then DirCreate(@ScriptDir & "\" & $nymappe & "\") EndIf ; Loop for JPGs - gets dimension of JPG and calls resize function to resize to 50% width and 50% height For $i = 1 to Ubound($Images)-1 If $Images[$i] <> "" AND FileExists(@ScriptDir & "\" & $Images[$i]) Then Local $ImagePath = @ScriptDir & "\" & $Images[$i] _GDIPlus_Startup() Local $hImage = _GDIPlus_ImageLoadFromFile($ImagePath) Local $ImageWidth = _GDIPlus_ImageGetWidth($hImage) Local $ImageHeight = _GDIPlus_ImageGetHeight($hImage) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() ;MsgBox(0,"DEBUG", $ImageWidth & " x " & $ImageHeight) Local $NewImageWidth = ($ImageWidth / 100) * 15 Local $NewImageHeight = ($ImageHeight / 100) * 15 ;MsgBox(0,"DEBUG: " & $i,$Images[$i]) _ImageResize(@ScriptDir & "\" & $Images[$i], @ScriptDir & "\" & $nymappe & "\" & $Images[$i], $NewImageWidth, $NewImageHeight) EndIf Next ; Resize function Func _ImageResize($sInImage, $sOutImage, $iW, $iH) Local $hWnd, $hDC, $hBMP, $hImage1, $hImage2, $hGraphic, $CLSID, $i = 0 ;OutFile path, to use later on. Local $sOP = StringLeft($sOutImage, StringInStr($sOutImage, "\", 0, -1)) ;OutFile name, to use later on. Local $sOF = StringMid($sOutImage, StringInStr($sOutImage, "\", 0, -1) + 1) ;OutFile extension , to use for the encoder later on. Local $Ext = StringUpper(StringMid($sOutImage, StringInStr($sOutImage, ".", 0, -1) + 1)) ; Win api to create blank bitmap at the width and height to put your resized image on. $hWnd = _WinAPI_GetDesktopWindow() $hDC = _WinAPI_GetDC($hWnd) $hBMP = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH) _WinAPI_ReleaseDC($hWnd, $hDC) ;Start GDIPlus _GDIPlus_Startup() ;Get the handle of blank bitmap you created above as an image $hImage1 = _GDIPlus_BitmapCreateFromHBITMAP ($hBMP) ;Load the image you want to resize. $hImage2 = _GDIPlus_ImageLoadFromFile($sInImage) ;Get the graphic context of the blank bitmap $hGraphic = _GDIPlus_ImageGetGraphicsContext ($hImage1) ;Draw the loaded image onto the blank bitmap at the size you want _GDIPLus_GraphicsDrawImageRect($hGraphic, $hImage2, 0, 0, $iW, $iH) ;Get the encoder of to save the resized image in the format you want. $CLSID = _GDIPlus_EncodersGetCLSID($Ext) ;Generate a number for out file that doesn't already exist, so you don't overwrite an existing image. Do $i += 1 Until (Not FileExists($sOP & $i & "_" & $sOF)) ;Prefix the number to the begining of the output filename $sOutImage = $sOP & $i & "_" & $sOF ;Save the new resized image. _GDIPlus_ImageSaveToFileEx($hImage1, $sOutImage, $CLSID) ;Clean up and shutdown GDIPlus. _GDIPlus_ImageDispose($hImage1) _GDIPlus_ImageDispose($hImage2) _GDIPlus_GraphicsDispose ($hGraphic) _WinAPI_DeleteObject($hBMP) _GDIPlus_Shutdown() EndFunc Quality gets quite bad compared to using Paint / Photoshop when resizing with GDIPlus Any idea how to make the quality better? Thanks in advance
  13. Version v0.9.6 build 2017-05-14 beta

    242 downloads

    A collection of image filter effects usable with AutoIt! IMPORTANT: You are not allowed to sell this code or just parts of it in a commercial project or modify it and distribute it with a different name! Distributing copies of this UDF incl. _GDIPlus_BitmapApplyFilter.dll in compiled format (exe) must be free of any fee! More information can be found in the forum thread!
  14. Hi there. Sorry to bother again. I don't get the tutorials and examples... Let's say I want to display an image "E:\img\123.jpg" in a GUI. Usually I'd do that by using GUICtrlCreatePic($path, $x, $y, $width, $height). Unfortunately, the width and height are changing with every picture and they are unknown as well... First of all, how I can get the width and height of a given picture? And is there any way that doesn't require me to constantly delete and create that window from scratch? Thanks!
  15. Hello, Im a new AutoIt user, im from Spain and i would like to share here my own image search detection method. What's about it? It's not perfect, but with it you don't need to use any DLL file. You don't need to distribute the image file with your final AU3 Script, or Exe if compiled. The image size does not affect to the detection speed. It's bug free (i believe). You can find here as an attach file, a distro package with all you need, and it includes a simple how-to guide. Im going to paste here the how-to guide: How to use this AutoIt image detector: Point 1: Install JRE (Java Runtime Environment), without this you can't execute Java Applications (.jar files). Open the Java tool named AISD with double click on it, or "java -jar aisd.jar" in the cmd. In AISD, open the image you want to detect in your script. Remember: the upper left pixel of the image, MUST be a not common color in the background if you want a fast detection. Then you will get a script file if you want, or only a clipboard copied version, full ready to paste into your main script because this one comes with extra help codes. Anyway, the generated code is the $sign definition of the image (calm down, point 3 explains what is the $sign and it's easy). Point 2: Paste the mentioned code in your main script, and try to follow the sample_usage script. If you know how to write au3 codes, it should be very easy. In general terms, all you need is to include image_search.au3, and then you can use the func image_search($sign, $width, $height). You need also the get_image_sign() function, that calculates the first parameter for image_search(). The get_image_sign() function is the one you have generated at point 1. Point 3: image_search() returns the center point of the target image. The func needs the $sign from the image, width and height. This $sign is the "footprint" of the image, in the form of an array of 9 integers. In most of the cases the $sign should be enough to identify the image, this is useful because using the $sign instead of the real image let you get a small script and a fast detection. You can also delete the image once you get the $sign. This $sign has always the same size (those 9 integers, it does not matter if the original image is small or big). How can you define the $sign for a certain image?, you don't need to generate the $sign, AISD does (point 1). Follow the sample_usage script and you will get it. Files in this distro package: * AISD.jar: The already explained Java app. * image_search.au3: The library or module with the resources that lets you detect images. * sample_usage.au3: The mentioned sample_usage script. It contains the smallest example, but i think it should be ok for learning purposes. * sample_usage.exe: The sample_usage.au3 script compiled (au3 -> .exe). You can execute this to see the image_search() func working. * sample_target.png: The image to be detected in the sample_usage. You can delete this file and the script will be fine. * OffsetCalc.jar: It's only a Java tool to calculate the offset to transform an XY point into another one. It's useful if you want to use apply_offset function (from image_search.au3). Both things are only necessary when it's hard to find a version of the target image with upper left pixel in the way mentioned. As you can imagine, the idea is to detect another image and then apply the offset to get the real coordinates of the original target image. Happy Detections Lasker image_search.zip
  16. Hey I was looking for methode to get the stream size of a picture from memory , wihtout need to write stream data to disk the then use filegetsize Thats what I am trying to do #include <gdiplus.au3> #include <memory.au3> #include <staticconstants.au3> _GDIPlus_Startup() Global $ghGDIPDLL = $__g_hGDIPDll While 1 $data = Desk_Stream(50) $data2 = StringSplit($data, "|") $My_Stream_Size = $data2[0] $My_Stream = $data2[1] ;. ;.. ;... Sleep(1000) WEnd _GDIPlus_Shutdown() Func Desk_Stream($Q) Local $hHBmp = _ScreenCapture_Capture("") ;create a GDI bitmap by capturing my desktop Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hHBmp) ;convert GDI bitmap to GDI+ bitmap Local $hBitmap_Scaled = _GDIPlus_ImageResize($hBitmap, @DesktopWidth / 2, @DesktopHeight / 2) ;resize image $sStream_Data = _GDIPlus_StreamImage2BinaryString($hBitmap_Scaled, $sQ, False, '') ;coded by UEZ 2013 build 2014-01-25; based on the code ;release resources otherwise memory leak _WinAPI_DeleteObject($hHBmp) _GDIPlus_ImageDispose($hBitmap) _GDIPlus_ImageDispose($hBitmap_Scaled) Local $data_size = GetStreamSize($sStream_Data) Return $data_size & "|" & $sStream_Data EndFunc ;==>Desk_Stream Func _GDIPlus_StreamImage2BinaryString($hBitmap, $iQuality, $bSave, $sFilename) ;coded by UEZ 2013 build 2014-01-25; based on the code by Andreik Local $sImgCLSID, $tGUID, $tParams, $tData $sFormat = "JPG" $sImgCLSID = _GDIPlus_EncodersGetCLSID($sFormat) $tGUID = _WinAPI_GUIDFromString($sImgCLSID) $tData = DllStructCreate("int Quality") DllStructSetData($tData, "Quality", $iQuality) ;quality 0-100 Local $pData = DllStructGetPtr($tData) $tParams = _GDIPlus_ParamInit(1) _GDIPlus_ParamAdd($tParams, $GDIP_EPGQUALITY, 1, $GDIP_EPTLONG, $pData) Local $hStream = _WinAPI_CreateStreamOnHGlobal() ;http://msdn.microsoft.com/en-us/library/ms864401.aspx If @error Then Return SetError(2, 0, 0) _GDIPlus_ImageSaveToStream($hBitmap, $hStream, DllStructGetPtr($tGUID), DllStructGetPtr($tParams)) If @error Then Return SetError(3, 0, 0) Local $hMemory = _WinAPI_GetHGlobalFromStream($hStream) ;http://msdn.microsoft.com/en-us/library/aa911736.aspx If @error Then Return SetError(4, 0, 0) Local $iMemSize = _MemGlobalSize($hMemory) If Not $iMemSize Then Return SetError(5, 0, 0) Local $pMem = _MemGlobalLock($hMemory) $tData = DllStructCreate("byte[" & $iMemSize & "]", $pMem) Local $bData = DllStructGetData($tData, 1) _WinAPI_ReleaseStream($hStream) ;http://msdn.microsoft.com/en-us/library/windows/desktop/ms221473(v=vs.85).aspx _MemGlobalFree($hMemory) Return $bData EndFunc ;==>_GDIPlus_StreamImage2BinaryString Func GetStreamSize($data) ; ?? EndFunc
  17. Hi.. In html 5 4example I use Z-index on div object to overlay the images, how could I do this for example with the object pic and another object in the gui? How can I use the transparency of a PNG file? someone has already tried? THX.
  18. Hi will like to know if there a way for me to save any shockwave.flash as an image of the actual frame. My problem is I have a chart that is made with shockwave.flash using xml file but I want to print it out in a PDF but I can paste an image but I dont know how to do it. Can anyone help?
  19. All, I need some help with the following: 1. Finding an image in a Word doc. I have read the help file but I cannot figure out how to reference the image in the Word doc. 2. Adding a hyperlink to that image. 3. How would I loop the add hyperlink (text) and add hyperlink (image) to replace multiple links in a document. I have the add image and hyperlink working with the following code: $pic = "<PHOTO>" $picpath = IniRead(@ScriptDir & "\Config\Config.ini", "User Info", "Picture", 0) Local $oRange = _Word_DocFind($oDoc, $pic) _Word_DocPictureAdd($oDoc, $picpath, Default, Default, $oRange) _Word_DocFindReplace($oDoc, $pic, "", Default, 0, True, True) If @error Then $file1 = FileOpen("C:\Tech\Log_Files\_Error_Logs\Error_LOG.txt", 9) _FileWriteLog($file1, "," & @ComputerName & "," & @UserName & ",Error adding a picture to the document. " & $picpath & " " & " @error = " & @error & " @extended = " & @extended) FileClose($file1) EndIf $Link = "<LINKEDIN>" $LinkedIn = IniRead(@ScriptDir & "\Config\Config.ini", "User Info", "LinkedIn", 0) Local $oRange = _Word_DocFind($oDoc, $Link) _Word_DocLinkAdd($oDoc, $oRange, $LinkedIn, Default, "Click here to visit my LinkedIn page. " & @CRLF & $LinkedIn, "LinkedIn") If @error Then $file1 = FileOpen("C:\Tech\Log_Files\_Error_Logs\Error_LOG.txt", 9) _FileWriteLog($file1, "," & @ComputerName & "," & @UserName & ",Error adding a link to the document. " & $LinkedIn & " " & " @error = " & @error & " @extended = " & @extended) FileClose($file1) EndIf I just can't figure out how to find the images in a Word doc. Thanks for reading my post!
  20. I am working on a desktop remote application so I made a simple server and client to send binary screen captures from client to server. All it's good if I test both scripts on my computer but when the client is in other network many screen shots are corrupted and some of them looks good. Have any idea why? Client: #include <ScreenCapture.au3> #include <Memory.au3> #include <WinAPI.au3> #include <GDIPlus.au3> TCPStartup() $Client = TCPConnect(@IPAddress1,12100) _GDIPlus_Startup() While True Local $hHBitmap = _ScreenCapture_Capture('') Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hHBitmap) $bData = _GDIPlus_StreamImage2BinaryString($hBitmap) _GDIPlus_BitmapDispose($hBitmap) _WinAPI_DeleteObject($hHBitmap) TCPSend($Client,'~stream:' & BinaryLen($bData)) While BinaryLen($bData) $a = TCPSend($Client, $bData) $bData = BinaryMid($bData, $a+1, BinaryLen($bData)-$a) WEnd Sleep(10) WEnd TCPCloseSocket($Client) TCPShutdown() _GDIPlus_Shutdown() Func _GDIPlus_StreamImage2BinaryString($hBitmap, $sFormat = "JPG", $iQuality = 100) ;UEZ Local $sImgCLSID, $tGUID, $tParams, $tData Switch $sFormat Case "JPG" $sImgCLSID = _GDIPlus_EncodersGetCLSID($sFormat) $tGUID = _WinAPI_GUIDFromString($sImgCLSID) $tData = DllStructCreate("int Quality") DllStructSetData($tData, "Quality", $iQuality) ;quality 0-100 Local $pData = DllStructGetPtr($tData) $tParams = _GDIPlus_ParamInit(1) _GDIPlus_ParamAdd($tParams, $GDIP_EPGQUALITY, 1, $GDIP_EPTLONG, $pData) Case "PNG", "BMP", "GIF", "TIF" $sImgCLSID = _GDIPlus_EncodersGetCLSID($sFormat) $tGUID = _WinAPI_GUIDFromString($sImgCLSID) Case Else Return SetError(1, 0, 0) EndSwitch Local $hStream = _WinAPI_CreateStreamOnHGlobal() ;http://msdn.microsoft.com/en-us/library/ms864401.aspx If @error Then Return SetError(2, 0, 0) _GDIPlus_ImageSaveToStream($hBitmap, $hStream, DllStructGetPtr($tGUID), DllStructGetPtr($tParams)) If @error Then Return SetError(3, 0, 0) Local $hMemory = _WinAPI_GetHGlobalFromStream($hStream) ;http://msdn.microsoft.com/en-us/library/aa911736.aspx If @error Then Return SetError(4, 0, 0) Local $iMemSize = _MemGlobalSize($hMemory) If Not $iMemSize Then Return SetError(5, 0, 0) Local $pMem = _MemGlobalLock($hMemory) $tData = DllStructCreate("byte[" & $iMemSize & "]", $pMem) Local $bData = DllStructGetData($tData, 1) _WinAPI_ReleaseStream($hStream) ;http://msdn.microsoft.com/en-us/library/windows/desktop/ms221473(v=vs.85).aspx _MemGlobalFree($hMemory) Return $bData EndFunc ;==>_GDIPlus_StreamImage2BinaryString Server Global $Buffer, $BufferSize Global $Count = 0 TCPStartup() $Server = TCPListen(@IPAddress1,12100) If @error Then MsgBox(0,'',@error) Do $Socket = TCPAccept($Server) Sleep(10) Until $Socket <> -1 While True $Recv = TCPRecv($Socket,10240) If $Recv = -1 Then ExitLoop ElseIf $Recv Then If StringLeft($Recv,7) = '~stream' Then $BufferSize = StringSplit($Recv,':')[2] $Buffer = '0x' Do $Recv = TCPRecv($Socket,10240) If BinaryLen($Recv) <> 0 Then $BufferSize -= BinaryLen($Recv) $Buffer &= StringTrimLeft($Recv,2) EndIf Until $BufferSize = 0 $hFile = FileOpen(@ScriptDir & '\Screen' & $Count & '.jpeg',18) FileWrite($hFile,$Buffer) FileClose($hFile) $Buffer = Null $Count += 1 EndIf If $Count = 100 Then ExitLoop EndIf Sleep(10) WEnd TCPCloseSocket($Socket) TCPCloseSocket($Server) TCPShutdown() Exit
  21. Hi, everyone. I cannot press "Submit" image on Login website using FF.au3 #include <FF.au3> #include <FFex.au3> _FFStart() _FFOpenURL("https://url") _FFTabSetSelected() _FFSetValueByName("username") _FFSetValueByName("msisdn") _FFSetValueByName("password") Sleep(1000) _FFImageClick("visual/images/login-btn.png") I have been using IE.au3 with _IEFormImageClick($oIE, "visual/images/login-btn.png", "src") and it's successful. I want to use Firefox now because I got some error on IE like crash, etc. Can you all help me? Thanky ou.
  22. Hi! I am using a simple function to put a watermark into another image. It works very well, but if then I try to delete the source image file (in the script below it is called $sFile) I have the error that the file is open in my process. Thanks in advance and sorry for my bad english. Func _Watermark($sFile2, $sFile, $sLogo) Local $hImage1, $hImage2, $hGraphic _GDIPlus_Startup () $hImage1 = _GDIPlus_ImageLoadFromFile ($sFile) ; image $X1 = _GDIPlus_ImageGetWidth ($hImage1) $Y1 = _GDIPlus_ImageGetHeight ($hImage1) $hImage2 = _GDIPlus_ImageLoadFromFile ($sLogo) ; logo $X2 = _GDIPlus_ImageGetWidth ($hImage2) $Y2 = _GDIPlus_ImageGetHeight ($hImage2) $hGraphic = _GDIPlus_ImageGetGraphicsContext ($hImage1) _GDIPlus_GraphicsDrawImage ($hGraphic, $hImage2, $X1-$X2-5, 5) _GDIPlus_ImageSaveToFile ($hImage1, $sFile2) ; image watermarked _GDIPlus_ImageDispose ($hImage1) _GDIPlus_ImageDispose ($hImage2) _GDIPlus_ShutDown () EndFunc ;==>_Watermark
  23. Image Editor using GDI+

    Hello again the AutoIt Forums! I've gotten really addicted to the GDIPlus stuff and I'm trying to do more. Trying to create small editor using GDIPlus and I'm a bit lost just getting started. The main GUI is small, so when I you Snip an area that's larger than the GUI it would only display as large as the GUI (I got around this by setting an event for WM_WINDOWPOSCHANGING but it flickers really badly). I tried doing something by setting the bitmap to a GUICtrlCreatePic control but it still flickered. So essentially I need a way to create a graphics larger than the GUI itself and I don't know how to do something like that. I thought it would have been _GDIPlus_GraphicsCreateFromHDC but it still wasn't create it properly. I did a lot of googling and this topic has a lot of great info in it and I will probably incorporate scrollbars too, later, but UEZ didn't give the secret to resizing! Lol I've got the source code for vPaint downloaded, and I've started to through some of it (But like the author said, the source code is messy and things are out of order) so it may take a while. #include <GDIPlus.au3> #include <File.au3> #include <GUIConstants.au3> #include <String.au3> #include <GuiConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <ScreenCapture.au3> #include <Color.au3> #include <Misc.au3> #include <WinAPISys.au3> #include <GuiToolbar.au3> #include <GuiImageList.au3> #include <Array.au3> AutoItSetOption("GuiOnEventMode", 1) AutoItSetOption("MustDeclareVars", 1) HotKeySet("{Esc}", "ClosePixShop") Global $frm_pixshop_abscoord[4] = [100, 100, 400, 200] Global $frmPixShop Global $tlbPixShopToolbar Global $hWnd_toolbar_image_list Global $hWnd_dll = DllOpen("user32.dll") Global $frm_pixshop_state = @SW_HIDE Global $hWnd_bitmaps[1] Global $picBitmaps[1] Global $abscoord_bitmaps[1][2] = [[0, 0]] Global $abscoord_graphics[4] = [8, 46, 0, 0] Global $pixshop_buffer[1] Global Enum $idToolbarStart = 1000, $idMouse, $idSnip, $idCrop, $idText, $idBrush, $idToolbarEnd Global $hWnd_pixshop_graphics Global $hWnd_pixshop_bitmap Global $hWnd_pixshop_buffer PixShop() Func PixShop() $frmPixShop = GUICreate("PixShop", $frm_pixshop_abscoord[2], $frm_pixshop_abscoord[3], $frm_pixshop_abscoord[0], $frm_pixshop_abscoord[1], $WS_SIZEBOX, $WS_EX_TOPMOST) $tlbPixShopToolbar = _GUICtrlToolbar_Create($frmPixShop, $TBSTYLE_TRANSPARENT) GUICtrlCreateLabel("", 0, 36, $frm_pixshop_abscoord[2], $frm_pixshop_abscoord[3], -1, $WS_EX_LAYERED) GUICtrlSetBkColor(-1, 0x0D0D0D) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM) GUISetBkColor(0x535353, $frmPixShop) $hWnd_toolbar_image_list = _GUIImageList_Create(24, 24, 5, 5) _GUIImageList_AddIcon($hWnd_toolbar_image_list, @ScriptDir & "\Icons\Mouse.ico") _GUIImageList_AddIcon($hWnd_toolbar_image_list, @ScriptDir & "\Icons\Snip.ico") _GUIImageList_AddIcon($hWnd_toolbar_image_list, @ScriptDir & "\Icons\Crop.ico") _GUIImageList_AddIcon($hWnd_toolbar_image_list, @ScriptDir & "\Icons\Text.ico") _GUIImageList_AddIcon($hWnd_toolbar_image_list, @ScriptDir & "\Icons\Brush.ico") _GUICtrlToolbar_SetImageList($tlbPixShopToolbar, $hWnd_toolbar_image_list) _GUICtrlToolbar_SetIndent($tlbPixShopToolbar, 2) _GUICtrlToolbar_AddButton($tlbPixShopToolbar, $idMouse, 0) _GUICtrlToolbar_AddButton($tlbPixShopToolbar, $idSnip, 1) _GUICtrlToolbar_AddButton($tlbPixShopToolbar, $idCrop, 2) _GUICtrlToolbar_AddButton($tlbPixShopToolbar, $idText, 3) _GUICtrlToolbar_AddButton($tlbPixShopToolbar, $idBrush, 4) _GUICtrlToolbar_SetColorScheme($tlbPixShopToolbar, 0x535353, 0x535353) _GUICtrlToolbar_CheckButton($tlbPixShopToolbar, $idMouse, True) GUISetOnEvent($GUI_EVENT_CLOSE, "ClosePixShop") ; Register the WM_GETMINMAXINFO function GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO") ; Register the WM_NOTIFY function GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUIRegisterMsg($WM_WINDOWPOSCHANGING, "WM_WINDOWPOSCHANGING") GUIRegisterMsg($WM_PAINT, "WM_PAINT") GUISetState(@SW_SHOW, $frmPixShop) _GDIPlus_Startup() While (True) Sleep(100) WEnd EndFunc ;==>PixShop Func ClosePixShop() _GDIPlus_GraphicsDispose($hWnd_pixshop_graphics) _GDIPlus_BitmapDispose($hWnd_pixshop_bitmap) For $i = 0 To UBound($hWnd_bitmaps) - 1 _WinAPI_DeleteObject($hWnd_bitmaps[$i]) Next DllClose($hWnd_dll) Exit (0) EndFunc ;==>ClosePixShop Func WM_PAINT($hWndFrom, $iMsg, $wParam, $lParam) #forceref $hWndFrom, $iMsg, $wParam, $lParam DrawPixShopGraphics() EndFunc ;==>WM_PAINT Func WM_NOTIFY($hWndFrom, $iMsg, $wParam, $lParam) #forceref $hWndFrom, $iMsg, $wParam, $lParam Local $tNMTOOLBAR = DllStructCreate($tagNMTOOLBAR, $lParam) Local $tlbCode = DllStructGetData($tNMTOOLBAR, "Code") Local $iItem = DllStructGetData($tNMTOOLBAR, "iItem") Local $id_checked_button If ($tlbCode = $TBN_BEGINDRAG) Then If (Not _GUICtrlToolbar_IsButtonChecked($tlbPixShopToolbar, $iItem)) Then For $id = $idToolbarStart + 1 To $idToolbarEnd - 1 If (_GUICtrlToolbar_IsButtonChecked($tlbPixShopToolbar, $id)) Then $id_checked_button = $id _GUICtrlToolbar_CheckButton($tlbPixShopToolbar, $id, False) EndIf Next _GUICtrlToolbar_CheckButton($tlbPixShopToolbar, $iItem, True) EndIf Switch $iItem ; Button pressed was the $idColor button Case $idSnip Local $abscoord_frm_pixshop = WinGetPos($frmPixShop) While (_IsPressed("01", $hWnd_dll)) Sleep(10) WEnd GUISetState(@SW_HIDE, $frmPixShop) $hWnd_bitmaps[UBound($hWnd_bitmaps) - 1] = SnipArea($abscoord_bitmaps[UBound($abscoord_bitmaps, $UBOUND_ROWS) - 1][0], $abscoord_bitmaps[UBound($abscoord_bitmaps, $UBOUND_ROWS) - 1][1]) $pixshop_buffer[UBound($pixshop_buffer) - 1] = "SnippedImage|" & $hWnd_bitmaps[UBound($hWnd_bitmaps) - 1] ReDim $hWnd_bitmaps[UBound($hWnd_bitmaps)] ReDim $pixshop_buffer[UBound($pixshop_buffer)] If ($abscoord_graphics[2] = 0 And $abscoord_graphics[3] = 0) Then $abscoord_graphics[2] = $abscoord_bitmaps[UBound($abscoord_bitmaps, $UBOUND_ROWS) - 1][0] $abscoord_graphics[3] = $abscoord_bitmaps[UBound($abscoord_bitmaps, $UBOUND_ROWS) - 1][1] $pixshop_buffer[UBound($pixshop_buffer) - 1] = "ResizeGraphics|0,0-" & $abscoord_bitmaps[UBound($abscoord_bitmaps, $UBOUND_ROWS) - 1][0] & ',' & $abscoord_bitmaps[UBound($abscoord_bitmaps, $UBOUND_ROWS) - 1][1] ReDim $pixshop_buffer[UBound($pixshop_buffer)] #cs If (IsArray($abscoord_frm_pixshop)) Then If ($abscoord_frm_pixshop[2] < $abscoord_graphics[2]) Then WinMove($frmPixShop, "", $abscoord_frm_pixshop[0], $abscoord_frm_pixshop[1], $abscoord_graphics[2] + 24, $abscoord_frm_pixshop[3]) $abscoord_frm_pixshop[2] = $abscoord_graphics[2] + 24 EndIf If ($abscoord_frm_pixshop[3] < $abscoord_graphics[3]) Then WinMove($frmPixShop, "", $abscoord_frm_pixshop[0], $abscoord_frm_pixshop[1], $abscoord_frm_pixshop[2], $abscoord_graphics[3] + 46) $abscoord_frm_pixshop[3] = $abscoord_graphics[3] + 54 EndIf EndIf #ce EndIf ReDim $abscoord_bitmaps[UBound($abscoord_bitmaps, $UBOUND_ROWS)][2] GUISetState(@SW_SHOW, $frmPixShop) ResizePixShopGraphics() DrawPixShopGraphics() _GUICtrlToolbar_CheckButton($tlbPixShopToolbar, $iItem, False) _GUICtrlToolbar_CheckButton($tlbPixShopToolbar, $id_checked_button, True) Case $idCrop ToolTip("Crop Image") Case $idText ToolTip("Add Text") Case $idBrush ToolTip("Brush Image") EndSwitch EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func DrawPixShopGraphics() Local $hWnd_bitmap = _GDIPlus_BitmapCreateFromHBITMAP($hWnd_bitmaps[0]) _GDIPlus_GraphicsClear($hWnd_pixshop_buffer, 0x00000000) _GDIPlus_GraphicsDrawImageRect($hWnd_pixshop_buffer, $hWnd_bitmap, $abscoord_graphics[0], $abscoord_graphics[1], $abscoord_graphics[2], $abscoord_graphics[3]) _GDIPlus_ImageDispose($hWnd_bitmap) _GDIPlus_GraphicsDrawImage($hWnd_pixshop_graphics, $hWnd_pixshop_bitmap, 0, 0) EndFunc ;==>DrawPixShopGraphics Func SnipArea(ByRef $snipped_image_width, ByRef $snipped_image_height) Local $abscoord_mouse Local $hMask Local $hMaster_Mask Local $temp_val Local $mouse_x_1 Local $mouse_y_1 Local $mouse_x_2 Local $mouse_y_2 ToolTip("Left click and drag to select the area", 0, 0) Local $frmOverlay = GUICreate("GUI Overlay", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOPMOST) WinSetTrans($frmOverlay, "", 1) GUISetBkColor(0x000000, $frmOverlay) GUISetState(@SW_SHOW, $frmOverlay) GUISetCursor(3, 1, $frmOverlay) Local $frmSnipArea = GUICreate("GUI Snip", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST) GUISetBkColor(0xFF0000) ; Wait until mouse button pressed While (Not _IsPressed("01", $hWnd_dll)) Sleep(10) WEnd ; Get first mouse position $abscoord_mouse = MouseGetPos() $mouse_x_1 = $abscoord_mouse[0] $mouse_y_1 = $abscoord_mouse[1] ; Draw rectangle while mouse button pressed While _IsPressed("01", $hWnd_dll) $abscoord_mouse = MouseGetPos() $hMaster_Mask = _WinAPI_CreateRectRgn(0, 0, 0, 0) $hMask = _WinAPI_CreateRectRgn($mouse_x_1, $abscoord_mouse[1], $abscoord_mouse[0], $abscoord_mouse[1] + 1) ; Bottom of rectangle _WinAPI_CombineRgn($hMaster_Mask, $hMask, $hMaster_Mask, 2) _WinAPI_DeleteObject($hMask) $hMask = _WinAPI_CreateRectRgn($mouse_x_1, $mouse_y_1, $mouse_x_1 + 1, $abscoord_mouse[1]) ; Left of rectangle _WinAPI_CombineRgn($hMaster_Mask, $hMask, $hMaster_Mask, 2) _WinAPI_DeleteObject($hMask) $hMask = _WinAPI_CreateRectRgn($mouse_x_1 + 1, $mouse_y_1 + 1, $abscoord_mouse[0], $mouse_y_1) ; Top of rectangle _WinAPI_CombineRgn($hMaster_Mask, $hMask, $hMaster_Mask, 2) _WinAPI_DeleteObject($hMask) $hMask = _WinAPI_CreateRectRgn($abscoord_mouse[0], $mouse_y_1, $abscoord_mouse[0] + 1, $abscoord_mouse[1]) ; Right of rectangle _WinAPI_CombineRgn($hMaster_Mask, $hMask, $hMaster_Mask, 2) _WinAPI_DeleteObject($hMask) ; Set overall region _WinAPI_SetWindowRgn($frmSnipArea, $hMaster_Mask) If WinGetState($frmSnipArea) < 15 Then GUISetState() Sleep(10) WEnd ToolTip("") ; Get second mouse position $mouse_x_2 = $abscoord_mouse[0] $mouse_y_2 = $abscoord_mouse[1] ; Set in correct order if required If $mouse_x_2 < $mouse_x_1 Then $temp_val = $mouse_x_1 $mouse_x_1 = $mouse_x_2 $mouse_x_2 = $temp_val EndIf If $mouse_y_2 < $mouse_y_1 Then $temp_val = $mouse_y_1 $mouse_y_1 = $mouse_y_2 $mouse_y_2 = $temp_val EndIf GUIDelete($frmSnipArea) GUIDelete($frmOverlay) $snipped_image_width = $mouse_x_2 - $mouse_x_1 $snipped_image_height = $mouse_y_2 - $mouse_y_1 Return _ScreenCapture_Capture("", $mouse_x_1, $mouse_y_1, $mouse_x_2, $mouse_y_2, False) EndFunc ;==>SnipArea Func ResizePixShopGraphics() Local $graphics_width Local $graphics_height _GDIPlus_GraphicsDispose($hWnd_pixshop_graphics) _GDIPlus_BitmapDispose($hWnd_pixshop_bitmap) For $i = 0 To UBound($abscoord_bitmaps, $UBOUND_ROWS) - 1 $graphics_width += $abscoord_bitmaps[$i][0] $graphics_height += $abscoord_bitmaps[$i][1] Next $hWnd_pixshop_graphics = _GDIPlus_GraphicsCreateFromHWND($frmPixShop) $hWnd_pixshop_bitmap = _GDIPlus_BitmapCreateFromGraphics($graphics_width, $graphics_height, $hWnd_pixshop_graphics) $hWnd_pixshop_buffer = _GDIPlus_ImageGetGraphicsContext($hWnd_pixshop_bitmap) _GDIPlus_GraphicsSetSmoothingMode($hWnd_pixshop_buffer, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetTextRenderingHint($hWnd_pixshop_graphics, $GDIP_TEXTRENDERINGHINT_ANTIALIASGRIDFIT) EndFunc ;==>ResizePixShopGraphics Func WM_WINDOWPOSCHANGING($hWndFrom, $iMsg, $wParam, $lParam) #forceref $hWndFrom, $iMsg, $wParam, $lParam If ($hWndFrom <> $frmPixShop) Then Return $GUI_RUNDEFMSG Local $stWinPos = DllStructCreate("uint;uint;int;int;int;int;uint", $lParam) Local $iLeft = DllStructGetData($stWinPos, 3) Local $iTop = DllStructGetData($stWinPos, 4) Local $iWidth = DllStructGetData($stWinPos, 5) Local $iHeight = DllStructGetData($stWinPos, 6) ResizePixShopGraphics() DrawPixShopGraphics() Return $GUI_RUNDEFMSG EndFunc ;==>WM_WINDOWPOSCHANGING Func WM_GETMINMAXINFO($hWndFrom, $iMsg, $wParam, $lParam) #forceref $hWndFrom, $iMsg, $wParam, $lParam Local $tagMaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam) DllStructSetData($tagMaxinfo, 7, 300) ; Set MIN width DllStructSetData($tagMaxinfo, 8, 200) ; Set MIN height Return $GUI_RUNDEFMSG EndFunc ;==>WM_GETMINMAXINFO
  24. Html-Imager

    Version 1.0.1.3

    129 downloads

    Create a Html file with Images.
  25. menu of pictures

    #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> Example() Func Example() GUICreate("My GUI") ; will create a dialog box that when displayed is centered GUICtrlCreateButton("my picture button", 10, 20, 40, 40, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 22) GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd EndFunc ;==>Exampleguictrlsetimage this awesome little example from the Helpfile My question is this: does a Menu created with a function like guictrlcreatemenu have any special attributes? In stead of using guictrlcreatemenu, can I simply create a 'panel' and then run a series of picture buttons on it, behaving like a menu? I guess what I want to know is (a) if a menu contains any additional functionality which makes it a preferred choice over a row of buttons? (b) since we can not make a button menu, would a row of buttons work when presented to the user as a menu? Anything else I should know? Thanks
×