CreativePro Forum
Join our community of graphic designers, publishers, and production artists from around the world. Our members-only forum is a great place to discuss challenges and find solutions!
- You must be logged in to reply to this topic.Login
Split text into separate non-threaded frames?
- This topic has 10 replies, 5 voices, and was last updated 5 years, 4 months ago by
Petr Lozan.
-
AuthorPosts
-
-
March 23, 2010 at 4:11 pm #55250
Rickard ÌÎÌ?rtegren
MemberOk, common scenario:
I'm workin on a magazine spread. I've imported/cut&pasted a text document containing a headline, a lead, the authors name and then some bodytext. It all goes into one frame. Now, I know I want to place the four items in separate frames as I want to move them around and rezise them separatly.
Wouldn't it be nice to just select a piece of text and press a shortcut and it gets extracted in to a separate non-threaded frame?
Wouldn't it be even nicer to select the header, press a shortcut and have it temporarily marked with a colour, select the lead and press the same shortcut and have it marked with another colour, select the authors name and press the same shortcut and have it marked with a third colour, press another shortcut and BAM it divides into four separate non-threaded frames (the body text remaning in the original frame)?
Yes it would!
This would also be extreemly useful if composing a graphic design where you want to play around with a lot of separate words originating from one imported text and be able to move them around freely, change size etc.
I've searched around for plugins and scripts but haven't found anything. The work around is to select text, press cmd+x, hit Esc (Mac only, Win-users have to select the black selection tool) and press cmd+v.
I'm also posting this in the scripts forum.
-
March 24, 2010 at 5:07 am #55255
Theunis De Jong
MemberThat sounds as if you started out real old style, cutting paper strips and pasting them with wax. I did that as well for some time. Does this script work for you? It's rigged to only cut on paragraph breaks, and only if the frame is not threaded to a previous one. It cuts right above the current paragraph; all you have to do is position your cursor somewhere after the paragraph you want to split off and run the script. For four separate frames, you have to “cut” three times — but then again, you can always assign a shortcut key to the script.
//DESCRIPTION:CopyCutter — Cut your Copy at the Cursor
// Jongware, 24-Mar-2010if (app.selection.length == 1 && app.selection[0] instanceof InsertionPoint)
{
if (app.selection[0].parentTextFrames[0].previousTextFrame == null &&
app.selection[0].paragraphs.previousItem(app.selection[0].paragraphs[0]) != null)
{
oldframe = app.selection[0].parentTextFrames[0];
topline = app.selection[0].paragraphs[0].baseline;
newframe = oldframe.duplicate();
newframe.characters.itemByRange(app.selection[0].paragraphs[0].index – app.selection[0].parent.paragraphs[0].index-1, newframe.characters.lastItem().index).remove();
oldframe.paragraphs.itemByRange(oldframe.paragraphs[0], app.selection[0].paragraphs.previousItem(app.selection[0].paragraphs[0])).remove();
newframe.fit (FitOptions.FRAME_TO_CONTENT);
vdiff = topline – oldframe.characters[0].baseline;
newheight = oldframe.geometricBounds[2] – oldframe.geometricBounds[0] – vdiff;
oldframe.geometricBounds = [oldframe.geometricBounds[2] – newheight, oldframe.geometricBounds[1], oldframe.geometricBounds[2], oldframe.geometricBounds[3]];
}
} -
March 24, 2010 at 5:20 am #55257
Rickard ÌÎÌ?rtegren
MemberAllright, Ill give that a try, thanks!
Just to make clear, I'm not talking about using this for straight-forward Article-design where I'd rather use masterpages and set up a “Next style”-sequense.
This is for onetime designs. Maybe a gig-poster is a better example. You get all the information from the band: date, time, venue, ticketprice, directions, website etc. etc. in an e-mail and paste it into a frame. That's where this would be really handy.
How would you go about it then, this script or do you use some different teqchnic?
-
March 24, 2010 at 5:55 am #55261
Rickard ÌÎÌ?rtegren
MemberHmm, couldn't get it to work (not to experienced in scripting)
Pasted it into Extendscript toolkit and saved as .jsx,
When I run it i get an Error Number: 8, syntax error on line 10. Offending Text: – app.
Any thoughts?
Thanks a lot
-
March 24, 2010 at 6:12 am #55262
Theunis De Jong
MemberA previous version of this forum translated straight quotes into curly ones, which is fine & dandy for plain text, making it more typographically sound, but it wreaked havoc with scripts.
Now there is a new 'beautifying' daemon at work which I haven't met before: space dash space is automatically translated into en-dashes. Also much nicer on the eye, but .. also killing the option to post a script in-line and have it copied and pasted straight into the ESTK.
** (David, can you ask Pariah to add a “Pre” formatting button in the toolbar? Pretty please?) **
So the good news is, you did everything correct, copying, saving, and testing. Open the script in the ESTK and edit the file, changing dashes into regular hyphens; save it and it should work. There should be five instances of space dash space to change; if ln. 10 is the first one, the others are on ln. 13, 14 (twice), and 15.
-
March 24, 2010 at 7:38 am #55265
Rickard ÌÎÌ?rtegren
MemberSweet, thanks a lot Jongware. I applied alt+C as shortcut and will be using it from now on. Thanks again
-
March 24, 2010 at 1:02 pm #55271
albastru22
ParticipantUauuu… Thank you Jongware – I was too shy to ask for this script – it saves me a lot of work.
Just 2 small things… I dont want this line “newframe.fit (FitOptions.FRAME_TO_CONTENT);” so I put // in front. But now… The height of the new frame is the height of the old frame… So after a little digging :D I put this at the end: “newframe.geometricBounds = [newframe.geometricBounds[0], newframe.geometricBounds[1], newframe.geometricBounds[2]- newheight, newframe.geometricBounds[3]];”
Everything works perfectly for me.
I think it would have been a better idea to cut off a selection instead of the paragraph above but it works great with this approach.
So I have a question, hoping I wont be OT: I need to change the number of columns of the newframe (to 1). I guess it should be pretty easy if someone posts this info, but I want to know how should I find it myself… In VBA I put “newframe.” and after the “.” it gives me everything on newframe (intelisense). I choose one from the list and press F1 and I get the help for that choise I made – and see even an example. I tried opening the object model viewer in ESTK, searched for frame… it didn't give me anything (too many results). What am I doing wrong? Or adobe wants only smart intelligent people to script … :D :D :))
-
March 24, 2010 at 1:53 pm #55272
Theunis De Jong
MemberOr adobe wants only smart intelligent people to script …
They might — or they might want to scare off everyone (see their implementation of what should have been a simple programmer's editor…). I disliked their complicated Help system so much I rewrote it in friendly HTML, and since it allows backtracking from one object to another, I found this with relative ease:
newframe is a TextFrame, so entered that in Search. Nothing useful there on columns, but I noticed TextFramePreferences (Adobe's preferred way of adding yet even more properties to objects). Clicked that, found this: textColumnCount. TextFramePreferences is used as a property value for a few things, and one of them is TextFrame.textFramePreferences. Adding all together, I think you can safely say:
newframe.textFramePreferences.textColumnCount = 1;
at any place you find convenient.
By the way, yes! I was lazy, putting in that Fit Frame quick hack, and your solution is way better! It now works the way I envisioned it, 'cutting' right through the frame and leaving everything else intact.
-
March 26, 2010 at 2:42 am #55321
albastru22
ParticipantHurraaay ! I am impressed with this… It saves me a lot of formating. I usually bring one article in a text frame, format it, apply style to title and body text and then I want to put the body text in 2 or 3 columns – of course the title outside the box. So I made 2 scripts with obvious shortcuts: alt+2 and alt+3: I changed my mind, i want the old frame in columns: 2 or 3 accordingly.
I expected problems if I have inset to the original box or a tint. There were no problems…
I tried it with threaded text frames, running the script for the first in the chain (I wouldn't use it for the second) – there were no problems. I only have to be careful to not have overflow in the box – it should be my next step in fixing…
In my earlier post I was talking of VBA as Visual Basic for Applications – the one that ships with word or coreldraw. Both these applications have the ability to record actions and offer tremendous amount of help to total beginners in scripting. My only hope is adobe will improve a lot the help with scripting in CS5.
-
January 29, 2020 at 12:40 pm #14323175
Petr Lozan
MemberWow, that CoppyCutter script is really great!
Can someone guide me on how to sneak into the script an option to split the frame on each occurrence of the specified paragraph style?
Like you have a text frame full of paragraphs where the paragraph style named “Title” is applied six times, so the script split the frame six times: above each paragraph with the “Title” paragraph style applied.
-
January 29, 2020 at 12:43 pm #14323174
David Blatner
Keymaster
-
-
AuthorPosts
- You must be logged in to reply to this topic.
