I’m using sips (the command line version of image events) to retrieve the type of file and the bit depth (the last one can’t be done with image events).
I retrieve the format (jpeg or tiff) and the bitspersample (8bit or 16bit) and use a contains to get the info.
set ImgInfo to (do shell script "sips -g format -g bitsPerSample " & quoted form of theItem)
set lookingfor to "tiff"
set Imgformat to ImgInfo contains lookingfor --true when tiff
set lookingfor to "16"
set sixteenbit_input to ImgInfo contains lookingfor
However, the second contains makes my application crash with an “Applescript error NSInternalScriptError (8)”.
I already tried to split the code like
set ImgInfo to (do shell script "sips -g format" & quoted form of theItem)
set lookingfor to "tiff"
set Imgformat to ImgInfo contains lookingfor --true when tiff
set ImgInfo to (do shell script "sips -g bitsPerSample " & quoted form of theItem)
set lookingfor to "16"
set sixteenbit_input to ImgInfo contains lookingfor
This second code snippet also crashes. Reversing the code, first bitdepth than file type, doesn’t change anything: the second one crashes.
Using other variable names in the second step doesn’t make a difference either: it still crashes.
Why does this happen?