IDCS6 MACOSX JS: "remove unused layer" script doesn't see masters based on masters

Hello everybody.
I have an old script that I have used many times to remove unused layers. Until today I thought it worked well:
var layers = app.documents[0].layers.everyItem().getElements();
for(var i=layers.length-1;i>=0;i--){
  if(layers[i].pageItems.length==0){
    layers[i].remove();
However, today I used the script on a document that had a layer that was only ever used once on a master page that the other master pages were based upon. To my surprise, when the script was run, this specific layer was deleted.
my scripting knowledge is poor, but looking at the script it looks like the script is looking at all layers that have anything in them, and any layer that has no item is to be deleted. however, I think that pageItems only refers to regular pages or master pages, not masters BASED ON other masters.
I think the problem is similar to another that I had recently where I had a script that removed unused masters, but removed masters that other masters were based on, and I think the principles are the same. That thread can be found at:
http://forums.adobe.com/message/5922004#5922004
in short, the script that worked there was as follows:
xUnusedMasters(myDoc);
function xUnusedMasters( docRef ) {
var mpNames = new Object () ;
var allPages = docRef.pages ;
for ( var pIndex = allPages.length - 1 ; pIndex >= 0 ; pIndex-- ) {
mpNames = addMasterName ( mpNames , allPages[pIndex] ) ;
var allMasterPages = docRef.masterSpreads ;
for ( var mpIndex = allMasterPages.length - 1 ; mpIndex >= 0 ; mpIndex-- ) {
if ( ! mpNames[allMasterPages[mpIndex].name] ) {
allMasterPages[mpIndex].remove() ;
return ;
function addMasterName ( MPDB , pageRef ) {
if ( pageRef == null ) { return MPDB ; }
if ( pageRef.constructor.name == 'MasterSpread' ) {
MPDB[pageRef.name] = true ;
return addMasterName ( MPDB , pageRef.appliedMaster ) ;
is it possible to modify the above script so that instead of removing unused master pages, it removes unused layers in a similar fashion?
Many thanks,
Colly

Hi,
Maybe a little bit different way...:
Array.prototype.filter = function(collection) {
          var k, i, con, ids = collection.everyItem().id;
          con: for (k = ids.length - 1; k >=0; k--)
                    for (i = 0; i < this.length; i++)
                    if (this[i].id == ids[k]) {
                         ids.splice(k, 1);
                         continue con;
          return ids;     // array with unmatched ids from collection
var
          mL = app.activeDocument.pageItems.everyItem().itemLayer,
          mUnusedLayersID = mL.filter(app.activeDocument.layers),
          len = mUnusedLayersID.length;
while (len-->0)
          app.activeDocument.layers.itemByID(mUnusedLayersID[len]).remove();
mL is an array with each pageItem's layer;
filter compares it to doc.layers collections;
unmatched means unused so are removed.
Jarek

Similar Messages

  • [svn:fx-trunk] 15795: Initial check-in for removing unused rsls and the include-inheritance-dependencies-only features .

    Revision: 15795
    Revision: 15795
    Author:   [email protected]
    Date:     2010-04-28 14:01:58 -0700 (Wed, 28 Apr 2010)
    Log Message:
    Initial check-in for removing unused rsls and the include-inheritance-dependencies-only features.
    Changes to implement ?\226?\128?\147remove-unused-rsls feature. When the configuration option is true, RSLs associated with RSLs that are not used by the application are not loaded at runtime. The compiler logs the primary RSLs that are required with the number of failovers, if any.
    compiler/src/java/flex2/compiler/common/Configuration.java
                add ?\226?\128?\147remove-unused-rsls and ?\226?\128?\147include-inheritance-dependencies-only.
    compiler/src/java/flex2/compiler/CompilerSwcContext.java
                pass rslGroup to getSwcGroup.
    compiler/src/java/flex2/compiler/swc/SwcCache.java
                Add parameter to getSwcGroup to a group of rsls can be passed in.
    compiler/src/java/flex2/compiler/swc/SwcGroup.java
                Add a SwcGroup constructor that accepts a SwcGroup of Rsls. Use the RSLs to give preference to scripts that come from RSLs when duplicate scripts are merged.
    compiler/src/java/flex2/tools/CompcPreLink.java
    compiler/src/java/flex2/tools/PreLink.java
                Find the set of SWCs that are contributing code to the application. Use this set to restrict which RSLs are written to the generated root class. Log the RSLs that are required to give the user some feedback.
    compiler/src/java/flex2/tools_en.properties

    Ah, ok. I was in the assumption the PCI connect had something to do with the video connection. But it seems like Apple wanted to reinvented PCIe...
    I'm out of my territory here so feel free to ignore the following.
    These are the things I notice in your Xorg.0.log:
    [    19.474] (==) modesetting(G0): Depth 24, (==) framebuffer bpp 32
    [    19.474] (==) modesetting(G0): RGB weight 888
    [    19.474] (==) modesetting(G0): Default visual is TrueColor
    [    19.474] (II) modesetting(G0): ShadowFB: preferred YES, enabled YES
    [    19.500] (II) modesetting(G0): Output VGA-1-0 has no monitor section
    [    19.526] (II) modesetting(G0): EDID for output VGA-1-0
    [    19.526] (II) modesetting(G0): Using default gamma of (1.0, 1.0, 1.0) unless otherwise stated.
    [    19.526] (==) modesetting(G0): DPI set to (96, 96)
    What the hell is modesetting doing there?
    And have you tried the nvidia blob? It could be that this is not well supported by nouveau. Maybe check up with their IRC / mailing list.

  • Be abble to automatically remove unused resultLists, after onTheFly reporting, onTheFly DB writing ...

    Hello,
    If you get memory problems, you had to tune your reports options, result collecting, load / unload modules  .... 
    These tasks are very long, you have to point all memory consumers first ... It pollutes your test sequence only for memory purposes ! 
    When you try to modify the result reccording, you will also have problems for your report generation ... 
    It should be nice to add a new feature allowing an automatic result list removing, after onTheFly reporting, ontheFly database writing have treted them ...
    A kind of "OnTheFly and remove unused results"
    When ontheFly reporting, and The OnTheFly database writing are over, the treated resultList should be put in a garbage structure !
    Older test results could be removed if memory is needed ... 
    I know this could be not simple ... but this could help very much, for big sequences creation. 
    Thanks a lot.
    Manu.net (TestStand memory dustman !)
     

    Guys, I think I've found the strange thing.
    First, in the recovery shell, when I type "lvm lvscan", it prints:
    WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
    and then it says that all four my logical volumes root,boot,home and var are inactive.
    So I tried to set them up manually, with "lvm vgchange -a y", and guess what happened: I was able to boot!
    I still haven't managed to understand the real causes of this problem, but basically it seems that I have the same problem explained here: https://bbs.archlinux.org/viewtopic.php?id=184340.
    The only difference is that there the OP says to have solved the problem with an upgrade to Linux 3.15.7, while it appeared to me with the upgrade to 3.18.3, and as I said it doesn't go away neither with a downgrade nor with another upgrade to version 3.18.4
    Last edited by rdm (2015-01-29 21:55:44)

  • How to remove unused objects from the webcatalog In OBIEE11g

    Hi,
    I want to delete unused objects from obiee11g catalog, i know in obiee10g it's working fine (i.e: we can do it via manage catalog then delete the unused objects) is there any way to do it automatically like RPD utility --->removing unused objects from Physical layer in RPD
    fyi: I don't want to delete manualy. i need somethink like button/link to find unused objects(report,filter,folder..etc) from my obiee11g catalog.
    Thanks
    Deva
    Edited by: Devarasu on Nov 29, 2011 12:06 PM
    Edited by: Devarasu on Nov 29, 2011 3:15 PM

    Hi,
    Checked with Oracle Support team and confirmed below points
    --> incorporated into the Current product and consider as BUG it may resolve future release
    --> Currently there isnt any automatic method to remove the unused objects like reports, filters,folder etc from catalog.
    Treated as Bug
    Bug 13440888 - AUTOMATICALLY REMOVE OF UNUSED CATALOG OBJECTS FROM WEBCATALOG
    FYI:
    SR 3-4984291131: How to remove unused objects from the webcatalog in obiee11g
    Thanks
    Deva

  • Removing unused items / optimizing file size

    I have a large swf that is embedded in Director as a sprite.  I now want to put it onto a web page, so file size is critical.  Is there a way to remove unused library items when publishing so that file size is reduced?  Is there another way to compress the swf so it is much smaller?  The current size is about 25 Mb.  What about streaming the swf?  I'm not talking about streaming video or audio, just any Flash content.  Any tricks for speeding the process up so that the user doesn't have a long wait before the swf starts?
    In Director, there is a way to right-click on a cast member and choose "find in score".  If something isn't found it means that it either is not used in the movie or is implemented through code.  Is there a similar way in Flash of detecting unused items or automatically eliminating them when publishing?
    Thanks,
    Brian

    all used assets would have to be downloaded eventually but it's a much nicer user experience to promptly see something useful on-stage, sooner rather than later.  background sound, for example, need not be downloaded when a page first loads and should download after items more useful to the user have already downloaded.
    under file/publish settings/flash/tick generate size report you can see what's bloating your swf.

  • Remove Unused swatchs, brushes,symbols

    Hi all,
    I want to be remove unused swatches, brushes, and symbols in my Illustrator document by using of javascript. Any one give a scripting for the above solution.
    Is there any properties are changed in CS3 to compare with the Illustrator CS2 javascript.
    Any Ideas for my Question. Kindly reply to me.
    Thanks,
    Nagaraj
    [email protected]

    You may have better luck on the scripting forum.

  • Removing unused media files?

    I tend to move slides between presentations often, and as a result I have multiple copies of media files (movies, photos, etc.) all in the presentation package. Often, if a slide is deleted, the media contained on that slide is still present in the package. Does anyone know of an easy way to remove unused media files? I'm doing this to help keep the file size down, as it's getting seriously unwieldy. Thanks

    Not that I know of...I miss one option that some graphic programs have... collect on output. It will collect all linked files and place them in the same folder of you finial file. I wish a lot of programs had this function. Would save time hunting down associated files that you can't remember where you put them...
    I know this doesn't help you...sorry.

  • How to remove a java script pop up

    Hi,
    I imported a robohelp document from another company and i am
    catering it to my company's needs. The problem is they have popups
    which refer to .bmp and it is in java script. If i highlight the
    word which has the pop up and remove the popup and then highlight
    the normal word again and refer it to my topic in the project
    manger; it still refers to their image and not mine. It is strange
    but true. I don't know how to remove the java script cos each time
    i hover over the highlighted text there are 2 red squares on the
    left and right hand side of the word highlighted which i want to
    change from their image to mine.
    Any help would be much appreciated .
    Thanks,
    Ramya

    please take a look at this
    //--></script></robohelp>
    on the <b style="font-weight: normal;">Environmental
    Consequence</b> window
    captures and displays information that you reported to a
    governmental
    agency, police, rescue center, or internal company sources.
    </p>
    <div class=droptext id=POPUP286607275 x-ss-type=dropdown
    style="display: none;">
    <p class=Graphic style="margin-left: 0in;"><img
    src="agency_notification_tab.bmp"
    x-maintain-ratio=TRUE class=img_whs2 style="width: 1108px;
    height: 120px; border-style: none; border-style: none;"
    width=1108 height=120 border=0></p>
    </div>
    <p class=Body>The following is a description of some of
    the fields that
    display on the <b style="font-weight:
    normal;">Agency Notification</b> tab:</p>
    <ul class=whs3 style="list-style: disc;" type=disc>
    <li class=p-BulletedList1><p
    class=BulletedList1><b style="font-weight: bold;">Reported
    By</b> - Person who reported the incident to an agency
    or organization.</p></li>
    <li class=p-BulletedList1><p
    class=BulletedList1><b style="font-weight: bold;">Agencies
    Notified</b> - Agencies or organizations notified
    about the incident.</p></li>
    <li class=p-BulletedList1><p
    class=BulletedList1><b style="font-weight:
    bold;">Contact</b>
    - Contact person at the notified agency or
    organization.</p></li>
    <li class=p-BulletedList1><p
    class=BulletedList1><b style="font-weight: bold;">Notify
    Date</b> - Date the agency was
    notified.</p></li>
    <li class=p-BulletedList1><p
    class=BulletedList1><span style="font-weight:
    bold;">Comment/Report
    Number</span> - This field can be used to record any
    comments, notes,
    agency report/case numbers associated with the agency
    notification. </p></li>
    </ul>
    <p class=TableText><a href="javascript:void(0);"
    onClick="var e; if (parseInt(navigator.appVersion)>=4){e=event;}
    if (parseInt(navigator.appVersion) >=2 &amp;&amp;
    typeof(PopupMenu_Invoke) == 'function')
    PopupMenu_Invoke(e,'','Action
    Buttons','../../03_Getting_Started_files/Action_Buttons.htm','Adding
    a Row','../../03_Getting_Started_files/Adding_Row.htm','Adding Text
    Entries','../../03_Getting_Started_files/Adding_Text_Entries.htm','Deleting
    a
    Row','../../03_Getting_Started_files/Deleting_Rows.htm','Environmental
    Consequence
    Record','EC_Environmental_Consequence_Record.htm','Searching by
    Personnel
    ID','../../03_Getting_Started_files/Searching_by_Personnel_ID.htm','Selecting
    the
    Time','../../03_Getting_Started_files/Selecting_Time.htm');return
    false"
    title="Related Topics" id=a2 style="position:
    relative;"><img src="../../ss_btn_related_topics1.gif"
    alt="Related Topics" style="width: 81px; height: 17px;
    border-style: none; border-style: none;"
    width=81 height=17
    border=0></a><robohelp><script
    type="text/javascript"
    language=JavaScript1.2><!--
    InitEffects('a2');
    //--></script></robohelp>
    </p>
    <script language=javascript1.2
    type="text/javascript"><!--
    kadovTextPopupInit('a1','POPUP286607275');
    //--></script>
    if you could paste this code on your word doc and try to
    search for .bmp it exactly shows where it is used i tried removing
    that line but it acted strange as even when i added a pop up to a
    word it does not show anything in the view mode.

  • Acrobat 9.0 freezes while "Removing unused objects"

    I am using Acrobat Pro 9.0 in a Windows 8.1 environment.  When I attempt to convert a PDF I created to a Form the program freezes once I click SAVE and "Removing unused objects" appears.  I have "repaired" and "reinstalled" the application but the problem persists.

    Hi Mike,
    I do have some startup items;
    EyeTV Helper
    AdobeResourcesSynchroni
    I Love Stars
    GrowlHelperApp
    NikePlusUtil
    EEvent Manager
    EPSON Scanner Monitor
    I don't have any haxies on anything.
    I made a new user account and tried to replicate the problem but it seems to work fine when logged in as a different user which leads me to think it is a preference in my current user>library
    Ross

  • Acrobat 6 - Save As - Removing Unused Objects

    When using the "Save As" feature to save from a mapped network drive to the personal drive, documents that are created from a scanned image take a long time to save, and on the progress bar show the message "Removing Unused Objects".  My client is using Acrobat Standard 6, and I am unable to find any type of "PDF Optimizer" as the later versions have.  Is there any way to remove this background processing that Adobe is doing and speed up the network saving?
    Thanks,
    edgetech1

    Is there anyone out there who can offer some insight into this?

  • NetworkManager dispatcher script doesn't work

    Hey there,
    i have created a script in networkmanagers dispatcher.d directory to automount my NAS once my home wifi is connected and unmount it once the connection is lost.
    The dispatcher service is running and all permissions and the execution bit are set like it should be. But my script doesn't get called at all!
    i also tried installing this package: https://www.archlinux.org/packages/comm … cher-sshd/ and modifying its script but that also doesn't work.
    Is there some hidden settings file or something? What might be the cause for this?
    Thanks.

    Did you start/enable the NetworkManager-dispatcher service with systemctl? I'm not clear on what you mean by it's "running".
    Last edited by Scimmia (2014-03-23 19:57:10)

  • Buckup SQL Script doesn't work

    Hi  all,
    In ECC i want schedule ASE jobs to  dump transaction logs,i do it fellow the note 1588316 step by step .  In  schedule jobs my sql script doesn't work,but it works in sql command line.
    sql script :
    dump transaction DEV using config= 'DEVLOG'
    Anybody can give me some advise to face this issue?  Thanks in advance.
    David Lv

    Hi  all,
    My problem sloved, it's JSagent problem.
    sp_dumptrans not working at dbacockpit @Alcino Melo
    use sybmgmtdb
    go
    sp_js_wakeup "start_js",1
    go
    after start  JSagent  my sql script can run 
    Thanks  all
    David Lv

  • Mount volume script doesn't work after upgrading to Yoesmite

    I just upgrade my Mac OS to Yosemite and the boot up mount script doesn't work again.
    try
    mount volume "afp://admin:[email protected]/Multimedia/Music"
    mount volume "afp://admin:[email protected]/workspace"
    end try
    Should I modify the mount script and how to do that?
    Thank you so much.
    Matthew Ho

    I am having the exact same problem. I just did a complete re-install of max os x and did all of the updates..my hard drive had crashed so i had to replace it. lot's of fun.. and after the last upgrade i can't use my sound at all.. the sound shows that it's all the way up but it has the "no Smoking" sign as well..
    i have tried to restart.. change options and whatever else i could .. i did notice that when i enable the option to show the sound icon on the main bar that there is just a blank spot where it should be.. and i can't change it form there either because it just doesn't show..
    any one seen this before.. ?
    all my other Mac's work fine..
    please help..

  • Bash script doesn't work (Also, help me condense it)...

    I am trying to make myself a bash script which combines files together based off of a config file. It is automating combining the audio book tracks I ripped of my CDs into chapters for easier reference. My first problem is that even though I used ', cat still thinks that everything is a separate file. My second problem is that it is way too long, any way I can have it automatically go up 1 chapter until a specified number (ie, until the value of the CHAPTERS variable)? Thanks to those who help.
    chapcomb.sh
    #!/bin/bash
    # * ChapterCombine *
    # * By smartboyathome *
    # * A script which was made to combine *
    # * chapters from ripped audio books *
    # * together, but can be edited to *
    # * combine just about anything. *
    # * The config file is located in your *
    # * home directory, under the name *
    # * '.chapcomb.config'. If you do not *
    # * have this file, create it. *
    # * Otherwise this script will not *
    # * run, as it won't have the proper *
    # * variables. *
    # * This can be changed by changing *
    # * the CONFIG variable below. *
    # * Licensed under: *
    # * SmartLicense version 1.0 *
    VERSION=0.1
    usage() {
    echo "Chapter Combine v$VERSION"
    echo "A configuration file must be made in order to use this script. Configuration files are located at $CONFIG. This can be changed by adding CONFIG='blah' before this command, or by changing the script directly. See the sample file for how it should look."
    while [ "$#" -ne "0" ]; do
    case $# in
    --help)
    usage
    exit 0
    -h)
    usage
    exit 0
    esac
    done
    # The config file stuff.
    if [ -z "$CONFIG" ]; then
    CONFIG="$HOME/.chapcomb.config"
    fi
    . $CONFIG
    cd "$BOOKDIR"
    combine() {
    # Checks if file exists, and if so, deletes it.
    if [ -a $NAME ]; then
    rm $NAME
    fi
    # Combines files
    cat $FILES >> $NAME
    # Checks to make sure that the chapter combined ok.
    if [ -s "$NAME" ]; then
    echo "File $NAME is ok."
    else
    echo "File $NAME had an error and didn't combine. Please fix config file and rerun this script."
    exit 0
    fi
    chapter01
    combine
    chapter02
    combine
    chapter03
    combine
    chapter04
    combine
    chapter05
    combine
    chapter06
    combine
    chapter07
    combine
    chapter08
    combine
    chapter09
    combine
    chapter10
    combine
    chapter11
    combine
    chapter12
    combine
    chapter13
    combine
    chapter14
    combine
    chapter15
    combine
    chapter16
    combine
    chapter17
    combine
    chapter18
    combine
    chapter19
    combine
    chapter20
    combine
    chapter21
    combine
    chapter22
    combine
    chapter23
    combine
    chapter24
    combine
    chapter25
    combine
    chapter26
    combine
    chapter27
    combine
    chapter28
    combine
    chapter29
    combine
    .chapcomb.config
    # Config file for ChapterCombine
    # DO NOT DELETE, OR CHAPTERCOMBINE WILL NOT FUNCTION!
    # Book's Directory
    BOOKDIR='/media/Home/aabbott/Star Wars Fate of the Jedi Outcast'
    # Each chapter's settings.
    chapter01() {
    # FILES='Outcast\ Disc\ 1/01\ Track\ 1.mp3 Outcast\ Disc\ 1/02\ Track\ 2.mp3 Outcast\ Disc\ 1/03\ Track\ 3.mp3 Outcast\ Disc\ 1/04\ Track\ 4.mp3'
    FILES="'Outcast Disc 1'/{'01 Track 1','02 Track 2','03 Track 3','04 Track 4'}.mp3"
    NAME='Chapter01.mp3'
    chapter02() {
    # FILES='Outcast\ Disc\ 1/05\ Track\ 5.mp3 Outcast\ Disc\ 1/06\ Track\ 6.mp3 Outcast\ Disc\ 1/07\ Track\ 7.mp3 Outcast\ Disc\ 1/08\ Track\ 8.mp3 Outcast\ Disc\ 1/09\ Track\ 9.mp3 Outcast\ Disc\ 1/10\ Track\ 10.mp3 Outcast\ Disc\ 1/11\ Track\ 11.mp3'
    FILES="'Outcast Disc 1'/{'05 Track 5','06 Track 6','07 Track 7','08 Track 8','09 Track 9','10 Track 10','11 Track 11'}.mp3"
    NAME='Chapter02.mp3'
    chapter03() {
    # FILES='Outcast\ Disc\ 1/12\ Track\ 12.mp3 Outcast\ Disc\ 1/13\ Track\ 13.mp3 Outcast\ Disc\ 1/14\ Track\ 14.mp3 Outcast\ Disc\ 1/15\ Track\ 15.mp3 Outcast\ Disc\ 1/16\ Track\ 16.mp3'
    FILES="'Outcast Disc 1'/{'12 Track 12','13 Track 13','14 Track 14','15 Track 15','16 Track 16'}.mp3"
    NAME='Chapter03.mp3'
    chapter04() {
    # FILES='Outcast\ Disc\ 2/01\ Track\ 1.mp3 Outcast\ Disc\ 2/02\ Track\ 2.mp3 Outcast\ Disc\ 2/03\ Track\ 3.mp3 Outcast\ Disc\ 2/04\ Track\ 4.mp3'
    FILES="'Outcast Disc 2'/{'01 Track 1','02 Track 2','03 Track 3','04 Track 4'}.mp3"
    NAME='Chapter04.mp3'
    chapter05() {
    FILES="'Outcast Disc 2'/{'05 Track 5','06 Track 6','07 Track 7','08 Track 8'}.mp3"
    NAME='Chapter05.mp3'
    chapter06() {
    FILES="'Outcast Disc 2'/{'09 Track 9','10 Track 10','11 Track 11','12 Track 12','13 Track 13'}.mp3"
    NAME='Chapter06.mp3'
    # This one needs some special parameters as the chapter is split between two Discs.
    chapter07() {
    FILES="{'Outcast Disc 2'/{'14 Track 4','15 Track 15','16 Track 16','17 Track 17'}.mp3,'Outcast Disc 3'/{'01 Track 1','02 Track 2','03 Track 3'}}.mp3"
    NAME='Chapter07.mp3'
    chapter08() {
    FILES="'Outcast Disc 3'/{'04 Track 4','05 Track 5','06 Track 6','07 Track 7','08 Track 8'}.mp3"
    NAME='Chapter08.mp3'
    chapter09() {
    FILES="'Outcast Disc 3'/{'09 Track 9','10 Track 10','11 Track 11'}.mp3"
    NAME='Chapter09.mp3'
    chapter10() {
    FILES="'Outcast Disc 3'/{'12 Track 12','13 Track 13','14 Track 14','15 Track 15'}.mp3"
    NAME='Chapter10.mp3'
    chapter11() {
    FILES="'Outcast Disc 4'/{'01 Track 1','02 Track 2','03 Track 3'}.mp3"
    NAME='Chapter11.mp3'
    chapter12() {
    FILES="'Outcast Disc 4'/{'04 Track 4','05 Track 5','06 Track 6','07 Track 7','08 Track 8'}.mp3"
    NAME='Chapter12.mp3'
    chapter13() {
    FILES="'Outcast Disc 4'/{'09 Track 9','10 Track 10','11 Track 11'}.mp3"
    NAME='Chapter13.mp3'
    chapter14() {
    FILES="'Outcast Disc 4'/{'12 Track 12','13 Track 13','14 Track 14'}.mp3"
    NAME='Chapter14.mp3'
    chapter15() {
    FILES="{'Outcast Disc 4'/'15 Track 15','Outcast Disc 5'/{'01 Track 1','02 Track 2','03 Track 3','04 Track 4','05 Track 5'}}.mp3"
    NAME='Chapter15.mp3'
    chapter16() {
    FILES="'Outcast Disc 5'/{'06 Track 6','07 Track 7','08 Track 8','09 Track 9'}.mp3"
    NAME='Chapter16.mp3'
    chapter17() {
    FILES="'Outcast Disc 5'/{'10 Track 10','11 Track 11','12 Track 12','13 Track 13'}.mp3"
    NAME='Chapter17.mp3'
    chapter18() {
    FILES="{'Outcast Disc 5'/'15 Track 15','Outcast Disc 6'/{'01 Track 1','02 Track 2'}}.mp3"
    NAME='Chapter18.mp3'
    chapter19() {
    FILES="'Outcast Disc 6'/{'03 Track 3','04 Track 4','05 Track 5','06 Track 6','07 Track 7','08 Track 8'}.mp3"
    NAME='Chapter19.mp3'
    chapter20() {
    FILES="'Outcast Disc 6'/{'09 Track 9','10 Track 10','11 Track 11','12 Track 12','13 Track 13','14 Track 14'}.mp3"
    NAME='Chapter20.mp3'
    chapter21() {
    FILES="'Outcast Disc 6'/{'15 Track 15','16 Track 16','17 Track 17','18 Track 18','19 Track 19'}.mp3"
    NAME='Chapter21.mp3'
    chapter22() {
    FILES="'Outcast Disc 7'/{'01 Track 1','02 Track 2','03 Track 3','04 Track 4'}.mp3"
    NAME='Chapter22.mp3'
    chapter23() {
    FILES="'Outcast Disc 7'/{'05 Track 5','06 Track 6','07 Track 7','08 Track 8'}.mp3"
    NAME='Chapter23.mp3'
    chapter24() {
    FILES="'Outcast Disc 7'/{'09 Track 9','10 Track 10','11 Track 11','12 Track 12','13 Track 13'}.mp3"
    NAME='Chapter24.mp3'
    chapter25() {
    FILES="{'Outcast Disc 7'/{'14 Track 14','15 Track 15','16 Track 16','17 Track 17'},'Outcast Disk 8'/'01 Track 1'}.mp3"
    NAME='Chapter25.mp3'
    chapter26() {
    FILES="'Outcast Disc 8'/{'02 Track 2','03 Track 3','04 Track 4','05 Track 5'}.mp3"
    NAME='Chapter26.mp3'
    chapter27() {
    FILES="'Outcast Disc 8'/{'06 Track 6','07 Track 7','08 Track 8','09 Track 9'}.mp3"
    NAME='Chapter27.mp3'
    chapter28() {
    FILES="'Outcast Disc 8'/{'10 Track 10','11 Track 11','12 Track 12','13 Track 13'}.mp3"
    NAME='Chapter28.mp3'
    chapter29() {
    FILES="'Outcast Disc 8'/{'14 Track 14','15 Track 15','16 Track 16'}.mp3"
    NAME='Chapter29.mp3'

    kumyco wrote:
    for FILES=test/{a,b,c} you may want to do something like
    FILES=$(echo test/{a,b,c})
    That's a good one. And eval would work with simple examples, but once you have spaces and such in filenames it won't work I think.
    If you are going to do this often, then there are too many things that can go wrong with a script that tries to automatically generate the filenames. Even 01* can go wrong.
    So if you do have the filenames all in the .conf, then you can replace FILES= with cat and NAME= with >
    The actual script doesn't add that much, except checking if it exists (just use > instead of >>) and if it isn't empty (not really necessary) (why did you put a license on that? is that even legal?)
    So just use the .conf file as the main script.
    Turn this:
    BOOKDIR='/media/Home/aabbott/Star Wars Fate of the Jedi Outcast'
    chapter01() {
    FILES="'Outcast Disc 1'/{'01 Track 1','02 Track 2','03 Track 3','04 Track 4'}.mp3"
    NAME='Chapter01.mp3'
    chapter02() {
    FILES="'Outcast Disc 1'/{'05 Track 5','06 Track 6','07 Track 7','08 Track 8','09 Track 9','10 Track 10','11 Track 11'}.mp3"
    NAME='Chapter02.mp3'
    into this:
    cd '/media/Home/aabbott/Star Wars Fate of the Jedi Outcast'
    cat 'Outcast Disc 1'/{'01 Track 1','02 Track 2','03 Track 3','04 Track 4'}.mp3 > 'Chapter01.mp3'
    cat 'Outcast Disc 1'/{'05 Track 5','06 Track 6','07 Track 7','08 Track 8','09 Track 9','10 Track 10','11 Track 11'}.mp3 > 'Chapter02.mp3'
    Right?
    Why would you build anything around that?
    If you are sure the filenames are all the same, you can use *
    cat *\ 1/*\ {1..4}.mp3 > Chapter01.mp3
    cat *\ 100/*\ {70..99}.mp3 > Chapter99.mp3

  • Use BridgeTalk,but my script doesn't work

    Hi,
    I want to use BridgeTalk to open a image in photoshop,but my script doesn't work.
    Anyone can tell me why?Thanks!
    Best Regards
    goldbridge
    #target indesign
    #targetengine "MyEngine"
    var doc=app.activeDocument;
    if(doc.selection.length>0)
                        if(doc.selection[0].constructor.name=="Image")
                               jpgpath=new File(app.selection[0].itemLink.filePath);
                               bt = new BridgeTalk;
                               bt.target = "photoshop";
                               bt.type = "iterator";
                               bt.body="{app.open(jpgpath);}";
                               bt.onResult = function(resObj) {};
                               bt.send();
                               BridgeTalk.bringToFront("photoshop");

    In your body script… jpgpath is just part of a string you have not constructed this to pass the variable… Also some classes are considered complex types so you need to toSource() and then eval…
    #target indesign
    #targetengine "MyEngine"
    var doc=app.activeDocument;
    if(doc.selection.length>0)
                        if(doc.selection[0].constructor.name=="Image")
                               jpgpath=new File(app.selection[0].itemLink.filePath).toSource();
                               bt = new BridgeTalk;
                               bt.target = "photoshop";
                               bt.type = "iterator";
                               bt.body = "{app.open( eval (" + jpgpath + ") );}";
                               //$.write( bt.body  );
                               bt.onResult = function(resObj) {};
                               bt.send();
                               BridgeTalk.bringToFront("photoshop");

Maybe you are looking for