Find an exhibitor only if followed of a 'normal position' tank, but not a space!

Hi all

Everything is in the title of the topic!

I'm doing it with a [JS].

There are missing as elements defining the "normal position" a character!

main();


function main() {

  var myStyle = "Superscript";
  var myDoc = app.activeDocument;

  app.findGrepPreferences = app.changeGrepPreferences = null;  


  app.findGrepPreferences.appliedCharacterStyle = myStyle;   
  app.findGrepPreferences.findWhat = ".+";   
  var allFounds = myDoc.findGrep(true); 


  for ( var i = 0; i < allFounds.length; i++ ) {
  var myFound = allFounds[i];
  var firstCharIndex = myFound.characters[0].index;
  var followingChar = myFound.parentStory.characters[firstCharIndex+1];
  if ( followingChar = "\\H") {
  myFound.contents = myFound.contents + " "; 
  }
  }
}

Of course! It will not work that much! … But it becomes a situation that is usual for me as you know!

Thanks in advance for any help!

Hi Ben,

There are some errors in your code. Like this line:

If (followingChar = '\\H') {}

This is a bug of the current coding. You want to check are equivalent, but you only use an "equal" sign, so you actually assign '\\H' to the variable followingChar.  I don't know what is '\\H' - you are looking for something under the SpecialCharacters enumeration, were perhaps? In addition, I think that you want to check if the next character is not a space. Finally, you want to watch followingChar.contents, not followingChar.

Here's your corrected code. Make a comparison to see all corrections:

main();  

function main() {
  var myStyle = "Superscript";
  var myDoc = app.activeDocument;  

  app.findGrepPreferences = app.changeGrepPreferences = null;
  app.findGrepPreferences.appliedCharacterStyle = myStyle;
  app.findGrepPreferences.findWhat = ".+";   

  var allFounds = myDoc.findGrep(true);   

  var foundCount = allFounds.length;
  for ( var i = 0; i < foundCount; i++ ) {
    var myFound = allFounds[i];
    // check for the last character in the run, not the first
    var lastCharIndex = myFound.characters.lastItem().index;  

    var followingChar = myFound.parentStory.characters[lastCharIndex+1];
    // check if valid in case the last character is at the end
    // of a story or cell.
    if (followingChar.isValid && followingChar.contents != " ") {
      // using followingChar instead of myFound to insert the space
      // will style it using the character style of followingChar,
      // rather than that of myFound, which is "Superscript".
      // This avoids the script repeatedly inserting spaces
      // if it's run more than once.
      followingChar.contents = " " + followingChar.contents;
    }
  }
}

Tags: InDesign

Similar Questions

  • Download files and images to iCloud is frozen - Message Finder: "Download 533581 elements (118,11 GB of 711,95 GB)" but not moving not! Any ideas?

    Download files and images to iCloud is frozen - Message Finder: 'Download 533581 elements (118,11 GB of 711,95 GB)' but it does not move for days now! Any ideas?

    I suspect you might get better results if you uploaded your batch files.

  • My Wacom Graphire4 graphics tablet works only with the pen pressure, OK in CS5 but not CS6...

    I am Windows 7 Professional 64 bit and still have the CS5 and CS6 64 bits loaded.  I've used my tablet with stylus Graphire4 with CS6 will detect all problems.  All of a sudden it only works with the pen pressure even if the stylus pressure is off.  I'm trying to use it as a mouse and frequently use shift/click when you change a mask.  I can do it no longer.  If I run CS5 the pen works as it should but not CS6.  When I first open the CS6 with visible brush the brush palette shows a hard brush, but when I open a file it turns into sensitive pressure without measure by me.  I have reset the brushes, re-installed the driver and finally downloaded a driver more but the problem persists.  Because it works very well in CS5 but not CS6 it must be a problem to Adobe.  It's very frustrating.  I enclose a composite image showing what happens to the CS6.  The right side shows what looks like the brush palette until I open a file.  The left side shows what happens when I open a file.   Even if I do not open a file and make changes within the brush palette, it immediately turns to pen pressure.  It's very strange.

    I would of course someone can provide information that could help.

    Kind regards... Ralph

    brush_palette.jpg

    No answers, but in the meantime, I have come into contact with Adobe.  Problem has been resolved by phone.  Resolution is to delete the preferences file reopen CS6, date at which the PS automatically creates a new preferences file.  It was she, corrected a problem... Ralph

  • my email has been blocked Ive followed all the steps and instructions but not received a password to unlock it please help

    My mother has been missing for a week only to return home to find that her hotmail was blocked temporarily. We followed the instructions and a PIN was given so that she can look on the forum if they could not provide the answers she had given to its questions.
    We then gave my email address then a password could be sent, so that she could access, it says that it could take up to 24 hours.

    2 days have passed and no email please don't help because she desperately needs his emails especially its news of work because it is a foster carer.
    We tried to look at the thing of the forum, but can't seem to access anything whatsoever!

    Help

    Hello

    Answers is a peer group supported and unfortunately has no real influence on Hotmail.

    HotMail has its own Forums, so you can ask your questions there.

    Windows Live Solution Center - HotMail - HotMail Forums Solutions
    http://windowslivehelp.com/

    Hotmail - Forums
    http://windowslivehelp.com/forums.aspx?ProductID=1

    Hotmail - Solutions
    http://windowslivehelp.com/solutions.aspx?ProductID=1

    How to contact Windows Live Hotmail Support
    http://email.about.com/od/hotmailtips/Qt/et_hotmail_supp.htm

    Windows Live Hotmail Top issues and Support information
    http://support.Microsoft.com/kb/316659/en-us

    Compromised account - access unauthorized account - how to recover your account
    http://windowslivehelp.com/solution.aspx?SolutionID=6ea0c7b3-1473-4176-b03f-145b951dcb41

    Hotmail hacked? Take these steps
    http://blogs.msdn.com/b/securitytipstalk/archive/2010/07/07/Hotmail-hacked-take-these-steps.aspx

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle="" -="" mark="" twain="" said="" it="">

  • sentence has installed automatic updates and it says I can not enter password, if I says can not find the file I can log in with password safe mode but not normal mode

    I can connect in safe mode, I tried to set up another admin user, but he says the same thing that I can't connect in normal mode

    Try the following steps:

    a. create a new user account without password in safe mode.

    http://Windows.Microsoft.com/en-us/Windows7/create-a-user-account

    b. start in normal mode.

    c. create another user account with the user created in safe mode a/c and set a password.

    d. try to connect to the user account password.

    Still the error?

  • Find the exhibitor and small caps

    Hello

    How to find the exhibitor and small caps in indesign via javascript.

    Kind regards

    Assia

    Hi assia,.

    Try this to find Exhibitor,

    var doc = app.activeDocument;
    app.findTextPreferences = null;
    app.findTextPreferences.position = Position.SUPERSCRIPT;
    var found = doc.findText();
    app.findTextPreferences = null;
    for(var i =0;i
    

    for small capitals

    var doc = app.activeDocument;
    app.findTextPreferences = null;
    app.findTextPreferences.capitalization = Capitalization.SMALL_CAPS;
    var found = doc.findText();
    app.findTextPreferences = null;
    for(var i =0;i
    

    Kind regards

    Cognet

  • My Apple TV is only to play a sound on my iPad but will not show the film?

    My Apple TV is only to play a sound on my iPad but will not show the film?

    Welcome to the Jennifer Apple community.

    Some content providers don't block the video portion working with AirPlay, have you checked to see if AirPlay is supported by this provider.

    If it is supported

    these steps, check to see if things work after each step if necessary, before you try the next.

    1. Check AirPlay is on the Apple TV (turn market if it already is)
    2. Check that both devices are on the same network (settings > Wifi on the mobile device and the settings > General > network, on the Apple TV).
    3. Restart the Apple TV (settings > general > restart).
    4. Restart the Apple TV by removing ALL cables for 30 seconds.
    5. Restart your router. (Also try to remove the power cord for at least 30 seconds)
    6. Restart your mobile device.

    If you're still having problems, the following article can help you.

    Troubleshooting AirPlay

    Troubleshooting connections and Wi - Fi networks

    Recommended Wi - Fi settings

    WiFi Diagnostic Software (for Mac users)

    You will also find help on this page, where I have collected some of the more unusual solutions for network problems.

    When you make adjustments to your network for better optimization, you can find some of the points mentioned onthis page useful.

  • MY DVD - RW DVR-112D ATA DEVICE IS ONLY PLAYBACK DVD VIDEO (EX MOVIES). BUT NOT READ ANY OTHER TYPE (E.G. SOFTWARE).

    MY DVD - RW DVR-112D ATA DEVICE IS ONLY PLAYBACK DVD VIDEO (EX MOVIES). BUT NOT READ ANY OTHER TYPE (E.G. SOFTWARE). Everytime I put a dvd movie it plays automatically, but any other type of cd it will say insert disk. One has had this problem?

    Hello

    You have disk problem as the CD/DVD is actually 4 discs in 1 case (burn CD & DVD and CD and DVD read).
    Therefore, it is not unusual for 1 or 2 rooms with not so work that others do it properly.

    Several good info here:
    http://Club.myce.com/

    Notes on the troubleshooting and repair of readers of compact disks and CD-ROM Drives
    http://www.repairfaq.org/repair/F_cdfaq7.html#CDFAQ_014

    ----------------------------------------------------------------------

    Step 1: Please make all underneath the same if you've done it before as it's often the total of the process which
    solves the problem.

    Try this - Panel - Device Manager - CD/DVD - double-click on the device - driver tab - click
    Update the drivers (this will probably do nothing) - then RIGHT click the drive - UNINSTALL - REBOOT
    This will refresh the default driver stack. Even if the reader does not appear to continue below.

    Then, work your way through these - don't forget the drive might be bad, could be a loose cable or
    slight corrosion on the contacts (usually for a laptop) and other issues.

    Your CD or DVD drive is missing or is not recognized by Windows or other programs
    http://support.microsoft.com/kb/314060 - a Mr Fixit

    The CD drive or the DVD drive does not work as expected on a computer that you upgraded to Windows Vista
    http://support.Microsoft.com/kb/929461

    When you insert a CD or a DVD, Windows Vista may not recognize the disc
    http://support.Microsoft.com/kb/939052

    Your CD or DVD drive cannot read or write media - A Mr Fixit
    http://support.Microsoft.com/GP/cd_dvd_drive_problems

    CD/DVD drive does not appear in Windows Vista, or you receive this error during the installation of Windows Vista after booting from the DVD (AHCI)
    http://support.Microsoft.com/kb/952951
    Drive CD - R or CD - RW Drive is not recognized as a recordable device
    http://support.Microsoft.com/kb/316529/

    Hardware devices not detected or not working - A Mr Fixit
    http://support.Microsoft.com/GP/hardware_device_problems

    Another possibility is that the cables are loose. Remove ALL power, then make sure that the cables in both
    ends. Remove and replace, do not just tight. For laptops, you can often clean power and
    contacts data with a pencil eraser.

    Some DVD players do not use the Windows default drivers so check with the manufacturer of system and
    manufacturer of device to see if there is a firmware or drivers for your drive if necessary.

    ===============================

    Step 2: You have disc problems as the CD/DVD is actually 4 discs in 1 case (CD & DVD burning and)
    Playback of CD and DVD). Therefore, it is not unusual for 1 or 2 rooms with not so work that others do it properly.

    Did you follow the Troubleshooting Guide for the reader who still does not work? There are some registry entries
    that the troubleshooter does not, and those who "could" be the cause.

    Check with your system manufacturer Maker and device for possible firmware updates and the good
    Your player registry entries.

    Here are the keys in my opinion, are those in question - for the reader of CD/DVD subkeys of course that he will be
    other subkeys in these keys. Be sure to ask specific keys involved as well as the parameters.

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\IDE

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Hardware Profiles\0001\System\CurrentControlSet\Enum\IDE

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\ {4D36E965-E325-11CE-BFC1-08002BE10318}

    -----------------------------------------------------------------------

    You can probably find more info here and maybe even registry settings correct for your CD/DVD drive
    a person with the same model.

    Forums - a lot of expert real help
    http://Club.myce.com/

    CD/DVD units
    http://www.myce.com/storage/

    I hope this helps.
    Rob - bicycle - Mark Twain said it is good.

  • How to find and replace data in fields of form in acrobat xi, its not allowing to do while trying, one

    How to find and replace data in fields of form in acrobat xi, its not allowing to do while trying, request adobe livecycle to settle. Help, please.

    Best way to do is the following:

    -Open the PDF in Acrobat.

    -Go to tools - form - form more Options - export data.

    -Save form data in an XML file somewhere on your system.

    -Open the XML file in a plain text editor (I recommend Notepad ++).

    -Let's say you want to replace all the years in dates "2013" to '2014 '. Do a global search & replace '2013-' to '2014' - (I added the dashboard in order to ensure that only the date fields are changed).

    -Save the XML file (maybe under a new name).

    -Go back to the PDF file and now go to tools - forms - more form Options - import data.

    -Select the modified XML file and import it.

    -Fact!

  • During the closure after a browsing session I find several windows behind the window of the main browser I have not opened and they must be closed individually. What is the cause and how can I stop it?

    During the closure after a browsing session I find several windows behind the window of the main browser I have not opened and they must be closed individually. What is the cause and how can I stop it? Edit

    These windows display ads? They could be 'pop-under' designed to show when you are finished with your main window. Orbitz has these, for example. Irritating. I'm not sure of the best solution, i.e., advertising blocker blocker vs.

    If they are not ads, can you think anyway that they are related to the sites you visit?

    In addition, to close a tab (or window, if there is only one tab), you can press Ctrl + w. could speed up the process of their release until you find a real solution.

  • Cannot find Windows Platform Update in Windows Update, used to be here, but cannot be installed

    I'm having a problem with the download of the update of the Windows platform. About two months ago the update appeared in Windows Update and I started the installation. However, my computer froze before the update was finished and had to be forced to close. I tried to install the update several times thereafter, but he kept stopping at 1%. I though I'd have another go at him today, but the update happened to Win. Update. It is not in the hidden no more updates.

    I use Vista 32 and have installed SP2.

    Does anyone have a solution? And please, I'm without a computer whizz and not a mother tongue English, so as short as possible will be much appreciated.

    You SHOULD have installed the free trial Norton, (b) download / run the Norton removal and then c installed Norton Internet Security BEFORE the free trial period had expired, not after. [And no, Norton Support won't tell you this!]

    This being said, cross your fingers and try the following:

    [You may want to print these instructions for reference offline. If a step said to reboot, reboot.]

    1. download the Norton Removal Tool, save it to your desktop: ftp://ftp.symantec.com/public/english_us_canada/removal_tools/Norton_Removal_Tool.exe

    2. close all open applications (that is, anything with an icon on the taskbar).

    3. After completing some you have a copy of your handy product key, uninstall all Norton software (including LiveUpdate and everything Norton Add ons) via Control Panel | Programs | Uninstall a program (or Control Panel |) Programs and features, if you are using the classic view).

    4 IMPORTANT! -Online activate Windows Firewall immediately after the restart.

    NB: Now you're "working without a net": no to ANYTHING else online (e.g., navigation, reading e-mail, chat) until you have completed step #7 below!

    5. right click on the file that you saved in step #1 above, and then select run as administrator.  DO TAP not your keyboard until the race ends, then restart.

    6. do a clean install of Norton Internet Security 2011 (using your product ID, if need be) & reboot. CF. http://www.symantec.com/norton/support/kb/web_view.jsp?wv_type=public_web&docurl=20080514162318EN

    NOTE: Do NOT activate or install additional modules of Norton (for example, Norton Anti-Phishing) immediately.

    7. manually and repeatedly run LiveUpdate (Norton) until you get a prompt "no update more".

    8. open Internet Explorer (only) to http://support.microsoft.com/kb/923737 & run the difficulty.

    9. open Internet Explorer (only) to http://support.microsoft.com/kb/971058 & run that set it by DEFAULT and modes and AGGRESSIVE. [1]

    10. restart a last time & test.

    NOTE: The platform update (KB971644) is ONLY available through Windows Update.

    ~~~~~~~~~~~~~~~~~~~~~~~~
    [1] full Disclosure: the difficulty operating in AGGRESSIVE mode will remove your update history but not the list of installed updates.

    ~ Robear Dyer (PA Bear) ~ MS MVP (that is to say, mail, security, Windows & Update Services) since 2002 ~ WARNING: MS MVPs represent or work for Microsoft

  • I want to download ancient Photoshop 4.0 or following, but not not as modern as the CS. Is this possible?

    I want to download ancient Photoshop 4.0 or following, but not as modern as the CS. Is this possible?

    They were on the CD as the tests, save/print functions have been disabled. There wasn't any 'unlock code '. The commercial version was the only fully functional version.

    So, no. There is no 4 versions available on Adobe servers CS.

  • After the installation of Sierra, websites follow me like crazy!  This has not happened before.  Why this is happening and what can I do to stop it?

    After the installation of Sierra, Web sites started to follow me like crazy!  This has not happened before.  Why this is happening and what can I do to stop it?

    What are your privacy settings in Safari preferences.

  • Apple Watch: can I receive all messages from whatsapp on my Apple Watch, but not the Group whatsapp messages, don't know why... Help, please. Besides, my watch is custom in Spanish, but only answer messages Whatsapp understands English... someone kn

    I can receive all messages from whatsapp on my Apple Watch, but not the Group whatsapp messages, don't know why... Help, please.

    Besides, my watch is custom in Spanish, but only answer messages Whatsapp understands English... anyone know why? Thanks to you all!

    Hello

    To change the language for a response on your watch: Press answer > firmly press the screen > press on choose language > select Spanish.

  • Incoming messages appear only after I have send an email and will not appear if I "Get Mail".

    My mother has problems with his electronic mail account. She has a very slow dial-up access. She receives only the incoming emails when she sends outgoing e-mail. I live in a different country to her and she's 80 years old so I hope it's a simple solution. Thank you very much. Anne Broomer

    First get mail valid only for the current account. use the small down arrow to display the menu and select "get new messages" implied, but not stated that it is for all accounts.

    If she has a very slow connection, maybe it's Thunderbird going offline lower left corner of the screen are two images of the blue screen. Clicking activates / deactivates the status offline online.

    If sending a message receives mail it is maybe offline and send triggered an online state. (But who should have a dialog going online, but a lot gets lost in translation, in particular people with disabilities on the technical side, which I suppose that your MOM is. Mine was)

Maybe you are looking for

  • Mobile use goes fast iOS 10

    It's all good in iOS 10 in my iPhone 6 s more. Yet, mobile usage drives really quickly without help strongly. I always use wifi and disable the function of the mobile use of apps, iCloud backup, etc. that can use a large amount of mobile data. Most o

  • Tecra M5: Wireless connection is no longer working

    I have a new Toshiba Tecra M5. I originally put in place to connect to my WAP Home/office with no problems. After using it in a place where no WAP was available and making the home, wireless connection"is not available" and I can't do so. Additional

  • Re: AC adapter used by portable computers diverge

    HelloI have an A660-12 q and L670D-146.Laptops have diverge Adpater AC/DC (PA3714U-1ACA = L670D / PA3716E-1AC3). Technical data and plug are almost the same. Can it have problem to swap cards in the other? Best regards for your answers

  • CQ60 Notebook: my computer hp cq60 laptop does not connect to internet at home

    Is no longer, my laptop HPCQ-60 will connect to the internet at home.  I can connect everywhere else, I'm going without any problems.   Using the ethernet cable to connect, but it doesn't work now, too.  Have seen previous assignments showing the sam

  • Microsoft Silverlight not updating and uninstalling

    I noticed that Microsoft Silverlight updates have not been installed for some time now and remain in the updates area important. So I tried the update and came with the file don't are not recognized or changed.  I thought then that I remove the progr