home *** CD-ROM | disk | FTP | other *** search
Text File | 1999-03-04 | 1.6 KB | 60 lines | [TEXT/ToyS] |
- (*
- V1.1 - Akua Sweets V1.31
- Run to store the current printer.
- Run again to set the printer to the stored printer.
- Hold the option key when running to store the current printer
- over the previously stored printer.
- *)
-
- property kasConfig : ""
-
-
- on run
- if ((kasConfig is "") or (option key down of (input state))) then
- set kasConfig to printer configuration
- set newName to ("Use " & PrinterName(kasConfig))
- if (length of newName > 31) then set newName to (the text 1 thru 30 of newName) & "…"
- collate (path to me) renaming it to newName
- set the icon of (path to me) to PrinterIcon(kasConfig)
- display dialog "The printer will be set to \"" & ¬
- PrinterName(kasConfig) & ¬
- "\" when this script is run." buttons {"OK"} default button 1
- else if (kasConfig is not "") then
- set infW to (display drawing titled "Printer Switch" with dimensions {96, 86})
-
- -- Not good practice -- drawing into an info window :)
- draw a picture into infW ¬
- using data (PrinterIcon(kasConfig) as picture) ¬
- inside of {16, 4, 80, 68}
-
- draw a string into infW ¬
- using data PrinterName(kasConfig) ¬
- offset by {48, 83} ¬
- using state {text size:14}
-
- printer configuration kasConfig
-
- display info infW with disposal
- else
- beep
- end if
- end run
-
-
- on PrinterName(prCfg)
- set choice to desktop printer name of prCfg
- if (choice is "") then set choice to (LAN printer name of prCfg)
- if (choice is "") then set choice to print driver name of prCfg
- return choice
- end PrinterName
-
-
- on PrinterIcon(pc)
- try
- set ic to desktop icon of pc
- on error
- set ic to the icon for (print driver alias of pc)
- end try
- return ic
- end PrinterIcon
-