Base64 Encoding

Can Panorama X encode with Base64? And, if it can, how can I confirm that it is encoded with Base64?

Check the Help file…

I did and it is not in there, unless I completely overlooked it.

Ugggh, I did not do a search, I just looked at texttobinary and the list of encodings. Thank you so kindly for pointing out my oversight.

I am attempting write a print driver to bypass the normal macoos dialog and not use Panorama forms but grab a file and send it with the correct printer string to a networked printer from Panorama.

Im thinking that curl or shell script can scan the network to find the address of the printer. Is this possible? I have searched the net and cannot find information about how to do this that makes sense to me at the moment.

If the file is plain text, a pdf or a postscript file you can use the lp terminal command to print to your default printer.

let theFile="~/desktop/Euro-English.txt"
shellscript {lp theFile}

The lpstat command will return a list of available printers. Printing more complex types of files is more than the lp command is capable of handling. Here is the man page for the lp command:

https://ss64.com/osx/lp.html

Applescript may offer other scripting solutions for printing more complex files, possibly from their native program.

Thank you Gary,
I will be printing a png or tiff as well as text.
I have not tested it yet but I believe my code for creating the printer file with the printer specific settings and format is correct. I just need to figure out how I am going to send that base64 encoded file to the correct printer on the network. Ill give your suggestions a try.

Actually the lp command will also print png files as well. From my test the image was printed in the center of the page using the default printer.

I tried the following

let theFile = “/Users/stevemiddleton/Downloads/test2_w.png”
shellscript {lp theFile}

Which generated an error. "lp error - unable to access “theFile” - no such file or directory.

I know my path is correct, I have the image showing in a ImageDisplayObject. Thoughts?

The ShellScript command doesn’t know that theFile is a variable. What you have there is the same as putting

lp theFile

into Terminal, and expecting it to know the path. Read the part about embedding a formula into ShellScript. I think you want

shellscript {lp $«theFile»$}

He can also use"

shellscript {lp }+theFile

With the path he is using in his test he can, but if the path contains any characters that need to be escaped, he needs to go the embedded formula route.

I would recommend using the posixpath( function. Either:

shellscript {lp $«posixpath(theFile)»$}

or:

shellscript {lp }+posixpath(theFile)

Leaving off the posixpath( function would have worked in Steve’s exact example, but it will break if there are any spaces or unusual characters in the file name or path.

That conflicts with the documentation.

The formula $«upper("hello world")»$ will be embedded as HELLO\ WORLD .

That seems to imply that escaping spaces etc. is done for you. I think

would result in escaped backslashes as well as escaped spaces.

This worked. Thank you gentlemen.

let vtheFile = “/Users/stevemiddleton/Downloads/test2w.png”
showvariables vtheFile
shellscript {lp $«posixpath(vtheFile)»$}

Just a minute after I posted I thought – “I probably got it wrong”. Before I could double check (I already checked once), Dave got it.

Ok, now I checked the source code. If you use $«…»$ then Panorama uses unixshellstring(, so you don’t want to also use posixpath(. If you are supplying a unix path, the result is the same.

If you might supply an “old-fashioned” HFS path (for example volume:folder:folder:file.png) then you would want to use posixpath( instead.

shellscript {lp ^«posixpath(theFile)»^}

This code will work with both UNIX and HFS paths.

On the other had, I see that Steve says my suggestion worked! :man_shrugging: Ok, probably because his path had no special characters in it. So Steve, you should probably change your code in case later you have a path with a space in it.

Thank you Jim, I will change that.

For this “Panorama” print driver I am creating I need to do the following.

In Panorama, I will present the user with my own custom “print dialog” that will ask for printer specific features. I will then create a file, base64 encoded formatted according to the printer manufactures specification.

This is where I am stuck now.
I then will need to send that file to a port or ip address directly to the printer.

Not sure how to ping the printer, use bonjour to locate it, I tried Garys suggestion to use the code below but that did not work. Do I need to have cups installed?

shellscript {lpstat}

To say it another way. I need to connect to a printers port on our local network so I can send the file and settings to that printer.

Sorry I have no clue if that is even possible. Does the printer manufacturer claim that this printer is supposed to work with Mac computers?