Selecting only files in file selection

613 views
Skip to first unread message

Joe

unread,
Nov 8, 2012, 6:39:08 PM11/8/12
to yad-c...@googlegroups.com
I have a dialog for selecting files to print from a "print queue" directory.  When I use --file-selection, I'd like an option that's the opposite of --directory that shows only files and does not show the directory tree panel.

I don't want the user to be able to navigate out of the current directory and I don't want the confusion of seeing other directories that are not relevant to the task at hand.

Is there a way to do that?

The print files can be any name, possibly (but not always) with a .pdf or .ps suffix.

Victor Ananjevsky

unread,
Nov 9, 2012, 3:19:09 AM11/9/12
to yad-c...@googlegroups.com
В Thu, 8 Nov 2012 15:39:08 -0800 (PST)
Joe <jos...@main.nc.us> писал:
use list instead of file selection. for example:

find /path/to/print/queue -maxdepth 1 -type f -name *.ps -o -name *.pdf -printf "FALSE\n%f\n" | yad --list --checklist --column="#" --column="File" --print-column=2



--
Victor Ananjevsky <anan...@gmail.com>

Joe

unread,
Nov 14, 2012, 6:04:16 PM11/14/12
to yad-c...@googlegroups.com
Thanks.  I can work with that.  Sometimes I get so focused on one tool that I forget what the others can do.
Joe

Joe

unread,
Nov 16, 2012, 12:45:19 AM11/16/12
to yad-c...@googlegroups.com
Works, but it doesn't do what I want.

I have a script which selects files from a print queue and then prints them.  Normally, there will be more than a handful of files and if I want to be selective, I have to check or uncheck more than a few one by one (depending on whether I start them out as all checked or all unchecked.)  The file select lets me do all sorts of cool stuff with my mouse like selecting a block.  So, I still would like a files only option for it.

As a separate, related question: the next script in the sequence allows deleting of files (presumably after they have been printed).  I would like to pass it the list of files that were just printed.  I've been experimenting with --file-filter, but so far I'm doing something wrong (FILES ends up empty.).

 FILTERS=""
  for FILE in "$@"
  do
    FILTERS="${FILTERS} --file-filter=\"${FILE}\""
  done
 
  ## get file selection(s) from yad separated by vbars in a string
  FILES=$(yad --title "Select Print Files to Delete" --width=400 --height=500 --file-selection --multiple --filename="$HOME/pq/" ${FILTERS})

Maybe the whole  FILTERS string is getting treated as a single parameter and I have to do a dance with eval or something similar like building the whole command in a string.

This brings up another issue (hijacking my own thread yet again).  I use AutoKey and one of the cool things they have is a website/blog where people can submit working examples for others to use and learn from.  It would be great if yad had something like that.  I'm just starting to experiment with several features and I really don't want to have to distract the main developer with a bunch of questions, many of which might be answered just by looking at some working examples.

Joe

unread,
Nov 16, 2012, 2:55:30 AM11/16/12
to yad-c...@googlegroups.com
Closer ...

Got it to see the first file when I gave it two files as arguments:


  FILTERS=""
  for FILE in "$@"
  do
    FILTERS="${FILTERS} --file-filter=\"${FILE}\""
  done
 
  ## get file selection(s) from yad separated by vbars in a string
  Q='"'
  COMMAND="yad --title ${Q}Select Print Files to Delete${Q} --width=400 --height=500 --file-selection --multiple --filename=${Q}$HOME/pq/${Q} ${FILTERS}"
  FILES=$(eval ${COMMAND})
 

Victor Ananjevsky

unread,
Nov 16, 2012, 3:26:48 AM11/16/12
to yad-c...@googlegroups.com
В Thu, 15 Nov 2012 21:45:19 -0800 (PST)
Joe <jos...@main.nc.us> писал:

> >
> I have a script which selects files from a print queue and then prints
> them. Normally, there will be more than a handful of files and if I want
> to be selective, I have to check or uncheck more than a few one by one
> (depending on whether I start them out as all checked or all unchecked.)
> The file select lets me do all sorts of cool stuff with my mouse like
> selecting a block. So, I still would like a files only option for it.
>

you may use --multiple argument instead of --checklist to do that

--
Victor Ananjevsky <anan...@gmail.com>

Joe

unread,
Jan 5, 2013, 3:09:02 PM1/5/13
to yad-c...@googlegroups.com
Thanks.  I have it working now.  Very nice!

Joe
Reply all
Reply to author
Forward
0 new messages