 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
BigBen Guest
|
Posted: Tue Feb 01, 2005 1:39 am Post subject: Automate PDF printing |
|
|
Hello everyone,
I'm a FileMaker developer, and I'm trying to automate the generation of PDF's and emailing them afterwards.
Here is what I'm trying to accomplish from FileMaker:
- Verify that the user has a printer with 'PDF' in its name
- In the absence of a PDF printer driver, we quit the script and ask the user to install a PDF printer before continuing
- Else, we get that printer name to a variable
- Take note of the current default printer (another variable)
- Ask the user for a name for the PDF file we are going to create, or use a FileMaker field for this
- Create the PDF on the User's Desktop or in a specific folder that may need to be created
- Change the file name to the one we specified in the FileMaker field above
- Ask the user if they want to send the file by email
- If this is the case, using the default email client, create a new message with the PDF as an attachment, the contents of a FileMaker field or apopup for the email address, and the file name or another field as the subject of the message
- Change the default printer back to what it was before
I have an AppleScript that does all this for my Mac clients under OS X. Would anyone be willing to give me a hand in writing the AutoHotkey script I could integrate in my solutions to acheive this same feat for my Windows clients?
Thanks and eternally grateful in advance,
Ben |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Tue Feb 01, 2005 3:20 am Post subject: |
|
|
Hmmm... IMO, it sounds feasible. I'll have to do more research, but there should be something 'bout the printers in the big bad registry, which AHK can access quite easily. Everything after that looks to be the proverbial walk in the park. I'll get back to you after I do some more searching on Google and in my books. And don't worry, I have plenty of free time and I live for this stuff.  |
|
| Back to top |
|
 |
exhueydriver
Joined: 12 Jul 2004 Posts: 51 Location: Fife,Wa
|
Posted: Tue Feb 01, 2005 4:13 am Post subject: |
|
|
Welcome to the AHK forum. Finally, another FMP'er!
Having said that, there are a couple of problems here.
(You didn't say which version of FMP?)
- Verify that the user has a printer with 'PDF' in its name
Using a third party app, CopyText.exe, you can get a list of the printer
names, then loop thru them (with AHK) to find "PDF". On my comp, I have 2 PDF drivers, which one do you want?
- Take note of the current default printer
Big prob here- the default printer for the OS is NOT the same default printer for FilemakerPro. I'm pretty sure it works the same on a Mac.
;=======
- Ask the user for a name for the PDF file we are going to create, or use a FileMaker field for this
- Create the PDF on the User's Desktop or in a specific folder that may need to be created
- Change the file name to the one we specified in the FileMaker field above
;=======
All of the above are easy with AHK(especially with the help I've gotten here), or you could use a Command prompt, I've got examples, if you want.
The rest of your stuff is easily handled with FMP scripts.
(as BoBo would say)
Thanks
Don |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Tue Feb 01, 2005 4:21 am Post subject: |
|
|
| Eheh... with the fact that Huey has FMP and I don't, I'll bow out, especially knowing the default printer is different. Good luck! |
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Tue Feb 01, 2005 9:19 am Post subject: |
|
|
| Quote: | | Verify that the user has a printer with 'PDF' in its name | Maybe [that] helps.
This one looks good as well:
| Quote: | DEFPRINT /P displays the installed printers. Example:
Found 2 printers
PrinterName: HP1600C
ServerName: (null)
PortName: LPT1:
DriverName: HP DeskJet 1600C
PrintProcessor: winprint
ShareName: HP1600C
PrinterName: \\JSI005\HP OfficeJet
ServerName: \\JSI005
PortName: LPT1:
DriverName: HP OfficeJet
PrintProcessor: winprint
ShareName: HPOffice
To set a default printer, type:
DEFPRINT /D <PrinterShare> or DEFPRINT /D <LOCAL PORT>. Examples:
DEFPRINT /D LPT1: displays:
Found 2 printers
Changing default printer...
DEFPRINT /D HP1600C is equivalent, as HP1600C is local and is connected on LPT1:.
To set the default to the HP OfficeJet on the JSI005 Workstation:
DEFPRINT /D HPOffice
[Download] |
|
|
| Back to top |
|
 |
Guest
|
Posted: Tue Feb 01, 2005 11:19 am Post subject: |
|
|
Don,
Nice to see I'm not the only FileMaker developer here (my version is 7.03 by the way).
| Quote: | | Using a third party app, CopyText.exe, you can get a list of the printer names, then loop thru them (with AHK) to find "PDF". On my comp, I have 2 PDF drivers, which one do you want? |
I'm not very choosy at this point, I just want to print to a PDF printer, any PDF printer!!! Actually, it's the file naming and renaming in the background that's got me a little baffled here: I need to interact with FileMaker fields, Windows dialog boxes and actual file paths - Help!
| Quote: | | Big prob here- the default printer for the OS is NOT the same default printer for FilemakerPro. I'm pretty sure it works the same on a Mac. |
Could I then use 2 variables - 1 for the default sytem printer, and 1 for the default FM printer?
| Quote: | | All of the above are easy with AHK(especially with the help I've gotten here), or you could use a Command prompt, I've got examples, if you want. |
I'd really appreciate that, if you could send me some real-life examples on how to integrate AHK with FM7, that would be extremely helpful. You can reach me at benoitsavignac # hotmail dot com (replace the pound sign with the 'at' sign - I despise spam like the rest of you...).
One of my big concerns is the fact that FM doesn't wait for the end of the execution of a command before proceeding with the rest of the script. How have you overcome this problem with using AHK?
Thanks to all whom contributed, and thanks in advance Don!
P.S.: Are you interested in the OS X AppleScript I use to accomplish this on the Mac side? If so, let me know and I'll send it to you.
Ben |
|
| Back to top |
|
 |
exhueydriver
Joined: 12 Jul 2004 Posts: 51 Location: Fife,Wa
|
Posted: Wed Feb 02, 2005 4:26 am Post subject: |
|
|
Hey Ben-(You're not that tower in London, are you, I'd hate to be talking
to a Clock! lol)
I hope you're not on a tight schedule, I just finished moving my office, and
I'm ready for sleepy time.
Look for an email(in your junk folder?), subject line "exhueydriver", let me
know what time zone you're in, I'm in PST (US), I've found that the learning
experience is faster by voice, so let's get together on MSM IM, I can talk with you and send files as necessary.
RE: Your AS offer, i don't have a Mac, and until I win the lottery, I can't afford more than one comp.
Oh Well. |
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Wed Feb 02, 2005 7:36 am Post subject: |
|
|
The times are changin.
MAC Mini ~ 500€.
Worth to think about  |
|
| Back to top |
|
 |
BigBen
Joined: 01 Feb 2005 Posts: 1
|
Posted: Thu Feb 03, 2005 10:42 am Post subject: |
|
|
Thanks Don,
I'm in Montreal, Quebec, so that would be EST. I hope we can share your solution with the rest of the community afterwards...
Ben |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|