Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

APFS/High Sierra causing script problems

I am a photographer that uses Indesign scripts to automatically insert pictures in for school pictures and it outputs all the pictures in the correct place and then create the entire document.

Since upgrading to High Sierra on my Mac and the SSD converted to APFS I'm having problems with the order it would create the CSV file.

Previously the script named ImagetoCSV104.jsx would put the images in alpha/numeric order of the file name. Now it is putting them in an order that I do not understand. It seems random but every time I run it it's in the same wrong order.

Just to verify I went to my Sierra workstation with the same Indesign CS6 and script to see what would happen with the folder. It worked fine.

What can I do?

Here is the incorrect one created Indesign CS6 on High Sierra:

User uploaded file

Then here is the correct one created in High Sierra:

User uploaded file

If there is a way to re-write the script to make this work or some thing else, please let me know.


thanks!

MacBook Air, macOS High Sierra (10.13)

Posted on Nov 30, 2017 5:22 AM

Reply
6 replies

Nov 30, 2017 6:13 AM in response to brycesteiner

Any chance you can post this script?


It seems that whatever system call it makes to get the files is returning the results unsorted. I don't think this to be APFS caused, just some change in some routine that is being called.


Using shell scripts with wildcard expressions, such as "*.jpg", the results always come sorted.

I believe that depends on how the underlying shell works, and both bash and tcsh provide sorted results.


I also tried something similar using Python, and the results did NOT come sorted.

Nov 30, 2017 9:29 AM in response to brycesteiner

brycesteiner wrote:


here is an update:


If I put it on my Mac Mini server (runs 10.12.6 with HFS format, SMB sharing), the CSV is correct on the High Sierra computer. So far it happens only when the script processes a folder on the APFS volume.


That is significant.

As I see it, the script relies on the getFiles() function.

Since you tested this on two High Sierra machines, it does seem that APFS makes a difference.


I did a little test myself. I made two identical copies of a directory "test", one in my APFS system drive, and one on an HFS+ external drive. I used Python's os module to produce a list of files in each case:


os.listdir()


The results are consistent with your findings. The list came sorted in the HFS+ directory, and unsorted in APFS.


I guess that at least for now the only immediate solution is to do the sorting in your script.

I am sure there are library functions for doing it, but I am not familiar with javascript.

A quick google search is bound to provide answers.

APFS/High Sierra causing script problems

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.