Page 1 of 1

How do I save printerSettings?

Posted: Wed Sep 12, 2012 5:30 pm
by stephenmcnutt
I understand that printerSettings is something called an opaque binary file that I can only set or get in its entirety, but I don't understand how to save it because I don't know what kind of file to save it as. I imagine the file type may be different for Windows and for OS X.

From the LiveCode Dictionary:

Examples:
set the printerSettings to the cSavedPrintSettings of me
put the printerSettings into url ("binfile:" & printerSettingsFile())

It looks like that first line is pulling printerSettings from a variable. That second line is what I want to do except I don't understand what the printerSettingsFile() is all about. It looks like some sort of custom function.

So I'm left with the question: How do I save printerSettings to a file in both Windows and OS X? What file extension do I use?

Re: How do I save printerSettings?

Posted: Wed Sep 12, 2012 8:27 pm
by Klaus
Hi Stephen,
stephenmcnutt wrote:I understand that printerSettings is something called an opaque binary file that I can only set or get in its entirety, but I don't understand how to save it because I don't know what kind of file to save it as. I imagine the file type may be different for Windows and for OS X.
The filetype does not matter, as long as you save to a "binfile:".
stephenmcnutt wrote:...
Examples:
set the printerSettings to the cSavedPrintSettings of me
put the printerSettings into url ("binfile:" & printerSettingsFile())

It looks like that first line is pulling printerSettings from a variable.
Yep, almost, in this example from a custom property.
stephenmcnutt wrote:That second line is what I want to do except I don't understand what the printerSettingsFile() is all about. It looks like some sort of custom function.
Yes, just a bad example. You can supply ANY valid filename here.
stephenmcnutt wrote:So I'm left with the question: How do I save printerSettings to a file in both Windows and OS X?
Use a place where your app is allowed to write like the users desktop or documents folder (or a subfolder for you app or...)
Like this:
...
put specialfolderpath("desktop") & "/myprintersettings" into tSettingsFile
put the printersettings into url("binfile:" & tSettingsFile)
## Done :-)
...
stephenmcnutt wrote:What file extension do I use?
Two options:
1, Whatever you want :-)
2. None :-)
Suffix does not matter at all, since you/your app knows what the content of that file if meant ot do! 8)


Best

Klaus