Read a simple plist, show/edit it and write it back

Hi all,

since I’m not very familiar with AppleScript but think it’s the best way to solve my problem.
I hope you have some hints for me.

I have a really annoying problem: Under 10.4 in PrintCenter were Checkboxes to show or hide a printer.
That was great because we have about 80 Printers but not all users need all of them, so every user was able to mark the printers he needed.

Under 10.5/10.6 the checkboxes are gone :frowning:
We set up the system with the cups files for all printers and with the com.apple.print.favorites.plist (in /Library/Preferences/) where all printers are listed.
The user sees every printer in the print dialog that is marked with “true” in this plist.

Now we want to give the users a script that is a “replacement” for the checkboxes of the old system.
The idea is to read the plist, show the printer name and a checkbox which shows the true/false.
After marking the needed printers the list it should be written back but now to ~/Library/Preferences/ so that every user has its own com.apple.print.favorites.plist

This is an example of the plist in xml format:

<?xml version="1.0" encoding="UTF-8"?> Printer-1 Printer-2 Printer-3 MorePrinters

Many thanks for your ideas and hints!!!

Bye… WuerfelMac

Perfectly doable, but not with AppleScript alone - it only does ‘display dialog’ and ‘display alert’.
To create any other type of window you’d use AppleScriptObjC, or, quite a bit easier, Pashua.
Pashua takes a configuration string, which can be constructed in & passed from a script, and turns that into the window you want.
After the window closes Pashua passes its contents back to the script, where you can further manipulate the contained data.
There’s an example of a Pashua script here, post #4. Don’t let the amount of code spook you, everything from ‘Glue code…’ on is already written.

{edit}
I see you have 80 printers in all. How many would the window have to show? Pashua doesn’t do a scrollable list of checkboxes, I’m afraid.
[/edit]

It could be done with ‘choose from list’. A bit unwieldy, but do-able.

Many thanks for your replies !

I’ll try to get this thing working… :slight_smile:

Greets… WuerfelMac