![]() This requires another handler for finding and changing text. Once satisfied that the script is ok at this point, we can flesh out the placeTableToText handler to delete the first two lines of text placed (table head and column heads) and change tabs to returns. We have received this error with some of our tests but have yet to define exactly what causes the problem. If you get an “Import Failed” error, try the script with a new document. With your document open and the Primary Text Frame selected, you should be able to run the script to have the table placed in your document. Make sure you also have the getFrameSelection and getFileRef handlers from above at the bottom of the script. The handler (added to the script): on placeTableToText(itemRef, fileRef) Set storyRef to placeTableToText(itemRef, fileRef) Adding a call to a handler named placeTableToText to the top section, the script will now read as follows: set promptStr to "Select Excel file to import" To add to this we will develop a handler to place the file. With the code for getting the text frame and file verified, we can combine the two to place the file and convert the table to text. If name extension of fileInfo is not fileExt thenĮrror "Requires Excel file with file extension of " & fileExtĮnd getFileRef PUTTING THE SCRIPT TOGETHER Set fileChoice to choose file with prompt promptStr (*Returns alias reference to file if file extension for file chosen is as specified*) Set fileRef to getFileRef(promptStr, fileExt) Set promptStr to "Select Excel file to import" Again, a handler is used with the text for a user prompt and file extension passed to it as part of its call: -Get Excel file With the text frame selection verified, the script will have the user select the file. If selList is or class of item 1 of selList is not text frame thenĮrror "Requires text frame to be selected" ![]() (*Returns text frame reference if first item of selection*) The script will test to make sure a text frame is selected as part of a handler routine. We will have the user select the text frame for placing the file. Our document will only have one page with a Primary Text Frame. For testing, our data file will have only one item to start with. But, even with this we will start simple. Running this script with a sample Excel file gives us enough information that we can go ahead and write our script. ![]() Tell storyRef to delete (paragraphs 1 thru 2) Tell tableRef to convert to text column separator tab row separator return Tell application "Adobe InDesign CC 2019" We will have the user define the text frame for importing the table: set fileRef to choose file Now that we have worked through the process manually, we can write a Proof of Concept script to make sure the script will work when we replace the manual steps above with code. At this point we will just style the paragraphs manually. Hopefully you have set up your document using paragraph styles. I wouldn’t have been able to do it without this forum.Now to style the paragraphs. : The path to the file in which to store the overset report. To file or text : The path of exported PDF file. Even though it has merge in the description, it doesn’t come up in the dictionary search results.Įxport v : Merges records and exports to PDF. The export command is listed in the InDesign dictionary, but not under the other merge prefs or options. This allows the pdf export to happen without the intermediary step of creating a merged InDesign document first. Set MyPDFexportPreset to PDF export preset PDFPresetĮxport to (thePath & theFileName & ".pdf") using MyPDFexportPreset without showing options set PDFPreset to "Medium resolution" as string Much like a normal pdf export, but in the data merge block. Instead of the command merge records, it’s export. In the mean time, I’ve assigned a key command, but it’s more of a work around. Can i substitute a few commands to turn it into a script that exports pdfs? I’d like to be able to suppress warnings. The following code will merge into a non-data-tied indesign file. I’ve found that I can export it to a merged indesign document, but I can’t find any code to let me export from the data-tied indesign file to the pdf.Ĭan you point me in the correct direction? The last thing I’m trying to do it set it to export to a pdf from the data menu flyout. I’ve scripted the majority of what I would like it to do, and it’s working well: I have a bunch of labels that I routinely output to a pdf and then send to the printer.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |