AppleScript名:10.12でプリンタ一覧の情報を取得する |
— Created 2014-11-27 by Takaaki Naganoya — Modified 2016-02-02 by Takaaki Naganoya — 2016 Piyomaru Software use AppleScript version "2.5" use scripting additions use framework "Foundation" use framework "AppKit" –Get Printer Names set pArray to current application’s NSPrinter’s printerNames set pList to pArray as list –> {"Canon iP110 series", "KING JIM TEPRA PRO SR3700P", "NEC MultiWriter 5750C @ MBA13", "PageSender-Fax", "PDFwriter", "PM-T960-1", "Print to VipRiser", "Print to VipRiser (CUPS-PDF)"} –Get Printer Type (Driver Name?) set tArray to current application’s NSPrinter’s printerTypes set tList to tArray as list –> {"TEPRA PRO SR3700P", "NEC MultiWriter 5750C v2.4", "Lisanet PDFwriter", "EPSON PM-T960", "Fax Printer"} set colorPinterList to {} repeat with i in pList set j to contents of i –Is it a Printer? set aPrinter to (current application’s NSPrinter’s printerWithName:j) set aDesc to aPrinter’s deviceDescription set aRec to aDesc as record –> {NSDeviceIsPrinter:"YES"} –Is it a Color Printer? set aColor to (aPrinter’s isColor()) as boolean –isColor() deprecated? It works if aColor = true then set the end of colorPinterList to j end if end repeat colorPinterList –> {"Canon iP110 series", "NEC MultiWriter 5750C @ MBA13", "PDFwriter", "PM-T960-1", "Print to VipRiser", "Print to VipRiser (CUPS-PDF)"} |
More from my site
(Visited 82 times, 1 visits today)