Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
automatically printing
#2
I do something like this, but on command, not automatically, to convert .xlsx files to pdf and then send them to the printer.

Apple computers use a Unix based system, I believe, so this script will send jpgs to the printer you designate.

A Linux programme incron uses inotify to monitor changes to a specific directory. Any time you put a photo in there, it can trigger the bash script below. Read this.

Not Python though!!

Output:
#! /bin/bash # set your paths JPGfiles="/home/pedro/temp/*.jpg" backupPath='/home/pedro/backupJPGs/" for X in $JPGfiles do if test $X then echo "This is one of the files:" printf $X; echo "Now sending the file to the printer ... " # set your printer lp -d "EPSON-L380-Series" $X; # get rid of the jpg after sending to the printer # or move it to backupPath # mv $X $backupPath echo "Junking the jpeg ... " rm $X; fi done
Larz60+ write Jan-22-2022, 10:41 AM:
Using output tags, even though wrong title will format bash scripts properly.
Reply


Messages In This Thread
automatically printing - by homg1968 - Jan-16-2022, 08:08 PM
RE: automatically printing - by Pedroski55 - Jan-17-2022, 09:57 AM
RE: automatically printing - by Pedroski55 - Jan-18-2022, 10:50 PM
RE: automatically printing - by Pedroski55 - Jan-22-2022, 02:54 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020