How can I get the Doc object from any other object?

Dear colleagues,
in FrameScript it is dead-simple to get to the document part of any object, just add .Doc to the variable.
How can I achieve the same with ExtendScript? I amtired of passing the document object next to AFrames or Pgfs along into subroutines, because those objects already contain the information about their document. But how do I access this?
Thanks for pointers,
- Michael
PS: Almost the same is true for the page an object lives on. With FrameScript we use .Page, with ExtendScript you have to move up the object tree until you reach the UnanchoredFrame.PageFramePage…
PPS: It would be great to see some convenience properties like .Doc and .Page implemented natively.

I'll preface this response by admitting this far from an elegant solution, but I did write a function addressing this question, mostly as an exercise.
If passed an object with an InTextFrame property (Pgf, AFrame, Cell, Fn) that resides in an open document, the function will return the Doc object. Otherwise, it returns undefined.
function getParentDoc(testObj) {
    //Get object for current page
    try { var curPage = testObj.InTextFrame.FrameParent.PageFramePage; }
    catch(er) {return;}
    //Step backwards to first page in document
    var prevPage = curPage.PagePrev;
    while (prevPage.ObjectValid())
        curPage = prevPage;
        prevPage = prevPage.PagePrev;
    //Compare with first pages of open documents
    var testDoc = app.FirstOpenDoc;
    while (testDoc.ObjectValid())
        if (curPage.id==testDoc.FirstBodyPageInDoc.id) return testDoc;
        testDoc = testDoc.NextOpenDocInSession;    
    return;
To your PPS: Rather than seeing the native framework grow bloated to address additional features, I would love to see Adobe and other developers publish libraries of useful functions and class extensions.

Similar Messages

  • How can i get the all values from the Property file to Hashtable?

    how can i get the all values from the Property file to Hashtable?
    ok,consider my property file name is pro.PROPERTIES
    and it contain
    8326=sun developer
    4306=sun java developer
    3943=java developer
    how can i get the all keys & values from the pro.PROPERTIES to hashtable
    plz help guys..............

    The Properties class is already a subclass of Hashtable. So if you have a Properties object, you already have a Hashtable. So all you need to do is the first part of that:Properties props = new Properties();
    InputStream is = new FileInputStream("tivoli.properties");
    props.load(is);

  • How can I get the XML structure from a flat structure?

    Hi all,
    in my XI SP 12 I use a JMS adapter to read information using the WebSphereMQ transport protocol.
    The structure that I receive have this format:
    <Name_A.KeyFieldValue><Name_A.fieldName_A1_Value>...<Name_A.fieldName_AN_Value>
    <NumberRecordType_B><NumberRecordType_c>
    <Name_B.KeyFieldValue><Name_B.fieldName_B1_Value>...<Name_B.fieldName_BN_Value>
    <Name_B.KeyFieldValue><Name_B.fieldName_B1_Value>...<Name_B.fieldName_BN_Value>
    <Name_C.KeyFieldValue><Name_C.fieldName_C1_Value>...<Name_C.fieldName_CN_Value>
    <Name_C.KeyFieldValue><Name_C.fieldName_C1_Value>...<Name_C.fieldName_CN_Value>
    the problem is that in this structure each line is not separated by a carriage return or a comma, I have all the information in a single line:
    <Name_A.KeyFieldValue><Name_A.fieldName_A1_Value>...<Name_A.fieldName_AN_Value><NumberRecordType_B><NumberRecordType_c><Name_B.KeyFieldValue><Name_B.fieldName_B1_Value>...<Name_B.fieldName_BN_Value>...<Name_B.KeyFieldValue><Name_B.fieldName_B1_Value>...<Name_B.fieldName_BN_Value><Name_C.KeyFieldValue><Name_C.fieldName_C1_Value>...<Name_C.fieldName_CN_Value>...<Name_C.KeyFieldValue><Name_C.fieldName_C1_Value>...<Name_C.fieldName_CN_Value>
    and the customer don't want to insert a line separator.
    Then, the question is:
    How can I get the XML structure from this structure?
    If possible, I don't want to develop new Module and add it in the JMS Module Sequence.
    PS I have already read the article "How to Use the Content Conversion Module with the XI 3 J2EE JMS Adapter.pdf" and it doesn't seem to help me.
    Best Regards,
    Paolo

    To get context parameters from your web.xml file you can simply get the ActionServlet object from an implementing action object class. In the perform (or execute) method make the following call.
    ServletContext context = getServlet().getServletContext();
    String tempContextVar =
    context.getInitParameter("<your context param >");

  • How can I get the "text" field from the actionEvent.getSource() ?

    I have some sample code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.ArrayList;
    public class JFrameTester{
         public static void main( String[] args ) {
              JFrame f = new JFrame("JFrame");
              f.setSize( 500, 500 );
              ArrayList < JButton > buttonsArr = new ArrayList < JButton > ();
              buttonsArr.add( new JButton( "first" ) );
              buttonsArr.add( new JButton( "second" ) );
              buttonsArr.add( new JButton( "third" ) );
              MyListener myListener = new MyListener();
              ( (JButton) buttonsArr.get( 0 ) ).addActionListener( myListener );
              ( (JButton) buttonsArr.get( 1 ) ).addActionListener( myListener );
              ( (JButton) buttonsArr.get( 2 ) ).addActionListener( myListener );
              JPanel panel = new JPanel();
              panel.add( buttonsArr.get( 0 ) );
              panel.add( buttonsArr.get( 1 ) );
              panel.add( buttonsArr.get( 2 ) );
              f.getContentPane().add( BorderLayout.CENTER, panel );
              f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              f.setVisible( true );
         public static class MyListener  implements ActionListener{
              public MyListener() {}
              public void actionPerformed( ActionEvent e ) {
                   System.out.println( "hi!! " + e.getSource() );
                   // I need to know a title of the button (which was clicked)...
    }The output of the code is something like this:
    hi! javax.swing.JButton[,140,5,60x25,alignmentX=0.0,alignmentY=0.5,
    border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@1ebcda2d,
    flags=296,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,
    disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,
    right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,
    rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=first,defaultCapable=true]
    I need this: "first" (from this part: "text=first" of the output above).
    Does anyone know how can I get the "text" field from the e.getSource() ?

    System.out.println( "hi!! " + ( (JButton) e.getSource() ).getText() );I think the problem is solved..If your need is to know the text of the button, yes.
    In a real-world application, no.
    In a RW application, a typical need is merely to know the "logical role" of the button (i.e., the button that validates the form, regardless of whether its text is "OK" or "Save", "Go",...). Text tends to vary much more than the structure of the UI over time.
    In this case you can get the source's name (+getName()+), which will be the name that you've set to the button at UI construction time. Or you can compare the source for equality with either button ( +if evt.getSource()==okButton) {...}+ ).
    All in all, I think the best solution is: don't use the same ActionListener for more than one action (+i.e.+ don't add the same ActionListener to all your buttons, which leads to a big if-then-else series in your actionPerformed() ).
    Eventually, if you're listening to a single button's actions, whose text change over time (e.g. "pause"/"resume" in a VCR bar), I still think it's a bad idea to rely on the text of the button - instead, this text corresponds to a logical state (resp. playing/paused), it is more maintainable to base your logic on the state - which is more resilient to the evolutions of the UI (e.g. if you happen to use 2 toggle buttons instead of one single play/pause button).

  • How can i get the max rpm from cpu fan??

    how can i get the max rpm from my cpu cooler regarding that i don't have a speed controller attached to the cpu fan ,,, ??  please make things clear for me
    thanks

    if you have not reduced it by using a speed controller either hardware or software or by the 7v mod its already going as fast as it will at 12 v dc you cannot speed it up only slow it down
    need more air get a different cooler/fan

  • How can I get the edited pictures from the thumbnails to full size?

    I upgraded to iPhoto 11, the thumbnail photos show my previous edits, but when I click on the photo to make it bigger, it reverts back to the unedited, original picture.  How can I get the edited pictures from the thumbnails to full size?

    Verify you are using iPhoto11 ver 9.5
    if not run the >Software update or check your apps folder and make sure the correct iPhoto is launched,  not an older ver.

  • How can i get the source code from java concurrent program in R12

    Hi 2 all,
    How can i get the source code from java concurrent program in R12? like , "AP Turnover Report" is java concurrent program, i need to get its source code to know its logic. how can i get its source code not the XML template?
    Regards,
    Zulqarnain

    user570667 wrote:
    Hi 2 all,
    How can i get the source code from java concurrent program in R12? like , "AP Turnover Report" is java concurrent program, i need to get its source code to know its logic. how can i get its source code not the XML template?
    Regards,
    ZulqarnainDid you see old threads for similar topic/discussion? -- https://forums.oracle.com/forums/search.jspa?threadID=&q=Java+AND+Concurrent+AND+Source+AND+Code&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

  • How can I get the data back from my game

    How can I get the data back from minecraft if I deleted the app and bought with a different Apple ID

    No, they are tied to the ID that purchased them, and cannot be transferred to anyone else.

  • How can I get the edited value from the editor in JTable

    I have a JTextField added as an editor to a cell in JTable.
    I value gets changed when I press enter.
    but in actionPerformed of the JTextField when I say
    String txtEditorValue = txtEditor.getText();
    I am getting the old value. How can I get the edited value? Thanks.

    Hi,
    I guess, your understanding of how JTable works together with its models is not good enough - for example the method getTableCellEditorComponent(...) of the TableCellEditor interface is used to get the component, that should be used as editing component - its second parameter is a value that should be used to setup the editing component - it is normally not the editing component itself.
    JTable uses an underlying TableModel to store the cell values - if you have edited a cell, JTable gets the value of the editing component by itself and stores it in the TableModel using its setValueAt(...) method. To retrieve this data you only need to query the TableModel using row and column of this cell as parameters
    say jt is your JTable, and row and column are the row and column of the cell - so to get the value, simply use
    Object obj = jt.getModel().getValueAt(row,column);
    if you know, that there is a String in this cell use
    String str = (String) jt.getModel().getValueAt(row,column);
    The editor component is used for the view of the JTable - you only want the data, which is stored in the model - you don't have to deal with the GUI components in this case.
    greetings Marsian

  • How can i get the System Time from the other host

    I want to get the System Time from the other host in the LAN,How can I get the Time using Java.
    Such as I am in WIN 2000 and I have a Unix host in LAN, I want to get unix host System time, How can I do it.

    Open a socket to port 13 and read a string with the time.
    -or-
    Open a socket to port 27 and read 4 bytes that are a network order timestamp
    Assuming that your UNIX machine has those services running, most do

  • How can i get the meta data from database?

    Hi, all java and db experts,
    I need to write a tool to generate java file which will be used to hold the resultset of a stored procedure of Oracle. Is there any API call or tools to connect to db and then get the meta data of the return cursor instead of reading stored procedure definition on my own?
    Please help, thanks a lot.
    Hanna

    if i execute a Oracle stored procedure, the resultset of a cursor is returned. It's easy to know the meta data at the runtime.
    However, could i get the meta data about the resultset of a cursor before runtime? Such as by connecting to the database and ask it about meta data of a specified stored procedure?
    Is it feasible?
    DatabaseMetaData dbmd = conn.getMetaData();
    ResultSet rs = dbmd.getProcedureColumns("", "%", "SP_NAME", "%");
    while (rs.next()) {
    String colName = rs.getString(4);
    int colType = rs.getInt(5);
    int colDataType = rs.getInt(6);
    int colPrecision = rs.getInt(8);
    int colLen = rs.getInt(9);
    int colScale = rs.getInt(10);
    long defaultValue = rs.getLong(11);
    But what i get is a list of stored procedure parameters. In oracle, cursor is IN OUT parameter . How can i get the meta data about the resultset of cursor?

  • HT1349 My Ipad was stolen, How can I get the serial Number from Apple. It was registered with them

    I had  2 Ipads, a mac book pro and a Mac Air stolen 2 weeks ago
    I am trying to locate one of the serial numbers, but cant find the last box.  Can I get the serial number from Apple. It was registered and now it is not showing up as one of my products.
    Thanks

    The easiest way to find your serial number is this Open Itunes...click help... run diagnostics.....(tick or untick as necessary) so that you just have ticked the last two,  device connectivity and device sync.  run these tests. it will say no ipod/ipad found but will give results of test....scroll down to bottom of results... here you will find the serial number of your last attached devices.

  • How can you get  the public variables from object that extends JLabel?

    I'm using the mouseClickedListener method e.getComponent(); to get the component that is clicked on the sceen. The component i clicked is type "object" and extends a jlabel, and i really need to acces a variable from it. Heres the code i'm using-
    MouseListener listenerDown=new java.awt.event.MouseListener() {
            public void mousePressed(MouseEvent e){
                paintAll();
                mX=e.getX();
                mY=e.getY();
            public void mouseClicked(MouseEvent e) {
                Component c = e.getComponent();
                drawResizeBox(c);
                selected=c;
            public void mouseReleased(MouseEvent e) {
            public void mouseEntered(MouseEvent e) {
            public void mouseExited(MouseEvent e) {
    package javapoint;
    import java.awt.Color;
    import java.awt.Graphics2D;
    import java.awt.Image;
    import java.awt.Rectangle;
    import java.awt.RenderingHints;
    import java.awt.geom.Line2D;
    import java.awt.image.BufferedImage;
    import javax.swing.Icon;
    import javax.swing.ImageIcon;
    import javax.swing.JLabel;
    public class object extends JLabel{
        public object(Rectangle rect,int id){
            idNum=id;
            Rect=rect;
            BufferedImage image = new BufferedImage((int)rect.getWidth()+1, (int)rect.getHeight()+1, BufferedImage.TYPE_INT_ARGB);
            Graphics2D g = (Graphics2D) image.getGraphics();       
            g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            g.drawRect((int)rect.getX(), (int)rect.getY(), (int)rect.getWidth(), (int)rect.getHeight());
            Icon icon = new ImageIcon((Image)image);
            setIcon(icon);
            setBounds((int)rect.getX()-1, (int)rect.getY()-1, (int)rect.getWidth()+1, (int)rect.getHeight()+1);
            mainFrame.slideArr[mainFrame.sIndx].add(this);
            setVisible(true);
            r=true;       
        object(Oval oval,int id){
            idNum=id;       
            setBounds(oval.getX(), oval.getY(), oval.getWidth(), oval.getHeight());
            getGraphics().drawOval(oval.getX(), oval.getY(), oval.getWidth(), oval.getHeight());
            o=true;
            setVisible(true);
        object(Line2D line,int id){
            idNum=id;       
            setBounds((int)line.getX1(), (int)line.getY1(), (int)line.getX2(), (int)line.getY2()); //Not gunna work
            getGraphics().drawLine((int)line.getX1(), (int)line.getY1(), (int)line.getX2(), (int)line.getY2());
            l=true;
            setVisible(true);
        object(Icon icon,int id){
            idNum=id;
            setIcon(icon);
            setBounds(50,50,icon.getIconWidth(),icon.getIconHeight());
            i=true;
            setVisible(true);
        void drawObject(object obj){
            if(r){
                Rectangle rect=obj.Rect;
                setBounds((int)rect.getX()-1, (int)rect.getY()-1, (int)rect.getWidth()+1, (int)rect.getHeight()+1);          
                Rect=rect;
                BufferedImage image = new BufferedImage((int)rect.getWidth()+1, (int)rect.getHeight()+1, BufferedImage.TYPE_INT_ARGB);
                Graphics2D g = (Graphics2D) image.getGraphics();           
                g.setColor(Color.red);
                g.drawRect(0, 0, (int)rect.getWidth(), (int)rect.getHeight());           
                Icon icon = new ImageIcon((Image)image);
                setIcon(icon);
            }else if(l){
            }else if(o){
            }else if(i){
        public boolean r=false;
        public Rectangle Rect;
        public boolean o=false;
        public Oval Oval;
        public boolean l=false;
        public Line2D Line;
        public boolean i=false;
        public Icon Icon;
        public JLabel label;
        public int idNum;
    }Edited by: ghostbust555 on Feb 12, 2010 2:14 PM

    ghostbust555 wrote:
    Well see the problem is i have an array of 200 objects.What does that have to do with anything? And if it does, why isn't it in the code you posted?
    I dont understand what you mean in your "Edit..." part. could you show some code/ explain farther? sorry if its a dumb question I'm still a bit of a novice at java.Yeah.
    object yuck = (object) e.getComponent(); // That's a cast.
    boolean yucksR = yuck.r; // Get the "r" variable from the object.

  • How can I get the context-parm from a web.xml file using struts?

    Hello:
    I need get the context-param from the web.xml file of my web project using struts. I want configurate the jdbc datasource connection pooling here. For example:
    <context-param>
    <param-name>datasource</param-name>
    <param-value>jdbc/formacion</param-value>
    <description>Jdbc datasource</description>
    </context-param>
    and then from any Action class get this parameter.
    Similar using a simple server can be:
    /** Initiates new XServlet */
    public void init(ServletConfig config) throws ServletException {
              for (Enumeration e = config.getInitParameterNames(); e.hasMoreElements();) {
                   System.out.println(e.nextElement());
              super.init(config);
              String str = config.getInitParameter("datasource");
              System.out.println(str);
         public void doPost(HttpServletRequest req, HttpServletResponse res)
              throws ServletException, IOException {
              // res.setContentType( );
              System.out.println("Got post request in XServlet");
              PrintWriter out = res.getWriter();
              out.println("nada");
              out.flush();
              out.close();
    but only this works for init-params, if I use
    <servlet>
         <servlet-name>MyServlet</servlet-name>
         <display-name>MyServlet</display-name>
         <servlet-class>myExamples.servlet.MyServlet</servlet-class>
         <init-param>
         <param-name>datasource</param-name>
         <param-value>jdbc/formacion</param-value>
    </init-param>
    </servlet>
    inside my web.xml. I need something similar, but using struts inside the action class for that I can get the context-params and call my database.
    Thank you

    To get context parameters from your web.xml file you can simply get the ActionServlet object from an implementing action object class. In the perform (or execute) method make the following call.
    ServletContext context = getServlet().getServletContext();
    String tempContextVar =
    context.getInitParameter("<your context param >");

  • How can I get the example fonts from the font file Programmatically?

    Hi Friends,
             I am doing one mac application for the fonts management. Now I would like to Preview the Font in the NSTextView.  This is my coding for the textView.
        NSTextView *text3=[[NSTextView alloc]initWithFrame:NSMakeRect(250,500,450,30)];
        [text3 setString:@"ABCDEFGHIJKLMNOPQRSTUVWXYZ"];
        [text3 setFont:[NSFont fontWithName:@"GangofThree" size:40]];
        [[[self window] contentView] addSubview:text3];
    Because I have set the string in English for the NSTextView I can't able to view the other languages characters.I got the character set of the font file by using this code.
       NSCharacterSet *characterset = (NSCharacterSet *) CTFontCopyCharacterSet (fontRef);
    This Font is greek font.Now My question is how can I able to get the greek characters from this characterset.

    Your text string would certainly have to be in Greek itself, not Latin.  No normal font just translates Latin letters to Greek, they use other codepoints reserved for Greek letters.

Maybe you are looking for

  • Select-option in ABAP objects

    Hi Guys,            I need a small help from you. I want to know how to populate the value from select-option to abap object. Please help me, it is very important

  • BAPI/FM to change scheduling agreement's delivery status.

    Hi All, I have to check  "Delivery completed" indicator of scheduling agreement. I tried using BAPI_PO_CHANGE but it returns the message below: "Not possible to process a scheduling agreement using this function" Is there any other BAPI or FM to chan

  • Customization in Advanced Search Area.

    Hi All, There is a requirement in advanced search area of return orders. Based on the transaction type selected, corresponding status values has to be populated. Here im populating the transactio type values in the drop down list box and status value

  • Connection slows down

    When I do a speedtest on my Macbook I can get around 10 mbs d/l. Comcast. If I go online for some time and stream some video the speed with drop to around 1 mbs. I have to turn off/on the wifi and it reconnects and is back up to around 10 mbs. Any th

  • Media file path in IP IVR - Run external VRU script

    Hi all, I am configuring ICM script by using run external vru script which is located in IP IVR server. But, I am not sure how pass media file path from ICM script to VRU script. Last time, I used  IVR version 7.0. I set the path such as: c:\MediaSer