Forum Replies Created
-
AuthorPosts
-
Matt Isaac
ParticipantIn your script, I notice that you have some variables that are not assigned a value. What is the purpose of assigning a variable but not giving it a value?
example:var myFilePath;
var myFile;
etc...
Also within the loop you call the variables without indicating they are variables
example:myPage = myPages[j];
whereas you do in other instances:var myFile = new File(myFilePath);
Is there reason for this?Matt Isaac
Participant/*This is just a question not a solution to the problem as far as i know*/
Kai, for the multiple pages could you call a separate function within the for loop eg.for var i = 0; i < allDocs.length; exportPages i++) function exoprtPages(){ for (var n = 0; n < app.document.pages.length; n++){ }}
Then use the same export method for each page within a document before moving to the next document?
Matt Isaac
ParticipantYeah i tried to work the try/catch block into my script but without copy/pasting yours i couldn’t get it to work so i just went with what i knew. I will experiment with try/catch and eventually get the hang of it.
—–
Turns out the try/catch statement works just as the if/else statement.
—–
Here is my updated script://Scripted by Skemicle //with assistance from Ari S if (parseFloat(app.version) < 6) main(); else app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Splice Image Along Path"); function main() { try{ var sel = app.selection; var orig = sel[0]; var path = sel[1]; var top = sel[0].duplicate(); path.subtractPath(top); var half1 = top.duplicate(); top.subtractPath(orig); app.selection = null; } catch(error){ alert("Please, make sure you have selected an image and an overlapping path."); } }
Thanks for your assistance Ari.
Matt Isaac
ParticipantHere is the script. I had some difficulty with the pathfinder so I enlisted the help of Ari who created a script to do this. Here is Ari’s script:
app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Subtract Paths"); function main() { try{ var mySelection = app.selection; var myPicture = mySelection[0]; var myPath = mySelection[1]; var topPicture = myPicture.duplicate(); var half1 = myPath.subtractPath(myPicture); var newPath = half1.duplicate(); var half2 = newPath.subtractPath(topPicture); var myGroup = half1.parent.groups.add ([half1, half2]); app.select(myGroup); } catch(myError) { alert("Make sure you selected 2 path items") } }
Here is my script with Ari’s assistance in the pathfinder portion and the thought of adding undo:
//Scripted by Skemicle //with assistance from Ari S if (parseFloat(app.version) < 6) main(); else app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Splice Image Along Path"); function main() { if(app.selection.length == 2){ var sel = app.selection; var orig = sel[0]; var path = sel[1]; var top = sel[0].duplicate(); path.subtractPath(top); var half1 = top.duplicate(); top.subtractPath(orig); app.selection = null; } else{ alert("Please, make sure you have selected an image and an overlapping path."); } }
Both scripts do basically the same thing. the main difference is that Ari’s script groups the two halves of the image and leaves the group selected while my script leaves the two halves ungrouped and nothing selected.
Matt Isaac
Participantyou can pull a guide into the master page and it will appear on every page that has the master page style applied to it.
June 15, 2016 at 11:12 am in reply to: GREP style, i want to add "," in numbers 3454342? 3,454,342 #85788Matt Isaac
ParticipantThis doesn’t work for any number that goes past the thousands place followed by the end of a story
June 14, 2016 at 1:51 pm in reply to: using indesign menu select all then object pathfinder intersect using script #85753Matt Isaac
ParticipantI am trying to use the subtract option with two objects. My current script code is:
function main(){ var mySelections = app.selection; var bottomObject = mySelections[0]; var cutLine = mySelections[1]; var topObject = bottomObject.duplicate(); var topPath = topObject && cutLine; }
Which works to duplicate the bottom object but now i need to use the subtract pathfinder option for the topObject and cutLine (topPath). I am trying to script a solution for my post in https://creativepro.com/topic/cut-photo-in-half-along-curved-path
I tried using your bit of code in my script changing a few things to
topPath[0].subtractPath(topPath);
but it didn’t work.
maybe you can once again improve upon my idea =).Matt Isaac
ParticipantThere you go, coming in and improving upon my ideas again Ari. (I’m glad you do, i get to learn more and become a better InDesigner.) Thanks; that works a lot better than my solution. The text in this case also remains editable so no need for redoing the whole thing if you want to change fonts or anything.
Matt Isaac
ParticipantStep3 creating the outlines should have taken away the text box when you did it leaving only the text as shapes. It’s weird that it didn’t. But you can use the same method with different shapes. Just skip step 3.
June 9, 2016 at 2:00 pm in reply to: using indesign menu select all then object pathfinder intersect using script #85621Matt Isaac
Participantdoes anyone have a solution to this? I am working on writing my first script and would like to add pathfinder to it.
Matt Isaac
Participant^(\d+)
Will find any number of digits at the beginning of a paragraph followed by a space. The parenthesis around (\d+) specify that as a “found string.” Replace with$1
will insert the first found string.Matt Isaac
ParticipantI was thinking “Set the blending mode to multiply and the text to white.” but that let darker colors of the underlying image show through the solid color. If you don’t have dark colors in the background image this may work for you. What i would suggest would be to cut the text out of the colored rectangle. This will make the text a bit harder to edit but would give you the result you’re looking for.
- Create a colored rectangle. (not a text box.)
- Create a text box with the text styled and positioned as you want it to be over the colored rectangle. (You can change the color of the text to help position the text if you need to.)
- With the text selected click
Type
>>Create Outlines
- For whatever reason I have found that if you do this with multi-line text then creating outlines will group each line together, Thus making the final step not work properly. If you have multiple lines of text to be cut, after you create the outlines, you will want to switch to the direct selection tool and then back to the regular selection tool. (I’m not sure why this happens but it does.) Though if you only have a single line of text you can skip this tool switch.
- with the outlines still selected Shift+click the colored rectangle to select both objects.
- Use the pathfinders option “Subtract”
After following these steps you will have your colored rectanlge with the text cut out and you can then set the opacity of the box to let as much of the background image through as you want.
I hope this helped without causing too much confusion for you.
Matt Isaac
ParticipantI had this problem as well; text would default to Minion Pro whenever I created a new document. I was able to set my default to Arial no hyphenation by adjusting the basic paragraph style with no documents open. I have had no further issues with text defaulting to Minion Pro. However, I don’t know about a “No Style” alternative for paragraph styles.
Matt Isaac
ParticipantUsing the cross reference tool. The text will not automatically update in the second table; though you can click on the “update cross references” button in the cross reference panel and that should update the text for you.
Matt Isaac
ParticipantI don’t know much about scripts but I do know that the double forward slash creates a comment. so anything following double forward slashes will not be read by the script. Remove those and try again.
-
AuthorPosts