On Jun 1, 2011, at 20:01, Matt Mollison wrote:

> Christiaan,
> 
> No, it does matter. I'm guessing you didn't actually try running it using . 
> as the input. The find command I proposed to replace is called when the input 
> is a directory (after `if [ -d "$1" ]; then`). You should know what happens 
> with the find command, you wrote it. :)

No, I didn't (write it).

> (i.e., if the input ($1) is a directory, find all the PDFs in $1, then rerun 
> the script ($0) with the PDF names.)
> 
> I tried running with . as the input (also, I had to put double quotes around 
> $parentFolderExt in `if [ $parentFolderExt != "pdfd" ]; then`, otherwise I 
> would get the error "line 19: [: !=: unary operator expected"). Here's the 
> output:
> 
> $ cd ~/Desktop/test\ conv\ bundle/
> $ conv_pdf_w_notes_to_pdfds_03.sh .
> ./first.pdf
> 180:245: execution error: Finder got an error: Can’t make file 
> "MacintoshHD:Users:<user>:Desktop:test conv bundle:first.pdfd" into type 
> file. (-1700)
> ./subdir 1/second.pdf
> 200:265: execution error: Finder got an error: Can’t make file 
> "MacintoshHD:Users:<user>:Desktop:test conv bundle:subdir 1:second.pdfd" into 
> type file. (-1700)
> ./subdir 1/subdir 2/third.pdf
> 216:281: execution error: Finder got an error: Can’t make file 
> "MacintoshHD:Users:<user>:Desktop:test conv bundle:subdir 1:subdir 
> 2:third.pdfd" into type file. (-1700)
> 
> It runs `skimnotes convert` fine and pdfds are produced, but it errors in the 
> osascript section. When I `echo $file` before the final if statement begins, 
> this is the output:
> /Users/<user>/Desktop/test conv bundle/./first.pdf
> /Users/matt/Desktop/test conv bundle/./subdir 1/second.pdf
> /Users/matt/Desktop/test conv bundle/./subdir 1/subdir 2/third.pdf
> I guess osascript doesn't like the /./ in there. Thus, the comments, label, 
> and modification date don't get transferred.
> 
> When I run it with my replacement of . with $PWD, things run as they should:
> $ conv_pdf_w_notes_to_pdfds_03.sh .
> /Users/<user>/Desktop/test conv bundle/first.pdf
> /Users/<user>/Desktop/test conv bundle/subdir 1/second.pdf
> /Users/<user>/Desktop/test conv bundle/subdir 1/subdir 2/third.pdf
> 
> Matt
> 

Probably better to just change the POSIX file assignments to something like

set thepdf to POSIX file "${file}" as alias
set thepdfd to POSIX file "${file}d" as alias

AppleScript file references are extremely buggy, always been, and I've given up 
hope.

Christiaan

> On Wed, Jun 1, 2011 at 5:08 AM, Christiaan Hofman <[email protected]> wrote:
> 
> On Jun 1, 2011, at 6:33, Matt Mollison wrote:
> 
> > Also, it seems that the osascript part doesn't like '.' as the argument, so 
> > if you'd like to operate on the current directory using '.', you can change 
> > the top 'find' command to something like this:
> >
> >     if [ "$1" = '.' ]; then
> >       thisDir="$PWD"
> >     else
> >       thisDir="$1"
> >     fi
> >     find "$thisDir" -type f -name "*.pdf" -exec "$0" "{}" ";"
> >
> > Matt
> >
> 
> That shouldn't matter, because it never gets there for a directory. This part 
> is only called for .pdf files.
> 
> Christiaan
> 
> 
> ------------------------------------------------------------------------------
> Simplify data backup and recovery for your virtual environment with vRanger.
> Installation's a snap, and flexible recovery options mean your data is safe,
> secure and there when you need it. Data protection magic?
> Nope - It's vRanger. Get your free trial download today.
> http://p.sf.net/sfu/quest-sfdev2dev
> _______________________________________________
> Skim-app-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/skim-app-users
> 
> ------------------------------------------------------------------------------
> Simplify data backup and recovery for your virtual environment with vRanger. 
> Installation's a snap, and flexible recovery options mean your data is safe,
> secure and there when you need it. Data protection magic?
> Nope - It's vRanger. Get your free trial download today. 
> http://p.sf.net/sfu/quest-sfdev2dev_______________________________________________
> Skim-app-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/skim-app-users

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger. 
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today. 
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
Skim-app-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-users

Reply via email to