Fireworks: How to find document index for scripting?

Can anyone share a simple method for obtaining the document index of an active Fireworks document, within the array of open documents? Normally, the current document is accessed by using fw.getDocumentDOM(), but I'd like to obtain the actual array index value (e.g., 0, 1, 2, 3, etc.) to use elsewhere in a script.
I've created a function to obtain this index value, but it's ungainly: It compares entire DOMs that have been converted to source. This requires too much memory or processing and nearly brings the script to a halt. I need something simpler.
var dom = fw.getDocumentDOM();
function documentIndex() {
    if (fw.documents.length == 1) {
        return 0;
    else if (fw.documents.length > 1) {
        var i = 0;
        for (i = 0; i < fw.documents.length; i++) {
            if (fw.documents[i].toSource() == dom.toSource()) {
                return i;
                break;
I've considered using a document property like docTitleWithoutExtension, filePathForRevert, or filePathForSave as a basis for comparison between documents, but these are unreliable: They won't work if the documents in question have have not yet been saved. 
I figure there must be a simple method, I just don't know what it is.

In case anyone's interested, here's the workaround I'm now using to find the position of an active Fireworks document within the array of open documents (a.k.a., the document index). I'd still love to hear from anyone who can suggest a simpler method.
The basic idea is to first look at two properties of the active document—docTitleWithoutExtension and filePathForRevert—and, where possible, compare those values to that of the same properties within each open document. On their own, each property has loopholes, which is why I'm combining them. (For example, it's possible to have two documents with the same title—if they have different extensions or file paths. Likewise, it's possible to open multiple copies of an unsaved document, all with the same filePathForRevert value.)
New or untitled documents demand an entirely different criteria. I'm not crazy about this approach, but it seems like the best option at this point: When you can't find a DOM property to reliably distinguish one document from another, you temporarily write a distinctive value into a property of the document you want to find. Think of it like tagging a wild animal. In this case, when the active document lacks both a docTitle and file path, I write a crazy piece of "alt text" gibberish into the defaultAltText property and use that to identify my active document. (Even though I'm taking care to restore the original "alt text" afterwards, I don't love this method... but it seems to work.)
var dom = fw.getDocumentDOM();
function documentIndex() {
    if (fw.documents.length == 1) {
        return 0;
    else if (fw.documents.length > 1) {
        var docTitle = dom.docTitleWithoutExtension;
        var filePath = dom.filePathForRevert;
        if ((docTitle != "") && (filePath != null)) {
            var i = 0;
            for (i = 0; i < fw.documents.length; i++) {
                if ((fw.documents[i].docTitleWithoutExtension == docTitle) && (fw.documents[i].filePathForRevert == filePath)) {
                    return i;
        else {
            var originalDefaultAlt = dom.defaultAltText;
            dom.defaultAltText = "toRtoiSeOfThEsLowAcoRnsRejoiCe";
            var i = 0;
            for (i = 0; i < fw.documents.length; i++) {
                if (fw.documents[i].defaultAltText == dom.defaultAltText) {
                    dom.defaultAltText = originalDefaultAlt;
                    return i;

Similar Messages

  • HOW TO FIND T-CODES FOR SCRIPT FORMS?

    HI EVERY BODY,
    "ME9F" IS THE T-CODE FOR PRINTING "MEDRUCK" FORM ALONG WITH THE DATA FROM PRINT PROGRAM.
    LIKE WISE WHAT ARE ALL THE OTHER T-CODES FOR SAP PROVIDED FORMS. PLEASE LET ME KNOW HOW TO FIND THESE T-CODES?
    THANKS IN ADVANCE,
    REGARDS,
    MOUNIKA.

    Hi Mounika,
    Please check this transaction as well.
    ME9A  - Message Output: RFQs                 
    ME9E  - Message Output: Sch. Agmt. Schedules 
    ME9F  - Message Output: Purchase Orders      
    ME9K  - Message Output: Contracts            
    ME9L  - Message Output: Sched. Agreements    
    PJNA  - Message Output                       
    WLN14 - Message Output Agency Documents      
    WLN15 - Message Output for List Documents   
    Hope this will help.
    Regards,
    Ferry Lianto

  • How to create a Index for KM documents

    Hi Experts.......
    I have two queries .
    1,How to create a Index for the KM Server documents so that when ever i am in need of particular document,i can be able to retrive the exact document within short time......
    2,What Is TREX? Need of TREX ?
    If any one have documents for the above said queries kindly send it to [email protected]
    Thanks in Advance,
    Jasmine

    Hi Jasmine,
    1.In the EP 6.0 you can create index System Administration -> System Configuration -> Knowledge Management -> Index Administration
    2.TREX is search engine that will proccess the documents that you have specified in the index Data sources when you have created the index.
    The status of TREX you can see in System Administration -> Monitoring -> Knowledge Management -> TREX Monitor or Index Monitor for indexing monitoring.
    If you don't have connected any TREX engine to J2EE, just start the visual administrator and configure the TREX service.
    To install the TREX you can follow the instguides for TREX service.sap.com/instguides SAP Netweaver->Release 04 or 2004s -> Installation -> Cross-NW
    I hope that it helps.
    Bye
    Dan

  • How to find condition  type for a particular material document no.

    hiiiiii
    How to find condition type for a particular material document no.

    Hi
    Condition types are maintained at PO level
    Take the EKKO-KNUMV and pass to
    KONV-KNUMV field and take the different condition types values from KONV
    Take the Material Document No (MBLNR) and pass to MSEG table and take the EBELN field and from EKKO table take EKKO-KNUMV field and pass to KONV
    see the table T685 for different condition types.
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • How to find Document flow / Relationships to a support message

    Hi Friends,
    I am new to Solution manager. I would like to know how to find Document flow of a Support message.
    For example I have a Support message, there are few Change requests and tasks linked to it. This can be viewed from CRMD_ORDER transaction (Where used list button / Document flow), preceding documents and related documents.
    Is there any function module or table where I find the link between these different transaction types or atleast any report!
    Thanks in advance

    Hello Sesagiri,
    Can you explain the process to link support message with change requests and tasks.
    pls help me.
    Regards,
    Babu

  • Can you give a document link for script logic for NW version7??

    Hi all,
        who can give a document link for script logic for nw version7??
        thanks in advance!!

    Hi Sheldon,
    I read through your "HOW to...Custom BADI for replicating Destination_App...." and it was great. However, Can this call also be used with WHEN/ENDWHEN statements? In the MS version, when using Destination_App, I was also able to map source accounts into the correct destination accounts as well as source E type dim to desination E type dim with the following script (the mapping to destination ID was stored as properties within the source dimensions).
    *INCLUDE SYSTEM_CONSTANTS.LGL     
    *SELECT(%OPACCT%, "[ID]", "OPACCOUNT", " [TRF_FPA] = 'Y'")
    *SKIP_DIM = COSTCTR
    *ADD_DIM = BRANDS
    *RENAME_DIM OPAccount = Account_F
    *RENAME_DIM CATEGORY = CATEGORY_F
    *RENAME_DIM ENTITY = MARKET
    *RENAME_DIM DATASRC = DATATYPE
    *XDIM_MEMBERSET ENTITY = %ENTITY_SET%
    *XDIM_MEMBERSET CATEGORY = %CATEGORY_SET%
    *XDIM_MEMBERSET TIME = %TIME_SET%     
    *XDIM_MEMBERSET OPACCOUNT = %OPACCT%
    *DESTINATION_APP = FPA
    *CLEAR_DESTINATION
    *DESTINATION OPACCOUNT = %OPACCT%
    *DESTINATION TIME = %TIME_SET%
    *DESTINATION CATEGORY = %CATEGORY_SET%
    *DESTINATION CURRENCY = LC,USD
    *WHEN ENTITY
    *IS %ENTITY_SET%
    *REC(ENTITY=COSTCTR.FPA_MKT,OPAccount=OPAccount.Consol_FPA)     
    *ENDWHEN     
    *COMMIT
    I have tried the following code in the NW version, and it won't validate. Do you know if there's a way to achieve this?
    *XDIM_MEMBERSET CATEGORY<>ACTUAL
    *XDIM_MEMBERSET ACCOUNTHR =BASE_ANNL_SAL,BONUS,BENEFITS_TAX
    *XDIM_MEMBERSET CURRENCY=LC
    *START_BADI DAPP
    DESTINATION_APP=CC_PLAN
    RENAME_DIM="ACCOUNTHR=ACCOUNTCC"
    WRITE=OFF
    *END_BADI
    *WHEN ACCOUNTHR
    *IS "BASE_ANNL_SAL","BONUS","BENEFITS_TAX"
    *REC(ACCOUNTCC=ACCOUNTHR.CCPLANACCT)     
    *ENDWHEN
    Regards,
    Karen

  • How to find the Ranges for a field ?

    Hello All,
               Can anyone tell me how to find the ranges for a field.
    <b>1</b>, i.e say I want the Ranges Structure for the field LIFNR.
        The ranges structure for this is "<b>RANGE_LIFNR</b>".
        This I used in my Program since I know it previously.
        But now I want the ranges structure for the field <b>VBELN (Delivery Document).</b>
        I  don't know what is it !!!!!
    <b>2</b>, Is there any procedure to know the ranges structure for a particular field ?
    Regards,
    Deepu.K

    Hi Deepu,
    Using 'Where used list' you can able to find out RANGES tables.
    For VEBLN range table is --> CRM_AC_ASSIGN_VBELN
    If you using a program defined as shown below.
    DATA: r_vbeln type ranges of vbeln.
    The above statement also creates ranges structure in Runtime.
    Procedure finding range table structures
    go to SE37 -> Enter domain or dataelement value
    Go to where used list --> search for 'Structures'
    After getting all structure  --> Click 'SEARCH' butoon in tool bar --> Search for 'RANGES' word
    You can get all ranges tables in the search window
    If helps plz reward points.
    Regards
    Bhupal Reddy

  • How to find Object name for a object?

    Hi Experts,
    How to find Object name for a particular Object? Is there a Tcode for it?
    __Like Object name for__
    Material number -  materialnr
    Goods receipts / return - matbeleg
    Accounting documents -  rf_beleg
    How to find Object name for other Objects? Is there a particular way?
    Thanks & Regards
    Chandan

    Hi,
    You can find objects in SNRO transaction.
    In SNRO search by giving long text...
    for eg., Service .. for service entry sheet. keep the first letter in capital letter only.
    Thanks & Regards,
    Anand.

  • How to find all APIs for AOL Module

    Hi Friendz,
    Can anybody please tell me the API for Request Group.
    Also how to find the APIs for different Screens in AOL like creating Form Functions,Forms,Menus,Responsibilities,Value Set,Value Set Names,Securing attributes etc.,
    I have tried with this URL, http://irep.oracle.com/index.html
    but page is displaying error.
    Suggest me other option.
    Can i get this through metalink
    Regards,
    Uma Jayakumar

    may be the link is broken for time being..that is the best link for APIs.
    have a look at the following this might help you.
    http://download-east.oracle.com/docs/cd/B25516_11/current/html/docset.html
    Regards
    Prashant Pathak

  • How to find the SteroMixer for my HP TouchSmart PC

    I just need to know how to find the SteroMixer for my HP TouchSmart. I did read previous concern and also followed the steps but under my hardware it shows this HDAUDIO\FUNC_01&VEN_11D4&DEV_194A&SUBSYS_103C2A8E&REV_1004 and this HDAUDIO\FUNC_01&VEN_11D4&DEV_194A&SUBSYS_103C2A8E.
    I just need to know which do I use so that I will be able to add music to the CamStudio... 
     

    Maybe this helps.
    http://h10025.www1.hp.com/ewfrf/wc/document?docname=c01461692&cc=us&dlc=en&lc=en
    or try them here.
    http://h30434.www3.hp.com/?lc=en&cc=us
    http://answers.microsoft.com/en-us/windows
    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

  • How to find Table names for PO & Invoices in SRM Standalnoe system SRM 7.0?

    Hi,
    How to find Table names for PO & Invoices in SRM Standalnoe system SRM 7.0? Please let me know.
    Thanks,
    Monica

    Hi,
    In SRM for all objects like SC ( BUS21210),BID,PO(BUS22010),Confirmation (BUS2203),invoice etc all the data stored
    in BBP_PDHGP and BBP_PDBEI  tables only, These is no separate tables..
    for your reference below are the few SRM tables
    BBP_PDACC  Account Assignment 
    BBP_PDATT  Document Attachment 
    BBP_PDBEH  Backend Specific Header Data 
    BBP_PDBEI  Backend Specific Item Data 
    BBP_PDBGP  Partner Extension Gen. Purchasing Data 
    BBP_PDBINREL  Transaction Object Linkage (EBP) 
    BBP_PDHCF  Set for Tabular Customer and Solution Fields on Hdr 
    BBP_PDHGP  Business Transaction Purchasing Information 
    BBP_PDHSB  Bid Invitation 
    BBP_PDHSC  Header Extension for Customer Fields 
    BBP_PDHSS  Hdr Extension for SAP Internal Enhancements (IBUs and so on)
    BBP_PDICF  Set for Tabluar Customer and Solution Fields on Itm 
    BBP_PDIGP  Business Transaction Item-Purchasing Information 
    BBP_PDISB  Bid Invitation/Bid-Specific Item Data 
    BBP_PDISC  Item Extension for Customer Fields 
    BBP_PDISS  Item Ext. for SAP Internal Enhancements (IBUs and so on) 
    BBP_PDLIM  Value Limit 
    BBP_PDORG  Purchasing Organizational Unit 
    BBP_PDPSET  Further Procurement Information 
    BBP_PDTAX  Tax 
    CDCLS  Cluster structure for change documents 
    CDHDR  Change document header 
    CDPOS_STR  Additional Change Document - Table for STRINGs 
    CDPOS_UID  Additional Table for Inclusion of TABKEY>70 Characters 
    CRM_JCDO  Change Documents for Status Object (Table JSTO) 
    CRM_JCDS  Change Documents for System/User Statuses (Table JEST) 
    CRM_JEST  Individual Object Status 
    CRM_JSTO  Status Object Information 
    CRMD_LINK  Transaction - Set - Link 
    CRMD_ORDERADM_H Business Transaction 
    CRMD_ORDERADM_I Business Transaction Item 
    CRMD_PARTNER  Partners 
    SROBLROLB  Persistent Roles of BOR Objects 
    SROBLROLC  Persistent Roles of Business Classes 
    SRRELROLES  Object Relationship Service: Roles 
    Thanks & Regards,
    Prasad S

  • How to find serial Number for BCC Plugin?

    Hi,
    How to find serial number for Bcc plugin on FCP?
    I need format my Mac so before that I to find the serial number?
    Please anyone can help me....

    The serial number has the format like E-111-aaa-222-bbb-333-ccc-444-ddd-5ee-ffff, it can be found on a piece of paper which has 3 stickers with it inside the box.

  • How to find function code for buttons on toolbar in oops alv

    Hi experts,
    I want to remove some buttons from toolbar in oops alv, i know the procedure like get function code and pass the value in a table and pass that table to IT_TOOLBAR_EXCLUDING of
    method set_table_for_first_display but I WANT TO KNOW HOW TO FIND FUNCTION CODE FOR BUTTONS ON TOOLBAR IN OOPS ALV

    Hi Prakash,
    -->First you have to set the pf status in your alv program by,
    {FORM pf_status USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'FIRST'.
    ENDFORM.                    "PF_STATUS}
    -->Pass this Subroutine name in the Function module, Reuse_alv_grid_display's parameters i.e,
          i_callback_pf_status_set          = 'PF_STATUS'}
    *-->Then doble click on that pf status,
    From the menu bar, select Extras->Adjust Template->List Viewer,
    This will give you the existing statndard gui status of the program*
    ->Then catch that function codes in the User command Parameter of the Function module Reuse.. i.e,
          i_callback_user_command           = 'COMM'
    And make a subroutine of the name 'COMM'i.e,
    FORM comm USING ucomm LIKE sy-ucomm selfield TYPE slis_selfield.
      DATA: okcode TYPE sy-ucomm.
      okcode = ucomm.
      CASE okcode.
        WHEN 'REF'.
        CALL FUNCTION 'POPUP_TO_INFORM'
          EXPORTING
            titel         = 'MANSI'
            txt1          = 'CREATED BY'
            txt2          = SY-UNAME
          TXT3          = ' '
          TXT4          = ' '
    endcase.
    Hope it helps you
    Regrds
    Mansi

  • How to find workarea ID for the work area name.

    Hi Experts..
    How to find workarea ID for the work area name.(Work area name CCIHT_WAH-WAID and I want to fetch characteristic data from table AUSP matching the OBJEK field,but I only have Work area name).Can anybody help me to find tables or relationship between Workarea ID and Workarea name for the same.I am using TCODE - CHIB02.Once I select a workarea and click on IHS Data button,I get data for that workarea.I need to find where this data comes from and How is this fetched.
    Points would be rewarded for helpful answers..
    Thanks
    Kunal Halarnakar

    U want to fetch the workarea description ?
    we can fetch it from CCIHT_WALD table with the RECN value.
    The informations are stored in AUSP table with the characterstic(ATINN) value.

  • How to find print preview for purchase order like what we find in va03

    hi guru's
    how to find print preview for purchase order like what we find in va03
    let me share ur information
    thank u

    Hi
    You can see the Print Preview/printout etc using the Transaction ME9F for Purchase Order
    Execute the ME9F tcode and execute you will get lot of PO's select any Po and press display message
    you will see the print preview
    Similarly for RFQ output use the Tcode ME9A
    for Contrat use ME9K
    for GR output use MB90
    Reward points for useful Answers
    Regards
    Anji

Maybe you are looking for