Docfxit Posted December 25, 2006 Posted December 25, 2006 (edited) CODEHotKeySet("{F9}", "OnScreenShot") HotKeySet("{ESC}", "Terminate") While 1 Sleep(20) WEnd Func OnScreenShot() If Not FileExists (@scriptdir & "\screenshots") Then DirCreate (@scriptdir & "\screenshots") If Not FileExists(@scriptdir & "\captplugin.dll") Then FileInstall( "captplugin.dll", @scriptdir & "" ,1) Local $Cwin1 = WinGetHandle(""); gets the handle of the active window Local $Cwin2 = WinGetPos($Cwin1); gets active window dimensions Local $Quality = 85; use -1 to save as BMP or use number between 0 - 100 to save as JPG quality If $Quality = -1 Then Local $SaveAs = ".bmp" Else Local $SaveAs = ".jpg" EndIf Local $CaptureDirectory = @ScriptDir & "\Screenshots\"; directory uses to store screen caps Local $CaptureFile = @YEAR & "-" & @MON & "-" & @MDAY & "_" & @HOUR & @MIN & "-" & @SEC & $SaveAs ; Capture given region ; Fist parameter - filename, next four: left, top, width, height. Last one - jpeg quality. ; Set quality to any negative number to capture into BMP $Result = DllCall(@scriptdir & "\captdll.dll", "int", "CaptureRegion", "str", $CaptureDirectory & $CaptureFile, "int", $Cwin2[0], "int", $Cwin2[1], "int", $Cwin2[2], "int", $Cwin2[3], "int", $Quality) _FilePrintCom($CaptureDirectory & $CaptureFile) EndFunc Func _FilePrintCom($iFile) ; works when there is a Print option available for a file Extension: ; for a picture it opened it with the windows picture viewer, for a TXT it printed to the default. If Not FileExists($iFile) Then Return SetError(1,0,0) $objShellApp = ObjCreate("Shell.Application") $objShellApp.ShellExecute($iFile,0,0,"PRINT",0) ; Send("{enter}") EndFunc Func Terminate() Exit EndFunc I pieced together the above solution to solve my problem. Thank you, Docfxit Edited December 25, 2006 by docfxit
Zedna Posted December 25, 2006 Posted December 25, 2006 You didn't write what is problem. In your code is probably bad: $objShellApp = ObjCreate("Shell.Application") $objShellApp.ShellExecute($iFile,0,0,"PRINT",0)oÝ÷ ÚÈhºWi®Úny«¢+ÙM¡±±áÕÑ ÀÌØí¥¥±°À°À°ÅÕ½ÐíAI%9PÅÕ½Ðì°À¤ ShellExecute is AutoIt function. (I don't checked your parametres.) For printing search at this forum, it has been done many times before. Resources UDF ResourcesEx UDF AutoIt Forum Search
Docfxit Posted December 26, 2006 Author Posted December 26, 2006 Thank you for the reply... You didn't write what is problem. I found a solution before anyone replied to my problem. In your code is probably bad: $objShellApp = ObjCreate("Shell.Application") $objShellApp.ShellExecute($iFile,0,0,"PRINT",0)oÝ÷ ÚÈhºWi®Úny«¢+ÙM¡±±áÕÑ ÀÌØí¥¥±°À°À°ÅÕ½ÐíAI%9PÅÕ½Ðì°À¤ ShellExecute is AutoIt function. (I don't checked your parametres.)When I substituted this code I get an error saying: ERROR: ShellExecute(): undefined function. ShellExecute($iFile,0,0,"PRINT",0) For printing search at this forum, it has been done many times before.I searched for hours and ended up with the solution in post #1
BugFix Posted December 26, 2006 Posted December 26, 2006 When I substituted this code I get an error saying:ERROR: ShellExecute(): undefined function.You need Beta or the new Stable 3.2.2.0 Best Regards BugFix
Docfxit Posted December 28, 2006 Author Posted December 28, 2006 You need Beta or the new Stable 3.2.2.0Thanks, I have installed ver. 3.2.2.0 and ShellExecute($iFile,0,0,"PRINT",0) is now working.I am having a problem with this printing solution though. It does bring up a program that I have installed to print JPG images. I'd like to find a way to print without seeing any program. Surely there must be a way to do it.Thank you,Docfxit
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