Forum Replies Created
-
AuthorPosts
-
Theunis De Jong
MemberThat particular error indicates you saved the file as “RTF” instead of Plain Text.
See https://creativepro.com/how…..g-post.php for how to save a script the correct way.
In that post David says
.. in the vast majority of cases the code you find will be written in javascript ..
— Eugenyus doesn't say so but yes, his is a Javascript as well. (The other scripting languages need to be saved in a different way.)
Theunis De Jong
MemberIn this case it might be easier to write a script that does the hard work! (Well it was for me :) )
Download “makecalendar.zip” from my site: https://www.jongware.com/binari…..lender.zip
It contains the Javascript “makeCalender.jsx”, which you should put into your User Scripts folder, and a CS4-and-higher template “calender.indd”. Open the template to adjust the fonts and positions of the boxes, and add as much other stuff as you want. Please note that the texts “day”, “month”, and “dayname” must be the only texts in these frames; they get replaced with the day number, month name, and name of the day. If you don't need one of these items, it's safe to remove its entire frame.
The template document should only contain a single page. The script opens the template document, duplicates the first page, and adds text where appropriate. Then it saves it under the month's name in the same folder as you put the template document in.
You don't need to use my template, you can supply your own. Just make sure it only has one single page and contains separate text frames denoting the items you want it to fill in.
This script is hardcoded for 2014: on line 11, you can find
var dayOfYear = 3;
This is because the first day of 2014 is a Wednesday. For other years, you need to adjust this value. (I know, I could probably have the script ask for a year and then calculate it. Well … this was a quickie!)
Theunis De Jong
Member“View” -> “Show Frame Edges” show the table grid lines — but, as Bob says, only in the Normal working mode where you can see other guides as well.
Theunis De Jong
MemberText 'in' automatic running headers cannot be edited, because all there is in your document is a single “<Running Header>” variable code.
Perhaps Power Headers could help you: https://creativepro.com/pr-…..rs-2-0.php
Theunis De Jong
MemberI thought in a script that works in this way: I select a frame text (802004020) e.g. and the script places all images starting with 802004020 in a specific folder. Is it possible?It sure is possible. If I understand correctly, you don't even have to select a text first — this would be the InDesign file name, right? Then you can use
var imageRootName = app.activeDocument.fullName.name.match(/^.+(?=.indd$)/i);
Gathering image file names from a specific folder is as easy as this:
var specificFolder = Folder('/c/temp');
var imageList = specificFolder.getFiles(imageRootName+'*');
alert (imageList.join('r'));
Despite its name, the 'getFiles' function can return both files and folders. If there is a chance your file name specification might also match a folder, you can inspect each of the returned File objects like this:
if (imageList[i] instanceof File)
.. yes, safe to place
Is this enough to get you started?
Theunis De Jong
MemberIf you want to unembed all of your graphics so you can use the Place/Gridfy trick, you can use Peter Kahrel's script:
https://www.kahrel.plus.com/ind…..mages.html
I think this is easier and faster than trying to draw a new grid with empty rectangles, and then move your images one at a time into them. It also has the advantage that you then have a “local” copy of your images; and your InDesign file will sigh with relief when it's freed of several hundred megabytes of data.
Theunis De Jong
MemberChris, a GREP style like this
^s
will be applied to just the very first whitespace character per paragraph. Does that help?
The code ^ stands for “start of paragraph”, and s is “any sort of white space, which includes the hair space. You can also use the actual hair space code here — can't recall right away what it was :) Or simply use a regular space, saving you wear and tear on shortcut keys.
There is no way around having to insert some sort of space before your drop cap. This is the only way to outdent text out of the frame, short of kludges with anchored text boxes. Only if you have lots of outdents, you could reverse your styles: add an indent to all of your text, and then you have a margin to let anything stick “out” of the left edge.
Theunis De Jong
MemberYou also posted in The Pub, a hangout for discussing anything but InDesign. (It's a BYOB joint, though.)
I have no clue what your question is about. E-pub, PDF, Flash? So you can put me down for an “I dunno.”
Theunis De Jong
MemberCan you check the color mode of failing and working JPEGs? Possibly those you created are CMYK, while the website only allows RGB.
Theunis De Jong
MemberOkay, I'll take the bait. What is a cyclic flash?
Is it something one could reasonable expect being possible in InDesign, or is it more something like “how do i do my accounting using only indesign”, or “how to learn leather carving using indesign”?
Theunis De Jong
MemberOops. Just now I needed this script, so I copied and saved it and .. it didn't run! A couple of errors seem to have snuck in into the web-translation. Fixed right away, the above script is safe to be copied and pasted into the Extendscript Tool Editor.
Theunis De Jong
MemberChris, I think I overlooked this question last year! It isn't very hard to script — or, maybe, the basic functionality is not. I ran into some problems when trying it on a line containing a figure, because in that case the 'baseline' — the bottom of the 'figure' line — is not what you expect. Anyway, the script automatically selects the newly created frame, so you can move it right away to a better position.
By way of bonus: the first line defines the name of the object style to be applied to this new frame. If you don't want to use this, delete the first line and the one that applies it (the 2nd line from the bottom). If your selected text ends in a hard return, it automatically deletes this, as usually you don't want that inside a text frame.
//DESCRIPTION:Create a frame from a text selection
// A Jongware script 19-Feb-2013
app.doScript(function() {
objectStyle = “Figure”;
if (app.selection.length == 1 && app.selection[0].hasOwnProperty(“baseline”) && app.selection[0].length > 0)
{
frame = app.selection[0].parentTextFrames[0].duplicate();
frame.texts[0].remove();
frame.move (undefined, [0, app.selection[0].characters[0].baseline- app.selection[0].parentTextFrames[0].characters[0].baseline]);
app.selection[0].move(LocationOptions.AT_BEGINNING, frame.texts[0]);
while (frame.texts[0].characters[-1].contents == 'r')
frame.texts[0].characters[-1].remove();
frame.fit (FitOptions.FRAME_TO_CONTENT);
frame.applyObjectStyle(app.activeDocument.objectStyles.item(objectStyle));
frame.select();
}
}, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, “Frame from Selection”);Theunis De Jong
MemberMost (if not all, I didn't check) of the standard scripts have a short one-line description, somewhere just after the boilerplate data on version, creator, etc. But you have to open the script first to see this line.
Scripts that start with
//DESCRIPTION: xxx (insert any text here)
show this line in a popup when you hover over it in the Scripts panel, so I try to start all of my scripts with that.
Theunis De Jong
MemberA short breakdown of this script:
line 1: reset the findObject dialog to an empty state. Important, because there may have been some previous settings lingering!
line 2: this sets the Object Style to look for, nothing else.
line 3: this performs the actual finding. The parameter 'true' returns the found list in reverse order. This is important, because you must change objects from last to first, else InDesign gets confused.
line 4: add a default new layer
line 5: sets the name of this new layer. It's wrapped by a try .. catch, because if a layer already exists with this name (“Delete Me”), the command will fail and the script will stop. With the try..catch wrapper it will continue and the new layer will keep its default name (“Layer 3” or something like that)
line 6: loop over the list of found objects. Usually, this is done in reverse (to prevent aforementioned messing up ID's internal stack), but since line 3 already provided the list in reverse order, you can loop forward.
line 7: move each of the objects to this new layer.
Line 7 could also be changed to:
- found_list[i].remove(); // immediately and irrevokably delete the items …
- found_list[i].nonprinting = true; // set the object to non-printing
- found_list[i].appliedObjectStyle = “SomeOtherStyle”; // if you want to do something else
- … World = Oyster, Wish = Command, etc., from this point on!
Theunis De Jong
MemberFurry, after all said and done it wasn't as hard to script as I imagined … The following Javascript will add a layer, then move all of the objects with style “YourStyleNameHere” to the new layer. I opted doing it this way, rather than *automatically* delete the objects – that's also scriptable, but now you can toggle off all other layers and first review what's going to be deleted!
app.findObjectPreferences = null;
app.findObjectPreferences.appliedObjectStyles = "YourStyle";
found_list = app.activeDocument.findObject(true);
newLayer = app.activeDocument.layers.add();
try { newLayer.name = "Delete Me"; } catch (e) { }
for(i=0; i<found_list.length; i++)
found_list[i].move(newLayer);(Edit) added 'null' line above
-
AuthorPosts
