JS CS4 splitting the document path

I'm trying to split the document file path so I may navigate up one or two folders and then into a specific subfolder.
When I try to split the "myDoc.filePath" it errors. If I split "myDoc.name" it works correctly.
var myDoc = app.activeDocument;
var myDocPath = myDoc.filePath;
var mySplit = myDoc.name.indexOf ("_");
var myFileName = myDoc.name.slice (0,mySplit);
var myPdfFolder = myFileName + "pdf";
var mySavePath = myDocPath
var mySplit2 = myDoc.filePath.indexOf (myFileName);
var myFinalPath = myDoc.filePath.slice (0,mySplit2) + myFileName + "/" + myPdfFolder;
alert(myFinalPath);
Can someone shed light on how to split the document path?
Thanks,
John
Document path: ~desktop/N123456/working/N123456_01
Note: the last folder name does not always exist. Often the "working" folder is the last folder. Working folder and N123456pdf reside on the same level.
Goal is to change the save to document path: ~desktop/N123456/N123456pdf

Here's some code I wrote recently to find a folder named "Snippets" starting from the location of a document. It first looks in the same folder and then its parent and on up until it reaches the top of the file hierarchy:
//DESCRIPTION: Search for Snippets folder from Document location
(function() {
    if (app.documents.length > 0) {
        var myFolder = locateRelatedFolder(app.documents[0].filePath, "Snippets");
        if (myFolder == null) {
            alert("Unable to locate Snippets folder");
            return;
        } else {
            alert("Snippets folder is: " + myFolder);
    function locateRelatedFolder(folder, name) {
        while (folder != null) {
            var relatedFolder = Folder(folder + "/" + name);
            if (relatedFolder.exists) return relatedFolder;
            folder = folder.parent;
    } // end locateRelatedFolder
I've enclosed the code in an anonymous function. Don't let that put you off. You could just delete the first line after the description and the last line.
Dave

Similar Messages

  • How to get the document path of the pictures uploaded for products?

    Hi Gurus,
    How to get the document path of the pictures uploaded for products uploaded through tcode COMMPR01?
    Many Thanks,
    Neeraj

    client path.
    I need to get the client path in order to download files form server to client.
    Best regards,
    Huy.

  • An error occurred: Save document failed / An error occurred while saving the document: PATH (HDB 00055)

    Hello Colleagues, I am creating an analysis in build 576, everything goes well, the algorithm calculates the needed values, but when I try to save the analysis, I receive the following error message: "An error occurred: Save document failed / An error occurred while saving the document: <PATH> (HDB 00055)".
    Does anyone know what could cause this error message?
    Thanks a lot for any hint.
    Sergey

    Hi Henry,
    I am using PA 1.0.11 and received this error; any update on this fix for SAP PA. Does this happen for a particular data source.
    I am currently using Excel as source and whenever I try to use this data; I get this even if I move the data to a new file or rename a file. I tried to check the same issue with a different file and it works fine. This file worked fine a day back.
    Please let me know if this is unusual for this version.
    Regards,
    Arvind E

  • Split the document

    Hi All,
    I have designed a 50 pages catalog in Indesign and want to send the pdf file to the printer, Our printer recommends PDF-X:1a files with trapping. I have made the X-1a pdf (includes all 50 pages) but our printer needs 1 page or spread per pdf for imposition. if I split the document in Acrobat 9 Pro, a warning dialogue box appears which says you will be not longer with PDF-X1A after split, is there any option to stay with X-1a standard after split...otherwise I have to make pdf manually for per page to maintain the X-1a standard. I am using postscript for trapping and using Distiller with PDF-X:1a setting with that Postscript file.
    Thanks in advance

    You can use preflighting to bring the file/page back into compliance. But I think the printer is being unreasonable. If you give him a pdf file that is in compliance, he/she should be able lot use the file for imposition purposes---even if it means he/she has to split the file pages. Who is working for whom?

  • Need to split the document in 950 line iteam record in LSMW

    HI ALL,
    I am posting documents using LSMW  for Tcode FB01. But some documents having more no of line items like 1000.
    But SAP will allow only 950 line tems for each documents. In this sistuvation we need to split the data as 950 and 50. we need to post 2 different documents with same header data.
    <removed by moderator>.
    regards,
    srikanth
    Moderator message: please do not ask for documents being sent to you directly.
    Edited by: Thomas Zloch on Nov 15, 2010 2:18 PM

    There are a couple of things you can do:
    instead of posting the individual line itame detail, post summary items.
    Create a dummy offset account. Total the first 950 items and post the remainder to the offset. Then do the same for the remaining items. The total to the offset will be zero.
    If you search the forum, you will find more details on this.
    Rob

  • Show the document path in a search

    Hello,
    I´m doing many test serching documents and I want to display the differents paths of the folders or documents of the search (like we can do with the Tooltip setting option = path that displays the resouce path as a tooltip).
    How can I do this?
    My SearchResourceRenderer settings are:
    Resource Renderer: ResourceRenderer
    TooltipSetting: path
    ShowResourcesProperties: all
    Child Folder´s Style: standard
    Mode for child count: folders/filters
    Visible Properties: contentLink
    Target Window type: linklist
    Command Display: link
    Resource Command Group:  SearchSingleItemGroup 
    Folder Command Group:   SearchSingleFolderGroup
    Link Command Group:  SearchSingleItemGroup
    Thanks in advance,
    Esteban

    Hi Robert,
    First of all, thank you very much for your help.
    I´ve added "rnd:path" in the Display Properties parameter of the StandardSearchResultRenderer. Now, when I search a file older the result is still only the file older without their paths. However, when I click into these folders I can see their path and more information utilities like "search from" or "details" each.
    Why I can´t see this information from the beginning of the search?
    Thanks again!
    Esteban

  • Oracle OAF Find the Document Path Using JDR Tables or JDR_UTILS API

    Hi,
    I found duplicate records in JDR_PATHS table for a Particular OAF Page. I need to find the complete path of these documents,so that i can delete the one which i don't want
    using the jdr_utils.deletedocument.
    Appreciate it if anyone can advise on how to identify the paths for the a page so that I can delete the document I do not want.  Any other ideas to delete the extra document would be welcome.
    Thanks
    Sai

    Sai,
    Duplicate records in JDR_PATHS does not mean they are duplicate records, page names may be same.
    But the hierarchy of the page is different, don't be in a hurry to delete the document.
    try to find the information from this :
    Learn Oracle Applications With Me: MDS in Oracle Applications, OAF
    Regards
    Sridhar

  • Is it possible to split the same document, Word-style?

    I don't know what else to call it. In Word, it was "split."
    I often edit two parts of the same document simultaneously, but in Pages 08, I haven't been able to figure this out. "Two Up" is not what I'm looking for.
    For example, what I would do in Word was KS ("keyboard shortcut to") split the document, KS half the document to another page (Go To), KS copy information from one part of the document, KS to the other half of the document and paste/modify... in essence, I was editing two parts of the document without touching the mouse.
    It saved a LOT of time. Any help here? I've checked the Pages 08 PDF manual. Naming the software "Pages" was also kind of stupid, because Google searches come up with everything BUT software hits. I have the same issues with Numbers... kind of problematic naming conventions.
    lol reminds me of the band "Live." Before I knew their music intimately (and members' names), they were impossible to find interviews for and run searches on...

    Unfortunately, no, & it still isn't available in iWork '09. I didn't use it too often in AppleWorks, but it was very handy to have. Another "missing" feature is the ability to have two windows of the same document open at once. I suggest you leave feedback for the Pages team regarding this. You can find it under the Pages menu > Provide Pages Feedback. That takes you to the same page as this link.

  • Split a document created by FBV1

    Hi all.
    I have a problem in post documents. I have a program which get a file with many lines, one line has account key 50 and next line has account key 40 and so on in every lines of file. The program calls transaction FBV1. When I execute the program in production client, program creates many documents, for example, if file has got 40 lines, 20 documents are created, with account key 50 (item 1) and 40 (item 2). But when I execute the program in test client, it creates a document with all lines of file (40 ítems).
    Programa is the same in both clients, and data are filled in the same way. I think the difference is when program does the call transaction 'FBV1'.
    Do you know some customizing point where the format document can be customized, and perhaps in my system, it is done in production and it isn't in test client?
    Thanks a lot.
    Marta.

    HI Marta
    If the program is a custom program, could you check if the version in both the systems are same?? Seems like your production system program has some condition to split the documents.
    Regards
    Sowmya

  • How to split XML document into two

    I want to create new docuemnt by taking part of the existent XML document under the node document_text
    vNodeList := xmldom.getElementsByTagName(vdoc, 'document_text');
    vNode := xmldom.item(vNodeList, 0); -- The xmldom.getNodeName(vNode) of this node is exactly what i am
    -- looking for
    vdoc:= xmldom.makeDocument( vNode);
    insert into cltab values (empty_clob()) returning cl into cl;
    xmldom.writeToClob(vdoc_txt, cl);
    But after that i am still getting the whole document tree, - copy of the whole document.
    What am i doing wrong? What functions should i use for this kind of task? xmldom.clonenode?
    Could you recommend any good description of the xmldom package?
    Thanks,
    Roman

    If you are using an FI  entry F-43 to generate invoice this can be done by giving the same invoice ref. in the Inv. Ref. field  for two vendors. This is manual
    Document Split will split the document between two profit center and not between vendors.

  • HT2506 I am trying to convert  word document to a PDF but only half the document accurately converts. Is there a way to fix this?

    I am trying to convert  word document to a PDF but only half the document accurately converts. Is there a way to fix this?

    I have found that complicated document structures causes Word to split the document into parts, but I've always gotten the whole thing, in multiple documents.
    However, with two pages, I can't imagine it is that complicated.
    Any odd fonts or paragraph styles?

  • Split a Document

    Hi all ,
    I would slit a Document in pages........
    I tried Using get Text but it returns a string and i lose the character info..........
    Need help
    thank's

    HI Marta
    If the program is a custom program, could you check if the version in both the systems are same?? Seems like your production system program has some condition to split the documents.
    Regards
    Sowmya

  • Retrive document path from R/3 system

    I'm trying to retrive the document path (FILEP) from DRAW table in r/3 system to be displayed in my report
    i'm using remote cube and all other column are displayed perfectlt but when i choose this (FILEP) I'm getting the following error.
    <b>Error value "(hex.") of characteristic contain invalid characters</b>
    Hope someone give me a hand on this
    thank you in advance

    many BW systems have 'ALL_CAPITAL' written in the RSKC tcode.I believe it allows capital letters of all languages.
    goto tcode RSKC..
    u might already see a list of characters there.
    Just add '\' at the end of the string.Dont put comma or a blank.
    Then click on save.then click on execute.
    now try to reload data.I think it will go GREEN.
    cheers,
    Vishvesh

  • In MIRO transaction, Where will be the image path get stored?

    Dear Friends,
    In MIRO transaction, Where will be the image path get stored?
    There must be some standard tables/functionality which is maintaining PATH. Please help me to find out the Document Path Details..
    Thanks in Advance.
    Regards,
    Lijo

    Hi,
    this is the content of the oss note (hope it helps):
    Symptom
    Where are the documents that you can create and display using the generic object services (System -> Connections or System -> 'Services for the object') physically stored?
    Solution
    Storing attachments using generic services
    The generic object services offer a separate option via the 'Copy desktop document', 'Connect Internet address (URL)' and 'Create a note' services to add an attachment to a business document.As of Release 4.6C, these services are called 'Create attachment', 'Create an external document (URL)' and 'Create a note'.
    These services should enable the end user to easily enter attachments without document characters (memos).Correspondingly, there is no archiving concept for this type of attachment.
    Technically speaking, notes, PC attachments and URLs are treated as SAPoffice documents and result in corresponding entries in the SOOD and SOFM tables. The contents of the attachments are stored in the SOC3 table.As of Release 4.6B, the contents of PC attachments are stored using the Knowledge Provider (KPro).The KPro allows you to connect an external storage system so that the contents of the PC attachments no longer place a burden on the database. If an external storage system is not connected, the contents of the PC attachments are written to the SOFFCONT1 table as of Release 4.6B.The administrative information necessary to locate the document in the Kpro is in the SOC3 table.
    The content of notes and URLs continues to be stored in the SOC3 table.As these documents are usually small, the additional effort involved in storing them in the KPro is not justified.
    If the PC attachments are not to be stored in the SOFFCONT1 table, you must assign a category to the SOFFPHIO document class using transaction SKPR08. The category is created in transaction OACT and refers to a repository on a HTTP content server. If documents that have already been stored are to be moved to the content server, see note 389366.
    For more information on connecting an external Content Server, see the online documentation for the SAP Knowledge Provider or the information available in the help portal under Basis -> Basis Services -> Business Workplace -> Administration of... -> Information on Documents... -> Configuring an HTTP Content Server for Documents.
    The relationship between the attachments and the business documents is provided via the Object Relationship Service.
    Defining attachments using the archive link
    If an optical archive was connected using the archive link and the corresponding settings for the document type were maintained for the object types of a business document, documents can be stored in the Content Repository, directly from the PC, via the 'Establish relationships for the stored document' or 'Store the business document' service.
    In addition, refer to the online documentation for more information on configuring the archive link.
    Best regards.

  • I am trying to split a document into multiple files and it won't let me

    I have opened my file in Adoble Acrobat Pro, for which I have a year subscription, and the option to split the document is gray (not applicable).  Why would this not be an option?  This file contains multiple docs that were merged into one for ease while emailing.  Now I need to split them back up.  Shouldn't I be able to do this with Acrobat Pro?

    Hi adminkg&a,
    It sounds like the file may have security applied to prevent alteration. Do you see "Secured" in the document's title bar?
    Best,
    Sara

Maybe you are looking for

  • Scheduling Agreement - Backorder

    Hi Gurus, Please suggest if back order concept has relevance with respect to scheduling agreement.  We use Scheduling agreement and the configurations are set that system does backward scheduling only and always the system confirms the schedule lines

  • I see a AppleSyncNotifier.exe - Entry Point Not Found error when my PC starts.

    when booting up my computer, even before I try to bring up itunes, I get the following error message: AppleSyncNotifier.exe - Entry Point Not Found the procedure entry point ___cfconstantstringclassreference could not be located in the dynamic link l

  • DTD Repository in Oralce 9i

    Hi I'm trying to build a dtd repository to store, manage, and view all our dtds. I'm also using XML Spy, so converting the dtds to another format is not a problem. Any suggestions? Thanks.

  • HR strutural Authorization check in the Lean order Interface (LORD)

    Hi , We place Quotations , Orders in CRM 7.0 , via the Lean order Interface Screen (LORD) . So users in ECC have HR structural authorization and they seems to the checked ( for the HR# part of the Sales Team , and comming accross as partner function

  • Css upgrades in CS3

    Hi All, About to redesign or company website. A lot of the site is complicated layouts, we ahve used tables in the past, and css with varying results. Is CS3 more usable / effective in dreamweaver, and do I need to upgrade fireworks to make it work b