is it possible to write a script that will display the script files folder in the tree

is it possible to write a script that will display the script files folder in the tree

Yes :-)

In your previous post, someone suggested to search for the file "SnpCreateTreeview.jsx", because it would just be the asked.

The script can be found here, just accept the EULA and download the example scripts of Bridge CS3. (For some reason it is not in CS4 samples because as far as I know)

Here's a version with small changes, it is up to you to point the script in the folder 'root' right, because this is, needless to C: on PC:

////////////////////////////////////////////////////////////////////////////
ADOBE SYSTEMS INCORPORATED
Copyright 2007 Adobe Systems Incorporated
All rights reserved
//
NOTE: Adobe permits you to use, modify, and distribute this file according to the
the terms of the Adobe license agreement accompanying it.  If you received this file from one
source other than Adobe, then your use, modification or distribution of it is required in advance
written permission from Adobe.
/////////////////////////////////////////////////////////////////////////////

/**
@fileoverview shows how to use an item in the tree list and how to capture events with
functions of recall or script registered event listeners.
@class shows how to use an item in the tree list and how to capture events with
functions of recall or script registered event listeners.

Its use


  
  
  

      
  1. Run the extract in the ExtendScript Toolkit (see Readme.txt).
       
  2. Enlarge / reduce the list items
       
  3. Check the JavaScript Console to see the events captured by the elements of the TreeView.
     

Description


 
 

Creates two hierarchical list of TreeView items. One is static, with a fixed set of point
nodes that you can expand and collapse. The other is dynamic; Item nodes are added and removed as
the need for a view of the file system.
 
 

The list items in the TreeView control to display the folders and files custom images.  When you add items to the
TreeView list, type 'article' is used for elements of the leaf and 'node' to the elements of the container.
 
 

Dynamic TreeView captures events in two different ways. It uses callback functions to capture the
node to expand and collapse events and selection changes and also registers an event listener to
capture double-click events.

@constructor constructor
*/
#targetengine "session".
function SnpCreateTreeView()
{
/**
The context in which this code snippet can work.
@type string
*/
this.requiredContext = "\tNeed runs in the context of the Bridge\n."

/**
The location of this script file system
@type file
*/
var scriptsFile = new File($.fileName);
   
/**
The location of the file system resource PNG file used to represent folders
@type file
*/
this.folderIcon = new file (scriptsFile.path + "/ resources/Folder_16x16.png");

/**
The location of the file system resource PNG file used to represent files
@type file
*/
this.fileIcon = new file (scriptsFile.path + "/ resources/Story_16x16.png");

/**
The root folder that will be used for the dynamic tree
@type string
*/
this.rootFolder

If (File.fs is "Windows")
{
this.rootFolder = "C:";
}
on the other
{
this.rootFolder = ' / ';.
}
}

/**
Functional part of this code snippet. Creates the ScriptUI window and its components,
and defines the behavior.
@return true if the code snippet is executed as scheduled, false otherwise
Boolean @type
*/
SnpCreateTreeView.prototype.run = function()
{

$.writeln ("about to"run SnpCreateTreeView");
   
Create the window
var win = new window ("palette", "SnpCreateTreeView", undefined, {resizable: false});

Create the Committee for the static TreeView control
sPanel var = win.add ('Committee', undefined, 'TreeView Élément') static;
sPanel.alignment = ["fill",""];
sPanel.alignChildren = ["fill",""]

Create a TreeView list
sTv var = sPanel.add ("treeview");
sTv.preferredSize = (300, 200);
Add static items to the list, in a hierarchical structure.
for (var i = 0; i)<>
{
sTv.add ("node", "Item" + i);
for (var j = 0; j)<>
{
sTv.items [i] .add ("item", "Sub Item" + j);
}
}

Create the Committee for the dynamic TreeView control
var dPanel dynamic = win.add ('Committee', undefined, 'TreeView Élément');
Create a TreeView list
TV digital var = dPanel.add ("treeview", undefined);
dTv.preferredSize = (400, 300);
Create the root node element
var aNode = dTv.add ("node", "/");
Pair it with an image of the icon
aNode.image = this.folderIcon;

Define a handler for the double clicks
myOnDoubleClick = Function
{
if(e.detail == 2)
{
$.writeln ("double click");
}
}

Adds the handler as an event listener to the TreeView element.
dTv.addEventListener ("click", myOnDoubleClick);

Keep a reference to this object
var that = this;

Define an event handler for when a node is expanded
dTv.onExpand = function (point)
{
$.writeln (item.text + "is now expanded.");
nextItem var = item;
var path = "";
goUp var = true;

While (goUp)
{
path = "/" + nextItem.text + path;
nextItem = nextItem.parent;
If (instanceof TreeView nextItem)
{
goUp = false;
}
}

Remove all children of this element
item.removeAll ();

var Ref = new file (that.rootFolder + path);
If (Ref instanceof Folder)
{
children var = ref.getFiles ();
for (var i = 0; i)<>
{
If (children [i] instanceof file)
{
Item.Add ("node", children [i] p:System.NET.mail.MailAddress.DisplayName);
Item.Items [i] .image = that.folderIcon;
}
on the other
{
Item.Add ("item", children [i] p:System.NET.mail.MailAddress.DisplayName);
Item.Items [i] .image = that.fileIcon;
}
}
}
}

Define an event handler for when a node is reduced
dTv.onCollapse = function (point)
{
$.writeln (item.text + "is now reduced.");
}

Define an event handler for when the selection changes
dTv.onChange = function()
{
$.writeln ("selection changed");
}

Display the window
Win.Show ();
   
$.writeln ("Ran SnpCreateTreeView");
   
Returns true;
}

/**
"main program": construct an anonymous instance and run
as long as we are not unit - test this code snippet.
*/
If (typeof (SnpCreateTreeView_unitTest) == 'undefined') {}
new SnpCreateTreeView () .run ();
}

Tags: InDesign

Similar Questions

  • I wonder if it is possible to design a form that will read the records in xml format?

    I'm studying for exams and don't really get study a lot because of work and I recently bought flashcards for the subject that are in XML format. The flashcards are open through a program that comes with them and it's just a small flashcard base looking for the box. Very simple.

    Well, the problem I have is that I want to study at work but failed to install software not approved. But I was wondering if I could create a flashcard form that displays the XML for me so that I look like im work haha. I want to import the XML data into the form.

    Here is a copy of one of the files xml (card game)

    Thank you

    <? XML version = "1.0" encoding = "UTF-8"? >

    < core_version mnemosyne = "1" >

    < active category = "1" >

    secured transactions < name > < / name >

    < / category >

    < item id = "_0" >

    secured transactions < CAT > < / cat >

    < Q > what a security attach or become enforceable? < /q >

    < a > secure interest must be accompanied by taking into account

    Debtor must actually own the rights in the collateral or have in his possession

    Guaranteed interest that much be registered < /A >

    < / point >

    < item id = "_1" >

    secured transactions < CAT > < / cat >

    < Q > what are the characteristics of perfection of interest in a secure transaction? < /q >

    < a > receives higher on other priority claim rights to guarantee after that perfection takes place

    Attachment must take place BEFORE perfection

    < /A >

    < / point >

    < item id = "_2" >

    secured transactions < CAT > < / cat >

    < Q > how perfection occurs in a secure transaction? < /q >

    < A > by the filing of a financing statement

    With the collateral < /A >

    < / point >

    < item id = "_3" >

    secured transactions < CAT > < / cat >

    < Q > automatic perfection happens in a secure transaction? < /q >

    < a > store sells a consumer credit of course - store maintains security

    A Bank finances the purchase of a good consumer - Bank keeps safety < /A >

    < / point >

    < item id = "_4" >

    secured transactions < CAT > < / cat >

    < Q > what are the rules of priority of payment in a secure transaction? < /q >

    < A > if both parties are developed, then the first file WINS

    If none of the parties are perfect, then the first set win < /A >

    < / point >

    < item id = '_5' >

    secured transactions < CAT > < / cat >

    < Q > what are the benefits of a creditor with a lien in a secure transaction? < /q >

    < a > creditor has priority over claims of warranty against collateral not perfect

    Bat perfected security interests filed after attachment of privilege

    Exceptions: Purchase money security, which has the grace period of 10 days to file

    Buyers to purchase in the normal course of business are immune from collateral held by merchants < /A >

    < / point >

    < / mnemosyne >

    Hello

    For me, it was easier to simply create the form for you that he would have been giving step by step instructions. I was able to link the XML you provided to a repeatable subform. The answers are hidden until you press a button to see the answer.

    If you send me a private message here with your email address, I'll send the pdf to you directly.

    -Scott

  • Link on the sidebar that will display the results in the middle of the same page column

    It's me again...

    The idea is to keep viewers on the same page.  I want to have the links in the left sidebar when you click will bring information and photos in the stratification of the middle column which is originally in the middle column.  It's kind of like swap image (which I work with a large number), but it would not be a case of glide mouse.

    Thanks for your help,

    Sandy

    Fixed position elements are exactly that.  Fixed compared to the upper left of the browser.  Since fixed elements are removed from the normal document flow, they do not behave like floats by-side.

    Nancy O.

  • Is it possible to write a script for underlined text export to PDF?

    When I make changes in the financial document, I must emphasize this purpose to show what I edit, these underscore was called "markup". And then print (paper version) and gen (PDF) of the amendment, which means I have to print and gen text underlined (or called markup text) after modification.

    sample PIC:

    back markup.jpg

    If:

    Customer requires a new version of the markup, which means I have to change the last beacon color (color of the underline to the last amendments) in 'back' and then make new 'red' as this markup:

    red markup.jpg

    What I want:

    is it possible to write a script for printing and gen only markup in the document text all open

    and I want two versions

    (1) all text markup gen no matter the color of the underline

    (2) the red color of the markup text gen

    Thank you!

    Hi HarveyLiu,

    Why, you ask? It will export the pages who pointed out the text.

    var doc = app.documents;
    app.findTextPreferences = null;
    app.findTextPreferences.underline = true;
    for(var i=0;i
    

    Kind regards

    Cognet

  • A script that will count the total number of pages into multiple PDF files in a batch file?

    Is there a script I can use ExtendScript Toolkit that will count the total number of pages into multiple PDF files in a batch file?

    In another discussion I showed a JavaScript that you can use to write the number of pages to the console in a batch sequence. You would do exactly the same thing in Action, so the action would consist of a simple JavaScript (more tools > run JavaScript) which includes the code.

  • Does anyone know of a VI or how to write one that will stop the computers time be disabled if an application is run.

    Does anyone know of a VI or how to write one that will stop the computers clock be turned off if an application is run. The time and date can be reset normally while an application is running by clicking on the time in the lower right of the screen of the computer. I have an application that runs over several days and it is essential that the time and date of the computer not be changed. Is there an easy way of this lockout the user? Note that I am what I consider a beginner advanced in LV

    Thank you

    Chuck

    This isn't something that you can from LabVIEW, because this is an operating system operation, and it will depend on the operating system you are using. Under Windows, you can use Group Policy to control this. Please Google on "prevent changing the date and time of windows."

    Also, please try to refrain from stuffing your message in its entirety in the block of material. Keep short, but descriptive enough topic so we can understand what you're asking basically. Thank you.

  • Is it possible to put a password that would prevent the program turn accidentally closed?

    We have a person in our laboratory which is spirit very scatter. Several times he wanted to reduce Labview program running, but doesn't actually not paid attention and accidentally closed it by clicking X instead of _, thus negating the whole experience. When the program was closed he didn't ask if he wanted to save or if he didn't know that he wanted to close it. Is it possible to put a password that would prevent the program turn accidentally closed?

    You have two options.

    1. You can hide the X in total in the properties of VI.  Go to the appearance of the window, click Customize, and then uncheck the option to allow the user to close the window.  You would need another method, for example a file-> Quit or exit option button.
    2. If you use a version higher than the Base, you can use a structure of the event to capture the narrow window? event.  This will allow you to ask the user to confirm to get out and do something else required.  If the user cancels, or you need to cancel, you have the abaility to cancel the event.
  • Looking for Advanced Action script that will close the project

    Hi all

    It seems so simple but I can't seem to understand. Does anyone know of scripts that will cause the project to close when the user clicks a button? I have a project built in 6 Captivate that is set to close its 'End of the project' preferences and has multiple options of branches. I want to have a button to END that will close the entire project. The best that I got is simply apply an action of 'CONTINUE' on the last slide, but since this slide also includes a button that jumps to another branch, the blade simply crashes when you click the END button.

    Any thoughts?

    Krista

    You can use a 'Execute JavaScript' action with the script below:

    window.close();
    

    OR

    window.top.close();
    

    What script you use depends on how your LMS launches your course.  If it is in the main window, use Window.Close ().  If it is in a window child, then window.top.close ().  If you are not sure, then a little experience by downloading a course of a slide with two buttons.  The first button must execute Window.Close (); and the 2nd button must execute window.top.close ();.  When your LMS is launching the course, try the buttons and see one that works.

    F12 (Web Preview) will not give you a solid test since your LMS can launch your course differently... it's the kind of thing that should be tested in your LMS to be sure it works.

    Jim Leichliter

  • Y at - it an upgrade of Windows Compression that will allow the opening of a file Winzip 15?

    Original title: compatibility of winzip 15.

    Y at - it an upgrade of Windows Compression that will allow the opening of a file Winzip 15?

    Hello

    WinZip 15's a compressor of owner, so it would be exclusive to them.

    I recommend you contact WinZip support for assistance.

    http://www.WinZip.com/xsupport.htm

    Hope the helps of information.

  • How to configure CPU Meter so that it displays the image instead of the text version.

    How to configure CPU Meter so that it displays the image instead of the text version.

    Hi John,.

    Welcome to the Microsoft community.

    The CPU Meter gadget shows the status of the two main resources, you can follow on your computer - the use of your CPU and memory.

    To install the CPU Meter gadget in Windows 7, just right click anywhere on your desktop and click on Gadgets. Search the CPU Meter gadget and drag it to your desktop.

    See the Microsoft Article below and check if this is useful:

    http://Windows.Microsoft.com/en-us/Windows7/customize-desktop-gadgets

    Let us know if you encounter problems under windows in the future. We will be happy to help you.

  • Anyone wishing to share SQL that will pull the text of the business unit that is attached to a language specification?

    Anyone wishing to share SQL that will pull the text of the business unit that is attached to a language specification?

    Select s.SpecNum, s.IssueNum, SpecSummary n.name s

    inner join gsmApprovedUsage on s.SpecID = au.fkSpecID and au.fkSpecID as 5816% AU '

    gsmApprovedUsageBUJoin j j.fkApprovedUsage = au.pkid inner join

    inner join commonBusinessUnitName on n.fkSpecBusinessUnit = j.fkBusinessUnit and n.langID = 0 n;

  • phone that keeps displays the desktop version

    I wonder if anyone can help me, problem with the version of phone of my site. Versions of desktop and tablet are working perfectly, it is the version of the phone that guard displays the version of office.

    My problem:

    When you access the site using the browser on my phone desktop version appears however, accessing the site on my phone using Chrome the correct version is displayed.

    Using Phone Browser.pngWhen using Chrome .png

    Hello

    As discussed in the other thread its fixed by disabling the cache of the phone.

    Hello, I made a site using the 3 platforms: desktop, Tablet and smartphone, but... on tablets and smartphones appears the design office, no idea why?

    Concerning

    Vivek

  • How to place the link on the page that will reveal the TOC apps?

    I am trying to create a button link on every page of my application that will reveal the TOC apps. I was hoping I'd be able to use: goto://ApplicationViewState/TOC or similar, because I know that I can use 'goto' commands to link to the library etc.

    I am aware that type the page lowers the navigation bar and the table of contents is here, but my client wants something more direct.

    We don't have a way to trigger the table of contents of a hyperlink.

    Neil

  • I want to buy photoshop that will change the background on a portrait?

    I want to buy photoshop that will change the background on a portrait?

    Photoshop or Photoshop Elements will work. Lightroom can work, depending on what kind of change you want, if you just want to resolve what is there rather replace that with something else.

  • How to design a report that all display the name of the account without Contacts?

    What is the best/better way to create a report that all display the name of the account without contacts?

    Thank you!

    Tim,

    Create:

    Report 1 - account ID, account name, name of the Contact - save it in the shared company folder
    Report 2 - ID account, the account name - it save anywhere

    Report 1 will give you a list of accounts with contacts (the integrated join should remove accounts with no contacts)
    Report 2 will give you a list of accounts
    Add a filter on the report ID 2 account - advanced - filter based on the results of another report.
    Find your report 1 and account ID does not match the account ID

    Report 2 will give you now all accounts - accounts of Report 1 is with no contact.

    see you soon
    Alex

Maybe you are looking for