vivekvivek2001 Posted August 23, 2012 Share Posted August 23, 2012 I've been on this tool all morning and I'm impressed to see the amount of support this forum provides Anyways, Here's my problem (did a bit of googling but still couldnt find an answer ) : While 1 If _IsPressed("1B", $dll) Then MsgBox(0,"PrintScreener Terminated", "Thank you for using PrintScreener. Screenshots, if any, are present in D:\PrintScreener Screenshots\" & $s_f) ExitLoop ElseIf _IsPressed("2C", $dll) Then _ScreenCapture_Capture("D:\PrintScreener Screenshots\Temp\Temp.png" , 0 , 0 , -1 , -1 , True) Sleep(10) $oShape = _WordDocAddPicture($oDoc , "D:\PrintScreener Screenshots\Temp\Temp.png" , 0 , 1 ) EndIf WEnd _WordQuit($oWordApp , -1) What it does is it detects printscreen button press event, saves the clipboard content to a .png file and pastes the image in the .png file to the word document whose path has been mentioned in $oDoc. 1. It pastes the sequence of images backwards in the word file i.e., the last image taken is the first image you'll see and the last image in the word file is the first image you took. Cant this be reversed? 2. The above code works just fine but I noticed that the last screenshot taken appears twice in the word file. There's no problem with that being there but kinda like things perfect What am I doing wrong? Link to comment Share on other sites More sharing options...
water Posted August 23, 2012 Share Posted August 23, 2012 Use my Function _Word_DocRangeSet allows to set the insertion point to the end of the document.You have to insert a sleep after you have written the screenshot to Word because _IsPressed still returns True for x milliseconds. The help file states: "If the code called does not include a blocking function (such as MsgBox) and the user does not require multiple returns, the script should wait until _IsPressed() returns 0 before continuing.". The example in the help file describes how to do it right. vivekvivek2001 1 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 Link to comment Share on other sites More sharing options...
vivekvivek2001 Posted August 23, 2012 Author Share Posted August 23, 2012 Thanks....water??? But weirdly enough the 2nd problem seems to have disappeared when I compiled it into an .exe file. Now I see only one image of the last screencapture (yay!) I'll need to take a look at your methods in the UDF but thanks again Link to comment Share on other sites More sharing options...
water Posted August 23, 2012 Share Posted August 23, 2012 Use$oRange = _Word_DocRangeSet($oDoc, -2)to move the insertion mark to the end of the document. 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 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