mwpriest wrote: ↑20 Feb 2024, 20:38
For some reason the second script for merging didn't work. It's not merging and it's also not opening the second document (the Test document). I've tried both the verbose and the condensed versions. Any idea why? You mentioned there is a way to merge without opening the second document. Is this script doing it that way, or what would that look like?
And, was there a guide that you used to help accumulate your COM knowledge? Do you recommend a good resource?
The script I posted works for me. You have to have an active PDF open in Acrobat, then hit F12, and the file at
A_Desktop '\Test\Test.pdf' will be merged at the beginning of the active PDF document. Of course, you have to change the path and filename to match what you want. You also have to have a PDF open and activated. It cannot be minimized or anything like that. Basically, you are reviewing a PDF and then hit a key to add a cover page.
It does not display the file to be merged. You should just see it appear as a new page in your PDF that is active.
I learned pretty much everything I know about COM from the forums. At least that is the starting point, then you have to look up stuff in the object model. For Office programs,
https://learn.microsoft.com/en-us/office/vba/api/overview/
You can also just type something like, "msdn excel saveas" in google and it will take you to the saveas object for Excel. MSDN stands for "Microsoft Developer Network". You can do that for most commands and office programs, then branch from there. Also, study VBA code. If you want to do something in Office, google for the VBA code and then convert it to AHK. There is tons of VBA code out there for Office and it is very similar to AHK as far as the COM commands.
For Acrobat, Adobe has a bunch of stuff as part of their Software Development Kit (SDK). If you can find the old PDFs they are great to have. I believe all their new stuff is online. The API or COM stuff has not changed in many years to keep compatibility. So, the old PDF references are easier to use in my opinion.
COM for more obscure applications is even harder to find, like AutoCAD has COM support but it is poorly documented.
Here is a list of sources:
https://www.the-automator.com/com-and-autohotkey/
That site in general has quite a bit of good information about AHK.
FG