KayEll Posted April 21, 2015 Share Posted April 21, 2015 I am not sure how to do this. I have a folder with 300 randomly named images (customer-generated QR codes). I need to place each one consecutively onto preprinted stock. I did something like this a long time ago but I thought I had linked to data that had all the paths in a field, so that was easy. Unfortunately, all I have is the images. Is there a rule that would say "Place the first image in this folder and then place the next image in this folder" and so on? It seems simple, but I haven't had the need to write JavaScript rule, I mainly do easy switch rules. Any help would be greatly appreciated. KayEll Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted April 21, 2015 Share Posted April 21, 2015 There's no mechanism currently in the JavaScript subsystem in FusionPro to let you examine or iterate the contents of folders. Such functionality would be a potential security risk on web-to-print systems such as MarcomCentral and DSF. This is actually something more suited for an FP Server (Producer API) workflow than a Creator/Desktop workflow. FP Server allows you to leverage the composition engine as part of a larger application, which can be automated. For instance, you could have a simple program written in something like C# or Python, or even a DOS batch file, which could iterate the contents of a folder, build up a data file, and then invoke FP Server. In a Desktop workflow, you would need to do this manually. For instance, you could open up a Command Prompt, CD to your folder, and issue a command such as "dir /B > files.txt", to dump out the list of files in that folder to a data file, which you could then use as the data for your FusionPro composition. The other option is to write a DLL in C/C++, against a very specific API, and place it into the plug-ins folder for FusionPro. The DLL can expose whatever extended functionality you need to the JavaScript subsystem in FusionPro. This would require some paid consulting assistance, however. Quote Link to comment Share on other sites More sharing options...
step Posted April 21, 2015 Share Posted April 21, 2015 To my knowledge, that is not functionality that FP has. And while I'm not entirely sure what you mean by "place the first image in this folder and then place the next image in this folder," I think your best bet would be to create a data file that has your graphics in it. You declare specific paths programmatically for different files but I don't really see how you could do that without a data file. Are you saying all of your images are in different folders? If they all have a common folder, making a data file can be done pretty simply using bash scripting. Can you be more specific about where the files are located/named/etc? Are they PDFs? EPS's? Quote Link to comment Share on other sites More sharing options...
KayEll Posted April 21, 2015 Author Share Posted April 21, 2015 The images are all in one folder. They are .pngs, and are randomly named, by which I mean they aren't named "GR-1", "GR-2". I need to place each one individually on 3-up output. KayEll Quote Link to comment Share on other sites More sharing options...
step Posted April 21, 2015 Share Posted April 21, 2015 Okay well open up Terminal (Applications/Utilities/Terminal.app) and we can create the data file: 1. copy the following code into Terminal and press enter echo graphic > ~/Desktop/data.csv That will create a file on your desktop called "data.csv" with the field name "graphic" 2. type "cd " (with a space) and drag-and-drop the folder containing your graphics onto the terminal window and press enter 3. Copy this code into Terminal and press enter ls | grep png >> ~/Desktop/data.csv Now you can link up to that data file that was created on your desktop and pull in your graphics by referencing the "graphic" field. Then you can impose them 3-up using FPImposer. Quote Link to comment Share on other sites More sharing options...
dreimer Posted April 21, 2015 Share Posted April 21, 2015 Wow, learning some good tricks here! My question is how is this sequential though if the files are randomly named? Quote Link to comment Share on other sites More sharing options...
KayEll Posted April 21, 2015 Author Share Posted April 21, 2015 Thank you! That was quite painless. I appreciate that. KayEll Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.