telmob Posted August 27, 2012 Posted August 27, 2012 I've just done a little script to put some images in the clipboard and paste them mainly in Word and Excel (2010), but in Excel it doesn't work. The 'paste' button keeps greyed out. Any chance to get this working? Thanks!
water Posted August 27, 2012 Posted August 27, 2012 Do you past the clipboard to Excel using AutoIt or manually? Which version of Excel do you use? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
telmob Posted August 27, 2012 Author Posted August 27, 2012 I paste manually. I only use Autoit to put the image to the clipboard. I'm using Office 2010.
water Posted August 27, 2012 Posted August 27, 2012 I'm running Office 2010 too. If I open Excel and press Ctrl+V the picture from the clipboard is copie to Excel without a problem. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
telmob Posted August 27, 2012 Author Posted August 27, 2012 Yes, if i copy the picture manually, it works (if i take a screenshot or something) but if i place a picture file in the clipboard with _ClipPutFile and paste it manually with a Ctrl+v it doesn't work.
water Posted August 27, 2012 Posted August 27, 2012 To insert a picture file into Excel you could use function _ExcelPictureInsert of the without the need to use the clipboard. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
telmob Posted August 27, 2012 Author Posted August 27, 2012 (edited) The problem is that i made a tiny script (actually i spent quite some time on it yesterday) to place a predefined image to clipboard so i could paste it where ever i chose, but it doesn't work for excel. So... i need the clipboard. Edited August 27, 2012 by telmob
water Posted August 27, 2012 Posted August 27, 2012 Same problem here. Doesn't work with AutoIt 3.3.8.1 and 3.3.9.5 beta. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
telmob Posted August 27, 2012 Author Posted August 27, 2012 (edited) I found this script by UEZ:It's working, but i can't get it to work with an existing picture file.Care to take a look?I tried replacing the $hBitmap = _ScreenCapture_Capture("", 10, 10, 300, 300, False)With $hBitmap = (@ScriptDir &"frame.png")It should work, right? Edited August 27, 2012 by telmob
water Posted August 27, 2012 Posted August 27, 2012 (edited) How about this? Worjks fine for me here. #include <Constants.au3> #include <Clipboard.au3> #include <ScreenCapture.au3> Global $hBitmap, $hBitmap2, $hImage, $iResult $hBitmap = _ScreenCapture_Capture("", 10, 10, 300, 300, False) _ClipBoard_Open(0) _ClipBoard_Empty() _GDIPlus_Startup() $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage) $hImage = _GDIPlus_ImageLoadFromFile("C:temptest.png") ; <== Needs to be changed _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0) $hBitmap2 = _WinAPI_CopyImage(_GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage), 0, 0, 0, $LR_COPYDELETEORG + $LR_COPYRETURNORG) $iResult = _ClipBoard_SetDataEx($hBitMap2, $CF_BITMAP ) _ClipBoard_Close() _WinAPI_DeleteObject($hBitmap) _GDIPlus_ShutDown ( ) Func _WinAPI_CopyImage($hImage, $iType = 0, $xDesired = 0, $yDesired = 0, $iFlags = 0); from _WinAPIEx by Yashied Local $Ret = DllCall('user32.dll', 'ptr', 'CopyImage', 'ptr', $hImage, 'int', $iType, 'int', $xDesired, 'int', $yDesired, 'int', $iFlags) If (@error) Or (Not $Ret[0]) Then Return SetError(1, 0, 0) Return $Ret[0] EndFunc ;==>_WinAPI_CopyImage Edited August 27, 2012 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
telmob Posted August 27, 2012 Author Posted August 27, 2012 ahah, doesn't preserve transparency.... damn it!
water Posted August 27, 2012 Posted August 27, 2012 Then this is far over my head and you need to wait until UEZ jumps in My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
telmob Posted August 27, 2012 Author Posted August 27, 2012 (edited) I'm searching the forum for some possible solution, but the pasting is working Thank you! Shame it doesn't work using the normal _ClipPutFile. That would make things so much easier.... Edited August 27, 2012 by telmob
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