qwiqshot Posted August 2, 2016 Share Posted August 2, 2016 Hello I have been testing my Hotkeys script for several weeks now and cannot figure out why one function does not work as intended. I have attached the entire Hotkey function list below. Everything in it works flawlessly except for the function "CropPrint". It has worked a few times as it is now, for the life of me I cannot figure out why it is sporadically functional. At one point I thought it was due to the character I used. But I have completely re arranged the hotkey letters and numbers numerous times to no avail. I am hoping someone out there has PDF Converter Professional and can physically test cropping an image an then print it per this script to see if they too experience this ghost issue. Thank you so much for looking this over. expandcollapse popup; ----------------------------------The HotKeys----------------------------------- ; ------------------ALL start with ***Control + Alt + Shift*** ------------------- ; ################################################################################ ; ## F1 ."Cover" ; Print only cover page <<-- Works ; ## F2 ."DrainCover" ; Print only cover page <<-- Works ; ## F3 ."OfficeCopy" ; Print ony 1 office copy <<-- Works ; ## F4 ."LegalCopies" ; Print only legal copies <<-- Works ; ## F5 ."BidNumbers" ; Print only proposal numbers <<-- Works ; ## A . "PrintDocs" ; Print ALL above pages <<-- Works ; ## P . "PDFCover" ; Print contract to PDF <<-- Works ; ## G . "GoogleEarth" ; Google Earth Snapshot <<-- Works ; ## F8 . "CropPrint" ; Crop Google Earth Snapshot <<-- BROKE ; ## C . "ContractPDF" ; Send contract to PDF <<-- Works ; ## T . "Terms" ; Insert Terms into PDF <<-- Works ; ## B . "Bookmarks" ; Bookmarks a 4 page proposal <<-- Works ; ## E . "eMail" ; Write generic email body text <<-- Works ; ################################################################################ ; ######--------------------Control + Alt + Shift---------------------------###### HotKeySet ("^!+{f1}", "Cover") ; Print only cover page <<-- Works HotKeySet ("^!+{f2}", "DrainCover") ; Print only cover page <<-- Works HotKeySet ("^!+{f3}", "OfficeCopy") ; Print ony 1 office copy <<-- Works HotKeySet ("^!+{f4}", "LegalCopies") ; Print only legal copies <<-- Works HotKeySet ("^!+{f5}", "BidNumbers") ; Print only proposal numbers <<-- Works HotKeySet ("^!+{A}", "PrintDocs") ; Print ALL above pages <<-- Works HotKeySet ("^!+{P}", "PDFCover") ; Print contract to PDF <<-- Works HotKeySet ("^!+{G}", "GoogleEarth") ; Capture Google Earth Snapshot <<-- Works HotKeySet ("^!+{F8}", "CropPrint") ; Crop & Print Snapshot <<-- BROKE HotKeySet ("^!+{C}", "ContractPDF") ; Send contract to PDF <<-- Works HotKeySet ("^!+{T}", "Terms") ; Insert Terms into PDF <<-- Works HotKeySet ("^!+{B}", "Bookmarks") ; Bookmarks a 4 page proposal <<-- Works HotKeySet ("^!+{E}", "eMail") ; Write generic email body text <<-- Works ; ******************************* ; -----------Includes------------ ; ******************************* #include <Excel.au3> #include <MsgBoxConstants.au3> While 1 Sleep (50) WEnd Func Cover() ; ***************************************************************************** ; Create application object or connect to an already running Excel instance ; ***************************************************************************** Local $oExcel = _Excel_Open() If Not IsObj($oExcel) Then Exit MsgBox(0, "Error", "_Excel_Open()") EndIf ; ***************************************************************************** ; print out 1 copy of cover sheet for mailing on plain paper ; ***************************************************************************** _Excel_Print($oExcel,$oExcel.Worksheets("Cover").Range("A1:K51"), 1, "Xerox WorkCentre 7556 PS Plain Paper") Sleep (500) EndFunc Func DrainCover() ; ***************************************************************************** ; Create application object or connect to an already running Excel instance ; ***************************************************************************** Local $oExcel = _Excel_Open() If Not IsObj($oExcel) Then Exit MsgBox(0, "Error", "_Excel_Open()") EndIf ; ***************************************************************************** ; print out 1 copy of numbers on plain paper ; ***************************************************************************** _Excel_Print($oExcel,$oExcel.Worksheets("Drainage Cover").Range("A1:L55"), 1, "Xerox WorkCentre 7556 PS Plain Paper") Sleep (500) EndFunc Func LegalCopies() ; ***************************************************************************** ; Create application object or connect to an already running Excel instance ; ***************************************************************************** Local $oExcel = _Excel_Open() If Not IsObj($oExcel) Then Exit MsgBox(0, "Error", "_Excel_Open()") EndIf ; ***************************************************************************** ; print 2 copies of contracts on contract paper for mailing ; ***************************************************************************** _Excel_Print($oExcel, "A1:M55", 2, "Xerox WorkCentre 7556 PS Contract Paper") Sleep (500) EndFunc Func OfficeCopy() ; ***************************************************************************** ; Create application object or connect to an already running Excel instance ; ***************************************************************************** Local $oExcel = _Excel_Open() If Not IsObj($oExcel) Then Exit MsgBox(0, "Error", "_Excel_Open()") EndIf ; ***************************************************************************** ; print 1 copy of conttract for office on plain paper ; ***************************************************************************** _Excel_Print($oExcel, "A1:M55", 1, "Xerox WorkCentre 7556 PS Plain Paper") Sleep (500) EndFunc Func BidNumbers() ; ***************************************************************************** ; Create application object or connect to an already running Excel instance ; ***************************************************************************** Local $oExcel = _Excel_Open() If Not IsObj($oExcel) Then Exit MsgBox(0, "Error", "_Excel_Open()") EndIf ; ***************************************************************************** ; print out 1 copy of numbers on plain paper ; ***************************************************************************** _Excel_Print($oExcel,$oExcel.Worksheets("Bid Number").Range("A1:H30"), 1, "Xerox WorkCentre 7556 PS Plain Paper") Sleep (500) EndFunc Func PrintDocs() ; ***************************************************************************** ; Create application object or connect to an already running Excel instance ; ***************************************************************************** Local $oExcel = _Excel_Open() If Not IsObj($oExcel) Then Exit MsgBox(0, "Error", "_Excel_Open()") EndIf ; ***************************************************************************** ; print out 1 copy of cover sheet for mailing on plain paper ; ***************************************************************************** _Excel_Print($oExcel,$oExcel.Worksheets("Cover").Range("A1:K51"), 1, "Xerox WorkCentre 7556 PS Plain Paper") Sleep (500) ; ***************************************************************************** ; print 2 copies of contracts on contract paper for mailing ; ***************************************************************************** _Excel_Print($oExcel, "A1:M55", 2, "Xerox WorkCentre 7556 PS Contract Paper") Sleep (500) ; ***************************************************************************** ; print 1 copy of conttract for office on plain paper ; ***************************************************************************** _Excel_Print($oExcel, "A1:M55", 1, "Xerox WorkCentre 7556 PS Plain Paper") Sleep (500) ; ***************************************************************************** ; print out 1 copy of numbers on plain paper ; ***************************************************************************** _Excel_Print($oExcel,$oExcel.Worksheets("Bid Number").Range("A1:H30"), 1, "Xerox WorkCentre 7556 PS Plain Paper") Sleep (500) EndFunc Func Bookmarks() ; ***************************************************************************** ; Now creating bookmarks for all pages correctly ordered in PDF Converter Professional ; ***************************************************************************** WinActivate ("AsphaltEstimating - PDF Converter Professional 7.2") WinWaitActive ("AsphaltEstimating - PDF Converter Professional 7.2", "", 8) WinSetState("AsphaltEstimating - PDF Converter Professional 7.2", "", @SW_MAXIMIZE) Sleep (75) ; ***************************************************************************** ; ensure 1st page is in front ; ***************************************************************************** ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "^{HOME}") Sleep (75) ; ***************************************************************************** ; initiate bookmark panel ; ***************************************************************************** ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "^{b}") Sleep (75) ; ***************************************************************************** ; finalise created bookmark ; ***************************************************************************** ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "{ENTER}") Sleep (75) ; ***************************************************************************** ; now delete remnant bookmarks to ensure properly assigned once done ; ***************************************************************************** ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "{Del 20}") Sleep (75) ; ***************************************************************************** ; ensure again page one is to begining by flipping back ; ***************************************************************************** ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "^{HOME}") Sleep (75) ; ***************************************************************************** ; now start creating real bookmarks ; ***************************************************************************** ; initiate bookmark process ; ***************************************************************************** ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "^{b}") Sleep (75) ; ***************************************************************************** ; enter bookmark name & confirm ; ***************************************************************************** ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "Cover") Sleep (75) ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "{ENTER}") Sleep (75) ; ***************************************************************************** ; proceed to next page to bookmark ; ***************************************************************************** ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "^+{RIGHT}") ; ***************************************************************************** ; initiate bookmark process ; ***************************************************************************** Sleep (75) ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "^{b}") Sleep (75) ; ***************************************************************************** ; enter bookmark name & confirm ; ***************************************************************************** ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "Diagram") Sleep (75) ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "{ENTER}") Sleep (75) ; ***************************************************************************** ; proceed to next page to bookmark ; ***************************************************************************** ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "^+{RIGHT}") ; ***************************************************************************** ; initiate bookmark process ; ***************************************************************************** Sleep (75) ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "^{b}") Sleep (75) ; ***************************************************************************** ; enter bookmark name & confirm ; ***************************************************************************** ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "Proposal") Sleep (75) ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "{ENTER}") Sleep (75) ; ***************************************************************************** ; proceed to next page to bookmark ; ***************************************************************************** ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "^+{RIGHT}") ; ***************************************************************************** ; initiate bookmark process ; ***************************************************************************** Sleep (75) ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "^{b}") Sleep (75) ; ***************************************************************************** ; enter bookmark name & confirm ; ***************************************************************************** ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "Terms") Sleep (75) ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "{ENTER}") Sleep (75) ; ***************************************************************************** ; go to 1st bookmark ; ***************************************************************************** ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "^{HOME}") Sleep (75) ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "{UP 5}") Sleep (75) ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "{ENTER}") Sleep (75) ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "^s") Sleep (250) WinClose ("AsphaltEstimating - PDF Converter Professional 7.2") WinWaitClose ("AsphaltEstimating - PDF Converter Professional 7.2", "", 500) EndFunc Func PDFCover() ; ***************************************************************************** ; begin by ensuring no previous PDF is on desktop ; ***************************************************************************** FileDelete("C:\Users\Rick\Desktop\AsphaltEstimating.pdf") ; ***************************************************************************** ; Create application object or connect to an already running Excel instance ; ***************************************************************************** Local $oExcel = _Excel_Open() If Not IsObj($oExcel) Then Exit MsgBox(0, "Error", "_Excel_Open()") EndIf ; ***************************************************************************** ; print "Cover" to PDF Converter Professional 7.2 ; ***************************************************************************** _Excel_Print($oExcel,$oExcel.Worksheets("Cover").Range("A1:K51"), 1, "DocuCom PDF Driver") WinWaitActive ("AsphaltEstimating - PDF Converter Professional 7.2") ; Below line added 6_6_2016 ; WinWaitActive ("AsphaltEstimating - PDF Converter Professional 7.2") ; WinClose ("AsphaltEstimating - PDF Converter Professional 7.2") EndFunc Func GoogleEarth() WinActivate ("Google Earth Pro") WinWait ("Google Earth Pro") WinWaitActive ("Google Earth Pro") sleep (500) Send ("^+{F12}") EndFunc Func CropPrint() WinActivate ("AsphaltEstimating - PDF Converter Professional 7.2") WinWaitActive ("AsphaltEstimating - PDF Converter Professional 7.2", "", 5) WinSetState("AsphaltEstimating - PDF Converter Professional 7.2", "", @SW_MAXIMIZE) ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "^{END}") Sleep (250) ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "^+{C}") Sleep (250) ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "!{W}") Sleep (250) ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "!{C}") Sleep (250) ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "{ENTER}") Sleep (250) ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "^{P}") Sleep (500) ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "^{U}") Sleep (250) ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "{ENTER}") Sleep (4500) ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "^{P}") Sleep (500) ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "^{U}") Sleep (250) ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "{ENTER}") Sleep (75) ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "^s") Sleep (250) WinClose ("AsphaltEstimating - PDF Converter Professional 7.2") WinWaitClose ("AsphaltEstimating - PDF Converter Professional 7.2", "", 500) EndFunc Func ContractPDF() ; ***************************************************************************** ; Create application object or connect to an already running Excel instance ; ***************************************************************************** Local $oExcel = _Excel_Open() If Not IsObj($oExcel) Then Exit MsgBox(0, "Error", "_Excel_Open()") EndIf ; ***************************************************************************** ; print out Contract page to PDF (PDF Converter Professional) ; ***************************************************************************** _Excel_Print($oExcel, "A1:M55", 1, "DocuCom PDF Driver") WinWaitActive ("AsphaltEstimating - PDF Converter Professional 7.2") Sleep (250) ; ***************************************************************************** ; save work and exit ; ***************************************************************************** ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "^{s}") EndFunc Func Terms() ; ***************************************************************************** ; insert Terms & set to last page, then save ; ***************************************************************************** WinActivate ("AsphaltEstimating - PDF Converter Professional 7.2") sleep (125) ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "^+{I}") Sleep (1500) ; ***************************************************************************** ; enters document location and file name ; ***************************************************************************** Send (@DesktopDir & ".\z-Terms 2016.pdf") Sleep (250) ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "{ENTER}") sleep (250) ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "!g") sleep (250) ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "{ENTER}") sleep (250) ; ***************************************************************************** ; save work and exit ; ***************************************************************************** ControlSend ("AsphaltEstimating - PDF Converter Professional 7.2", "", "", "^{s}") EndFunc Func eMail() Send ("{TAB 2}") $File = @DesktopDir & ".\z-eMail.txt" $Open = FileOpen($File, 0) $Read = FileRead($Open) ClipPut($Read) FileClose($Open) Sleep (250) Send ("^v") EndFunc Link to comment Share on other sites More sharing options...
qwiqshot Posted August 2, 2016 Author Share Posted August 2, 2016 I forgot to mention one small observation. Upon triggering the hotkey function that is breaking. PDF Converter Professional shows the word File as being activated to accept menu functions, as if I hit Alt (see small picture attached). 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