set allprinters to every printer
set printernames to name of every printer
end tell
set backvalue to ""
repeat with printername in printernames
set backvalue to backvalue & printername & (ASCII Character(13))
end repeat
set cell "PrinterList_Global" of current record to backvalue
---
This can be used to set the default printer on OSX.
2)
The second option uses the lpstat OSX command to get the printer names. This will give you a different list. But the printer names this one gives can be used for the "lp" OSX command. This will be important later when we get to fax sending.
---
set oldDelims to AppleScript's text item delimiters
set PrinterStatusList to {}
try
set cmd to "lpstat -p | grep ^printer"
set PrinterStatus to do shell script cmd as text
set AppleScript's text item delimiters to {" "}
repeat with i from 1 to count of paragraphs of PrinterStatus
set s to paragraph i of PrinterStatus
set p to text item 2 of s as list
copy p to end of PrinterStatusList
end repeat
on error
set PrinterStatus to ""
end try
set AppleScript's text item delimiters to oldDelims
set backvalue to ""
repeat with printername in PrinterStatusList
set backvalue to backvalue & printername & (ASCII Character(13))
end repeat
set cell "PrinterList_Global" of current record to backvalue
--
Okay, now you have the printer list. You can easily create a value list based on this, and let the user choose from it.
What about faxing??
This is where the lp command comes in.
With lp you can send a file (pdf), to a number.
The syntax is the following:
lp -d PrinterNameHere -o phone=PhoneNumberHere filepathandnameHere
You can call this from FileMaker using a do shell script AppleScript Command.
I attached a sample file for printer listing, the faxing is up to you, but based on this, you can easily create it.
You can download the demo file here. (right click - save as).