Mangix Posted November 4, 2006 Posted November 4, 2006 Greetings,is there any way to check if the clipboard contains an image?
Yzöwl Posted November 4, 2006 Posted November 4, 2006 As far as I'm aware, you could be out of luck.You could access the clipboard data, but whether there would be a way, without possibly using the clipboard object in VB, to ascertain the data type would be doubtful.My best guess would be to see if there was something distinguishable in all images and try to parse the clipboard data using the ADOStream object to read it as binary.
Mangix Posted November 4, 2006 Author Posted November 4, 2006 that sucks. so how about checking the info in the Clipboard?
LLXX Posted November 4, 2006 Posted November 4, 2006 I don't know if you can call into the API with VBscript, but...The GetClipboardData function retrieves data from the clipboard in a specified format. The clipboard must have been opened previously. HANDLE GetClipboardData( UINT uFormat // clipboard format ); ParametersuFormatSpecifies a clipboard format. For a description of the clipboard formats, see the SetClipboardData function. Return ValuesIf the function succeeds, the return value is the handle of a clipboard object in the specified format.If the function fails, the return value is NULL. To get extended error information, call GetLastError. RemarksAn application can enumerate the available formats in advance by using the EnumClipboardFormats function. The clipboard controls the handle that the GetClipboardData function returns, not the application. The application should copy the data immediately. The application cannot rely on being able to make long-term use of the handle. The application must not free the handle nor leave it locked. The operating system performs implicit data format conversions between certain clipboard formats when an application calls the GetClipboardData function. For example, if the CF_OEMTEXT format is on the clipboard, a window can retrieve data in the CF_TEXT format. The format on the clipboard is converted to the requested format on demand. The following table shows the clipboard data type conversions that are available. Note that some of these automatic type conversions are not available on all platforms.Clipboard Format Conversion Format Platform SupportCF_BITMAP CF_DIB Windows NT, Windows 95CF_DIB CF_BITMAP Windows NT, Windows 95CF_DIB CF_PALETTE Windows NT, Windows 95CF_ENHMETAFILE CF_METAFILEPICT Windows NT, Windows 95CF_METAFILEPICT CF_ENHMETAFILE Windows NT, Windows 95CF_OEMTEXT CF_TEXT Windows NT, Windows 95CF_OEMTEXT CF_UNICODETEXT Windows NTCF_TEXT CF_OEMTEXT Windows NT, Windows 95CF_TEXT CF_UNICODETEXT Windows NTCF_UNICODETEXT CF_OEMTEXT Windows NTCF_UNICODETEXT CF_TEXT Windows NTIf the operating system provides an automatic type conversion for a particular clipboard format, there is no advantage to placing the conversion format(s) on the clipboard.If the system provides an automatic type conversion for a particular clipboard format, and you call EnumClipboardFormats to enumerate the clipboard data formats, the operating system first enumerates the format that is on the clipboard, followed by the formats to which it can be converted.If the clipboard contains data in the CF_PALETTE format, the application should use the SelectPalette and RealizePalette functions to realize any other data in the clipboard against that logical palette.See SetClipboardData for further information on specific clipboard data formats....and...The EnumClipboardFormats function lets you enumerate the data formats that are currently available on the clipboard. Clipboard data formats are stored in an ordered list. To perform an enumeration of clipboard data formats, you make a series of calls to the EnumClipboardFormats function. For each call, the format parameter specifies an available clipboard format, and the function returns the next available clipboard format. UINT EnumClipboardFormats( UINT format // specifies a known available clipboard format ); ParametersformatSpecifies a clipboard format that is known to be available.To start an enumeration of clipboard formats, set format to zero. When format is zero, the function retrieves the first available clipboard format. For subsequent calls during an enumeration, set format to the result of the previous EnumClipboardFormat call. Return ValuesIf the function succeeds, the return value is the clipboard format that follows the specified format. In other words, the next available clipboard format.If the function fails, the return value is zero. To get extended error information, call GetLastError. If the clipboard is not open, the function fails. If there are no more clipboard formats to enumerate, the return value is zero. In this case, the GetLastError function returns the value NO_ERROR. This lets you distinguish between function failure and the end of enumeration.RemarksYou must open the clipboard before enumerating its formats. Use the OpenClipboard function to open the clipboard. The EnumClipboardFormats function fails if the clipboard is not open.The EnumClipboardFormats function enumerates formats in the order that they were placed on the clipboard. If you are copying information to the clipboard, add clipboard objects in order from the most descriptive clipboard format to the least descriptive clipboard format. If you are pasting information from the clipboard, retrieve the first clipboard format that you can handle. That will be the most descriptive clipboard format that you can handle.The operating system provides automatic type conversions for certain clipboard formats. In the case of such a format, this function enumerates the specified format, then enumerates the formats to which it can be converted. For more information about clipboard formats and automatic clipboard format type conversions, see the GetClipboardData and SetClipboardData functions.
RogueSpear Posted November 5, 2006 Posted November 5, 2006 You could always call AutoItX from a VBS in order to work with the clipboard. The only requirement is that AutoItX3.dll be registered with the OS.
Mangix Posted November 6, 2006 Author Posted November 6, 2006 well, after searching Microsoft for some info, i found out about getting the info from the Clipboard here.the current code that i have right now is this. Set objIE = CreateObject("InternetExplorer.Application")objIE.Navigate("about:blank")clpData = objIE.document.parentwindow.clipboardData.GetData("text")objIE.QuitSet objShell = CreateObject("Wscript.Shell")right now, i'm not really sure how to make the script figure out if the Clipboard contains a string.
gunsmokingman Posted November 6, 2006 Posted November 6, 2006 This will only confirm if there is a text string in the clip boardDim clpData, objIE Set objIE = CreateObject("InternetExplorer.Application") objIE.Navigate("about:blank") clpData = objIE.document.parentwindow.clipboardData.GetData("text") objIE.Quit If InStr(clpData,"clpData") Then MsgBox "Nothing In The Clip Board", 0 + 32 + 4096,"Clip Board Data" Else MsgBox "Found This Text string : " & clpData, 0 + 32 + 4096,"Clip Board Data" End If
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now