t0ddie Posted September 15, 2010 Share Posted September 15, 2010 Clipput and clipget writes/reads text to/from the clipboard, but what can you do for images? I know you can "send" the printscreen button and copy an image to the clipboard but is there a way to display an image from the clipboard using autoit and without opening another application like mspaint? Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
wakillon Posted September 15, 2010 Share Posted September 15, 2010 (edited) search for ScreenCapture.au3 #include <ScreenCapture.au3> ; Capture full screen _ScreenCapture_Capture(@MyDocumentsDir & "\GDIPlus_Image1.jpg") ; Capture region _ScreenCapture_Capture(@MyDocumentsDir & "\GDIPlus_Image2.jpg", 0, 0, 796, 596) And for display it , use shellexecute (@MyDocumentsDir & "\GDIPlus_Image1.jpg" ) with the preview images of windows Edited September 15, 2010 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
t0ddie Posted September 16, 2010 Author Share Posted September 16, 2010 search for ScreenCapture.au3#include <ScreenCapture.au3>; Capture full screen_ScreenCapture_Capture(@MyDocumentsDir & "\GDIPlus_Image1.jpg"); Capture region_ScreenCapture_Capture(@MyDocumentsDir & "\GDIPlus_Image2.jpg", 0, 0, 796, 596)And for display it , use shellexecute (@MyDocumentsDir & "\GDIPlus_Image1.jpg" ) with the preview images of windowsThat looks like it would be functional to capture and display an image, but Ideally I want to display the image from the clipboard. I basically would like to check the users clipboard, and detect whether it is empty, whether there is text, or whether there is a picture. I don't necessarily need to display the picture, I just need to know if there is a picture saved to it. I want the "status" of the clipboard. I would like to differentiate between the clipboard being blank, and the clipboard having a picture saved to it. It is easy enough with clipget() to check if it has text, but I cannot tell if a picture is saved to it because clipget() returns nothing. Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
whim Posted September 16, 2010 Share Posted September 16, 2010 No idea if they can help with your specific problem, but take a look at the 'low-level' clipboard functions, see: Help file -> UDFs -> Clipboard Management whim Link to comment Share on other sites More sharing options...
wakillon Posted September 17, 2010 Share Posted September 17, 2010 (edited) That looks like it would be functional to capture and display an image, but Ideally I want to display the image from the clipboard. I basically would like to check the users clipboard, and detect whether it is empty, whether there is text, or whether there is a picture. I don't necessarily need to display the picture, I just need to know if there is a picture saved to it. I want the "status" of the clipboard. I would like to differentiate between the clipboard being blank, and the clipboard having a picture saved to it. It is easy enough with clipget() to check if it has text, but I cannot tell if a picture is saved to it because clipget() returns nothing.Return ValueSuccess: Returns a string containing the text on the clipboard.Failure: Sets @error to 1 if clipboard is emptyto 2 if contains a non-text entry.to 3 or 4 if cannot access the clipboard.If I copy a png file and run this$bak = ClipGet()ConsoleWrite ( "@error : " & @error & @Crlf )ConsoleWrite ( "Clipboard contains : " & $bak & @Crlf )I get :@error : 0Clipboard contains : C:\Documents and Settings\Administrateur\Bureau\Youtube Subscription Bar And Autoplay Remover_extension_2_1_3_3\screenshot - before.PNGSo return @error is not reliable for determine content of clipboard ! Edited September 17, 2010 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
KaFu Posted September 17, 2010 Share Posted September 17, 2010 Give this example a try... to perform continous monitoring maybe call the function with AdlibRegister(). #include <ClipBoard.au3> ConsoleWrite("===========" & @crlf) ClipPut("") _Clipboard_Format() ConsoleWrite("===========" & @crlf) ClipPut("Test") _Clipboard_Format() ConsoleWrite("===========" & @crlf) Send("{PRINTSCREEN}") _Clipboard_Format() ConsoleWrite("===========" & @crlf) Func _Clipboard_Format_Available() Local $iFormat, $iCount If Not _ClipBoard_Open(0) Then MsgBox(16, "Error", "_ClipBoard_Open failed") Exit EndIf ConsoleWrite("Clipboard formats ..: " & _ClipBoard_CountFormats() & @CRLF) Do $iFormat = _ClipBoard_EnumFormats($iFormat) If $iFormat <> 0 Then $iCount += 1 ConsoleWrite("Clipboard format " & $iCount & " .: " & _ClipBoard_FormatStr($iFormat) & @TAB & _ClipBoard_GetFormatName($iFormat) & @CRLF) EndIf Until $iFormat = 0 _ClipBoard_Close() EndFunc ;==>_Clipboard_Format OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
t0ddie Posted September 17, 2010 Author Share Posted September 17, 2010 @Kafu the issue here is I want to determine the contents of the clipboard when the script is ran. an adlib function would only check the clipboard WHILE the script is running, and would not work until after the clipboard has changed. I want the status of the contents of the clipboard just prior to running the script. @wakillon I never thought of error return. that would work great! too bad it is not reliable, it seems it would be exactly what I am looking for. Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now