On Mon, 2011-01-03 at 20:57 -0600, John Hasler wrote: > John A. Sullivan III writes: > > Does anyone know how to change the behavior of gs, Konqueror, KDE, > > dcop, or anything else to ensure the file icon does not appear until > > the reduction is complete? > > Have gs write to a hidden temporary file. Rename it when it's done. > Arrange to remove the temporary if gs exits abnormally (you need to add > error-handling anyway). > -- > John Hasler > > Oops - needed to added quotes around the DIR variable in case of spaces in the directory names. Here's what we have now:
#!/bin/bash OFILE="" OK=true FILES="\"$(echo "${1}" | sed 's/ \//\" \"\//g')\"" DIR="$(echo ${FILES} | sed 's/\"\([^\"]*\)\".*/\1/')" DIR="${DIR%/*}/" EXT="" ret=0 while ${OK} do OFILE="$(kdialog --title "Enter New Reduced PDF File Name" --getsavefilename "${DIR}")" if [ $? -ne 0 ];then exit 4 fi EXT="${OFILE: -4:4}" if [ "${EXT}" != ".pdf" -a "${EXT}" != ".PDF" ];then OFILE="${OFILE}.pdf" fi if [ -f "${OFILE}" ];then kdialog --title "Reduce PDF File" --warningyesno "The file ${OFILE} already exists.\nShall I overwrite it?" if [ $? -ne 0 ];then continue fi fi OK=false done FNAME="${OFILE##*/}" DNAME="${OFILE%/*}" kdialog --title "Reduce PDF File" --msgbox "PDF reduction can take several minutes.\nYou will be notified via popup when the process is complete.\nThank you." & eval gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=\"${HOME}/tmp/${FNAME}\" ${FILES} ret=$? if [ $ret -eq 0 ];then mv "${HOME}/tmp/${FNAME}" "${OFILE}" ret=$? fi if [ $ret -ne 0 ];then rm -f "${HOME}/tmp/${FNAME}" kdialog --title "Reduce PDF File" --error "PDF Reduction of ${OFILE} failed." exit 5 fi kdialog --title "Reduce PDF File" --msgbox "PDF Reduction Completed for: \n${OFILE}" -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/1294174838.20531.0.ca...@denise.theartistscloset.com