Script for selecting consecutive paragraphs -- can anyone help me?

Hi,
I have this script that works fine. It aplies Style Then Next Style to the paragraphs that I have selected with the keyboard in Indesign CS5:
var style_name = "cabecalho"
var doc = app.documents[0];
var first_pstyle = doc.paragraphStyles.item(style_name);
var cur_sel = app.selection[0].paragraphs;
cur_sel[0].appliedParagraphStyle = first_pstyle;
if (cur_sel.length > 1) 
     for (n = 1; n < cur_sel.length; n++)
          cur_sel[n].appliedParagraphStyle = cur_sel[n-1].appliedParagraphStyle.nextStyle;
But before running it I have to use the keyboard to select the 3 paragraphs for the script. I know that it is possible to add some code in the beginning to make the script select the paragraph where the cursor is and the next 2 paragraphs and avoid the manual selection because it is always 3 paragraphs.
I do not know how to do this. Can anyone help me?
Thank you in advance. Greetings from Madrid

This is a bit crude but you get the picture:
var style_name = "cabecalho"
var doc = app.documents[0];
var first_pstyle = doc.paragraphStyles.item(style_name);
var story = app.selection[0].parentStory;
var cur_sel = app.selection[0].paragraphs[0];
cur_sel.appliedParagraphStyle = first_pstyle;
var nextpar = story.paragraphs.nextItem (cur_sel);
nextpar.appliedParagraphStyle = cur_sel.appliedParagraphStyle.nextStyle;
cur_sel = nextpar;
var nextpar = story.paragraphs.nextItem (cur_sel);
nextpar.appliedParagraphStyle = cur_sel.appliedParagraphStyle.nextStyle;
Peter

Similar Messages

  • Why is it every time I try to buy itunes I am diverted to the Chinese store and cannot pay for my items? Can anyone help?

    Why is it every time I try to buy itunes I am diverted to the Chinese store and cannot pay for my items? Can anyone help? I have tries to select the English store but it will not allow me to proceed. I think it has been hacked in the past as there is a list of Chinese Apps which it seems to be awaiting payment for, going back to 2011.

    Free Disk Space & Memory are 2 differen't things.
    At the Apple Icon at top left>About this Mac, click on the text below Mac OS X where it says Version 10.4.x and report the Build# please.
    Then click on More Info>Hardware and report this upto but not including the Serial#...
    Hardware Overview:
      Model Name:    iMac
      Model Identifier:    iMac7,1
      Processor Name:    Intel Core 2 Duo
      Processor Speed:    2.4 GHz
      Number Of Processors:    1
      Total Number Of Cores:    2
      L2 Cache:    4 MB
      Memory:    4 GB
      Bus Speed:    800 MHz
      Boot ROM Version:    IM71.007A.B03
      SMC Version (system):    1.21f4
    Then we cn tell you huw to add more RAM & which is the correct RAM Memory.

  • I am looking for a free downloaod for photoshop cs2.  can anyone help me?

    I am looking for a free downloaod for photoshop cs2.  can anyone help me?  I had downloaded it previously and then I had my computer cleaned up and it was taken off.  Now, when I go to open it, it wants the license number.  Where can I find that as I know that I had downloaded it before.  The one website that has it for free must have a virus in it and my AVG will not allow it to download.  I am lost and need it really fast!  Please help me!
    Karla
    [email protected]

    See this thread, for instance.
    Re: PHOTOSHOP CS6 PLUGIN PROBLEM; I have PS CS6
    If you were a legitimate CS2 licensee, you'll find the link to the CS2 replacement download and new s/n in the above thread, despite its subject title.
    This may explain it to you in a more convincing way:
    Error: Activation Server Unavailable | CS2, Acrobat 7, Audition 3

  • HT4993 I'm trying to place a phone call and when I do the 3G icon goes away and the phone just says connecting but never does. I have almost full service and only have had my new iPhone 5 for two days. Can anyone help because I can't call Sprint at the mo

    I'm trying to place a phone call and when I do the 3G icon goes away and the phone just says connecting but never does. I have almost full service and only have had my new iPhone 5 for two days. Can anyone help because I can't call Sprint at the moment???

    Settings > General > Reset > Reset Network Settings

  • EVERY TIME I MOVE SOMETHING TO THE TRASH IT IS ASKING FOR MY PASSWORD? CAN ANYONE HELP?

    EVERY TIME I MOVE SOMETHING TO THE TRASH IT IS ASKING FOR MY PASSWORD? CAN ANYONE HELP?

    Check this Link out.
    When I updated to Mountain Lion my iMac messed up file permissions and always when I booted or started up my iMac it went to terminal screen because start-up disk was read-only. You might have to change file permissions to what it was so your mac won't always ask your permission to do something (assuming you are admin of your mac).
    PRAM reset might help too. Instructions can be found from the discussion that I linked (there's another link for PRAM [parameter random access memory] reset).
    Good luck!

  • My iPhone is stuck in the recovery mode after downloading iOS7.  i Tunes screen reads "Waiting for iPhone".  It's been waiting for two days.  Can anyone help?

    My iPhone 4 is stuck in the recovery mode after downloading iOS7.   iTunes screen reads "Waiting for iPhone".  It's been waiting for two days.  Can anyone help?

    Hi Imw7996,
    Welcome to the Support Communities!
    The article below may be able to help you with this issue.
    Click on the link to see more details and screenshots. 
    iOS: Unable to update or restore
    http://support.apple.com/kb/ht1808
    Cheers,
    - Judy

  • In iWeb I created a hyperlink to a file on my computer. When I publish I get a 404 error for the link.  Can anyone help?

    In iWeb I created a hyperlink to a file on my computer. When I publish I get a 404 error for the link.  Can anyone help?

    How would I check to see if the like works when I enable via the inspector pane
    If you enable hyperlinks when you click on the link link to the pdf file it will open a browser window and display the pdf file.
    I upload the pdf files to the server and link to them as if they were an external web page:
    That's been more reliable for me than linking to the file as Link To: A file and have iWeb upload the pdf file to the serve.

  • I need some parts for my MuVo V100, can anyone help?

    I need some parts for my MuVo V00, can anyone help I couldn't find any thread this would belong in, but if I've made a mistake, I'm sorry.
    I have a Creative Labs MuVo V00 2 gig player. I love it. The only problem is that the back peice of plastic that holds the battery in somehow has fallen off and has disappeared. I really, really, would like to replace it, but I can't find anywhere where parts like this are sold.
    So, does anyone know where I can buy this part Or does anyone have one they are willing to sell me If I have to get the whole little "docking bay" that holds the batery and the unit, that would be fine too. I'm not going to pay huge money for it, seeing that I can still get a new one at a few places, but if anyone has one that broke, or that they just aren't using, and wouldn't mind making a few bucks + postage, I would really appreciate it.
    Thanks for your time.

    Re: I need some parts for my MuVo V00, can anyone help As far as I'm concerned the subject is closed. I was just irritated that I asked for help, and got some glib little reply, telling me something that anyone who's been on the internet for more than ten seconds should know about. Because to be honest, him replying with those three words, might have made someone overlook the post, thinking, "Someone is handling that, let's move on." Someone who actually might have what I needed.
    But, as it turns out, I could order a reconditioned MuVo from Creative directly for about 6 bucks. (vs. 45+ if I'd gone through ebay) so the problem is resolved. If I could figure out a way to erase this entire post, I would do it. If you can do so, being a mod, I would appreciate it.
    Sorry if I upset you Loi-CL, I understand you're a moderator, but I don't take kindly to being treated like I'm stupid and that's exactly what coachop94 was doing. If he didn't have anything important or useful to tell me, he could have just skipped over my post.

  • I have photoshop 5.5 and can't open .nef files.  I am looking for the old plugin can anyone help?

    I am looking for the photoshop 5.5 plugin to allow me to open my .nef camera files... can anyone help?

    Other than upgrading PS, you might want to look into Nikon Capture. I have an older version, so do not know if it's still offered, and if it will handle your version of NEF's, as they change, hence the ARC upgrades for newer Nikon (and others) cameras.
    Good luck,
    Hunt

  • System disable 97126017 for my HP laptop, can anyone help ?

    I keep receiving an error, system disable 97126017 can anyone help
    This question was solved.
    View Solution.

    Hi,
    Enter:      28884039
    Regards,
    DP-K
    ****Click the White thumb to say thanks****
    ****Please mark Accept As Solution if it solves your problem****
    ****I don't work for HP****
    Microsoft MVP - Windows Experience

  • I am looking for the volume control for skype /iPad ? Can anyone help please?

    I am stumped.
    I can hear people on my iPad skype but they can't hear me.
    They say to turn up the volume on the volume control on the menu bar ?? I can't see any menu bar.
    They say check the Audio Settings ?? Where ?? Ohhhhh I am so sad!
    Can anyone help this old digger ? Please.

    Is the iPad connected to the internet?
    If so, and it's still not working just restore the iPad.
    Note: Take a picture with your iPhone, wait 5 mins then check photo stream on your iPad and see if it appears.

  • I need help getting my laptop to update to yosemite so I can then have the quicktime download in order to watch lectures for college course. Can anyone help?

    I need the download quicktime in order to watch these lecture videos.  It said the new update for my laptop being the yosemite one has the quicktime download within it.  However, I went and downloaded it and now it just keeps saying it is downloading and then about 10 minutes later a thing pops up saying it couldn't be downloaded check internet connection.  So I keep clicking retry but it has happened like 3 times now and it won't successfully download.  Did anyone else have this trouble? Or can anyone else help?

    What is the file extension of the files you need to watch? (.mov, .mp4....)
    What says the update for your laptop has QT within it ?
    Can you provide a link to the page you're downloading from?
    Is your internet connection otherwise OK?
    Is the QuickTime Player app in your /Applications folder? What happens when you launch it?

  • I am trying to set up a friends new iPad but am struggling with settings for her email accounts can anyone help me

    can someone help with the email settings for the email accounts on this iPad.? Or tell me what you would expect the default settings to be. currently we mail is a virgin.net account

    Please see: http://help.virginmedia.com/system/selfservice.controller?CMD=VIEW_ARTICLE&ARTIC LE_ID=2979&CURRENT_CMD=SEARCH&CONFIGURATION=1001&PARTITION_ID=1&USERTYPE=1&LANGU AGE=en&COUNTY=us&VM_CUSTOMER_TYPE=Cable for details.
    Regards,
    Steve

  • We need to optimize FMS for smooth live streaming can anyone help?

    So we are coming across the same problem over and over again. I called Adobe FMS tech support and they assisted us to achieve what we need, but we are having two main issues.
    First, we need to allow live, clear, and smooth video broadcasting with FMS so we implemented dynamic bandwidth detection so the system can automatically detect a users specifications and adjust video accordingly. This has worked better for us but we are coming across two main issues; first, the video is now very pixilated, and second, we are still get a pause or delay in movement from the stream every 4 seconds or so.
    We are looking to get similar video quality as seen on the justin.tv live broadcasting site. I know this video detection and quality is achievable, but not sure what values we need to put in or are missing?
    Any help would be greatly appreciated.
    Thanks,
    Steve

    I'm interested in doing something similar - bridging FMS to a
    an Asterisk conference. I know breeze has this capability, does
    anyone know if this can be done using FMS?

  • When I try to sign into iTunes Connect I receive error message Your ID isn't enabled for iTunes Connect. Can anyone help me?

    When I try to access iTunes Connect I receive the following error: Your Apple ID isn’t enabled for iTunes Connect. Everything I have read says to use your Apple ID, which I have used. But I still cannot sign into iTunes Connect. I have enrolled in the iOS Developer Program and have received email confirmation from Apple Developer Program. I have contacted Apple Support and have not heard back from them yet and of course it is Sunday and they are only open from M-F 9-7cst. Has anyone else had this problem? What can be done to fix this problem?

    I just had this happen to me too. I read that my apple id (the one that I couldn't log into iTC with) needs to have a credit card on file. So I opened iTunes, changed to my problematic account, which was brand new, entered a cc, and then went back over ot iTC.
    I still couldn't log in. But I tried creating the account again, and this time, it worked. So I had to go back to the "front page" of iTC and start over after I entered a cc on iTunes.
    Hope that helps...

Maybe you are looking for