File path returning NaN

Hello!
I'm currently involved with a project that requires analysis of images from several hundred stations along the Alaskan seafloor.  Each station has three top down (PV) images of the seafloor taken and three images (SPI) that are taken below the seafloor (it's pretty cool).
It is often necessary to compare the SPI and PV images side by side in order to make a proper assessment of the seafloor at each station.  I find myself opening the SPI images most often and then needing to dig around in the PV folder to find the appropriate image pairings.  This can be time consuming so I've decided to write a script that will query my active document for a name and path and then use that information automatically open up its counterpart.
I'm close to getting it working but I keep returning an error that says "error opening NaN/PV/CH_PV_Analysis/CH-14B1-PV-41-a.psd".
The error returns a perfect file path from "/PV/" onward but for some reasons begins the path with "NaN" when it should pull my file path.   Why is this?  I'm using the same line of code for another automation script on this project and can't seem to figure out why it's behaving differently here. 
I should mention as well that I'm accessing the files via a server.
My code looks like this:
// call the current document
var srcDoc = app.activeDocument;
// ask user input for PV replicate letter
var repLetter =prompt("Which PV replicate would you like to open? (A.. B.. C.. etc.)");
// get the info out of the source doc
var fileName = srcDoc.name;
var docName = fileName.substring(0,fileName.length -4);
var filePath = srcDoc.path.toString();
var fileExt = fileName.substring(fileName.length -4, fileName.length);
var nameCheck = fileName.substring(0,fileName.indexOf("CH-14B1-SPI-"));
if (nameCheck <1)
   var fileNum = fileName.substring(12,fileName.length -5) + repLetter;
   // no underscore so we need to open it's namesake
   // alert(nameCheck)
   var filePair = filePath -"/SPI/CH_SPI_Analysis/" + "/PV/CH_PV_Analysis/" + "CH-14B1-SPI-PV-" + fileNum + fileExt;
   openThisFile(filePair)
function openThisFile(masterFileNameAndPath)
var fileRef = new File(masterFileNameAndPath)
if (fileRef.exists)
//open that doc
    app.open(fileRef);
else
    alert("error opening " + masterFileNameAndPath)

var filePair = filePath -"/SPI/CH_SPI_Analysis/"
should probably be
var filePair = filePath + "/SPI/CH_SPI_Analysis/"

Similar Messages

  • Trying to return filename, not file path

    I'm trying to set up an automator app that will create a folder with a matching name to the input. I was able to find an Applescript (below) which copies the file path to the clipboard. I can get the rest of it to work, if I can figure out how to copy only the filename and not the entire path.
    on run {input, parameters}
              set thePath to quoted form of POSIX path of input
              do shell script "basename " & thePath
      set the clipboard to the result
              return input
    end run
    My appologies if this is obvious or if I'm going about it the wrong way, I know nothing at all about AppleScript. Any help that anyone can give will be appreciated. Thanks

    on run {input, parameters}
            set thePath to quoted form of POSIX path of input
            set theResult to  do shell script "basename " & thePath
            set the clipboard to the theResult
            return theResult
    end run
    I think you want the applescript to return the basename of the path you pass.
    I made the changes to do this.  I have not tested the applescript.  If you do not want the result on the clipboard get rid of:
    set the clipboard to the the_result
    Robert

  • Search c:\ drive and return file path for winword.exe and save as variable

    Hi all, here is what I'm trying to do;
    1. Search C:\ drive for winword.exe
    2. take the file path and save it as a variable.
    3. Then based on the path value, use the switch statement to run "some command" 
    Essentially I'm trying to find what the file path for winword.exe is, then run a command to modify the registry.  I already have the script that will modify the registry like I want but the problem it, the path is hard coded in the script, I want to
    now look for all versions of word and set the right file path so I can make the right registry changes.

    This should get you started:
    http://ss64.com/ps/get-childitem.html
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • Error 7: File not found occurs in 8.2 from transition of 4.1. Specifying the file in file dialog returns error although file is in the directory.

    Copied a program from 4.1 to 8.2 recently and receive an error 7: File not found at open file+.vi.  The program is built so a file dialog will pop up and ask for the destination of the file.  Eventhough there is a file in the specified directory, an error is returned.  Running open file+.vi by itself returns no error with the same file designation.  Any clues?

    noviceak,
    Welcome to the NI Discussion Forums.
    I created a quick VI in LabVIEW 4.1 that displays a file dialog and then passes that file path to "Read Characters from File.vi" (which in turn calls Open File+.vi).  I then opened this file in LabVIEW 8.2 and ran it successfully (see code screenshot below).
    When you say there is a file in the specified directory are you using the file dialog to browse to the directory or to select the specific file?  Open File+.vi expects the path to a file rather than a directory - that is C:\folder\file.txt rather than C:\folder.  You might also want to create an indicator or probe to see what path is being passed to Open File+ to ensure it is what you expect.
    I feel like I should also say that in the days (years) inbetween LabVIEW 4.1 and 8.2 the file operation VIs have changed significantly.  While the old Open File+.vi still lives in vi.lib for compatibility purposes we no longer recommend using it for new applications.
    I hope this helps and again, welcome to the community.
    Regards,
    Simon H
    Applications Engineer
    National Instruments
    http://www.ni.com/support/
    Message Edited by Simon H on 01-18-2007 08:01 PM
    Message Edited by Simon H on 01-18-2007 08:03 PM
    Attachments:
    LV4 File Dialog.png ‏3 KB

  • "File file path:to:file is already open" how do i close it?

    I am trying to write a script that pops up a dialog box, asks for text and saves this to a .csv and a .txt This is so i can quickly record what i am doing and the times i am doing it, makes quick notes and various things like that. However it is failing with the message "File file path:to:file is already open" so how do i close the file or get around this. Cheers
    Script Below
    tell me to activate
    display dialog "Enter the log message:" default answer "" buttons {"Cancel", "Ok"} default button "Ok"
    copy the result as list to {the log_message, the button_pressed}
    if the button_pressed is not "Cancel" then
    set curTime to (do shell script "date \"+%H:%M:%S\"")
    set curDate to (do shell script "date \"+%Y%m%d\"")
    set new_foldername to curDate
    set this_folder to (path to current user folder) as text
    set fPath2 to this_folder & "Documents:Logs:Date:" as alias
    --set this_folder to "Macintosh HD:Users:username:" as alias
    tell application "Finder"
    if not (exists folder new_foldername of fPath2) then
    make new folder at fPath2 with properties {name:new_foldername}
    end if
    end tell
    set fPath to (path to current user folder as Unicode text) & "Documents:Logs:Date:" & curDate & ":"
    set fName to curDate & ".csv"
    set myFile to open for access file ((fPath as string) & fName) with write permission
    write curTime & "," & log_message & return to myFile starting at eof
    close access myFile
    set fName2 to curDate & ".txt"
    set myFile to open for access file ((fPath as string) & fName2) with write permission
    write curTime & " " & log_message & return to myFile starting at eof
    close access myFile
    end if

    Hi Richard,
    Run this in the script editor:
    set f to choose file
    close access f
    Navigate to the file you left open. Probably there was an error and the file was left open because it never reached the 'close access' command.
    gl,

  • How to get the file path from HTML input form in Firefox3

    In IE7 (and probably all famous browsers, including old Firefox 2), if we submit a file like 'C:\folder1\folder2\folder3\filename' it works properly and gives the full path to the file and the filename.
    In Firefox 3, it returns only 'filename', because of their new 'security feature' to truncate the path, as explained in Firefox bug tracking system (https://bugzilla.mozilla.org/show_bug.cgi?id=143220)
    I have no clue how to overcome this 'new feature'.
    Can anyone help to find a single solution to get the file path both on Firefox 3 and IE7?
    Thanks in advance....

    Doubleposted and ignored any previous answer: [http://forums.sun.com/thread.jspa?threadID=5342405]. Don't do that. It's rude.
    Regarding to your "problem": why do you need the file path?

  • How to get the file path from HTML input form in Firefox 3...

    In IE7 (and probably all famous browsers, including old Firefox 2), if we submit a file like 'C:\folder1\folder2\folder3\filename' it works properly and gives the full path to the file and the filename.
    In Firefox 3, it returns only 'filename', because of their new 'security feature' to truncate the path, as explained in Firefox bug tracking system (https://bugzilla.mozilla.org/show_bug.cgi?id=143220)
    I have no clue how to overcome this 'new feature' because it causes all upload forms in my webapp to stop working on Firefox 3.
    Can anyone help to find a single solution to get the file path both on Firefox 3 and IE7?
    Thanks in advance....

    As you're posting this in the JSF forum and looking at your [previous topic|http://forums.sun.com/thread.jspa?threadID=5342365], I assume that you're using Tomahawk's t:inputFileUpload. In this case, just use UploadedFile#getInputStream(). You may find this article useful: [http://balusc.blogspot.com/2008/02/uploading-files-with-jsf.html].
    By the way, are you lazy or just dumb? You wasted one week to this! I've posted the aforementioned article one week ago. How did you stuck?

  • How to get Sequence file path In "Sequentia​lModel.Seq​"?

    Hello
    I need to get the sequence file path in "SequentialModel.seq" before the "GetReportoptions" Callback is called.
    I found that step "Determine Report File Path" in "Sequenctialmodel.seq" returns the sequence file path but i.e after executing quite a series of steps.
    i need to get  this sequence file path in the starting of "SequentialModel.seq".
    looking forward to hear from you
    Thanks n Regards
    Kulwant

    Hello Kulwant,
    try "RunState.InitialSelection.SelectedFile.Path" or "RunState.ProcessModelClient.Path" at the beginning of SequentialModel.seq please.
    Regards
    MY

  • How to set default file path for save

    Hello all,
    I'm currently blocked on the below issue and is hoping to gain your help and insights.
    We have recently upgraded to InDesign CS6. Now when an INDD file created in an older version of INDD is opened in CS6, all the save dialogs would not default to the location of the original INDD file. Though if the same file is opened in the version of InDesign that created it, the save dialog goes to the proper location by default.
    Debugged using our custom plugin as a gate way, and found out that after InDesign CS6 performed the document upgrade/convert, the database for the converted document loses file information. i.e.  IDataBase::GetSysFile() returns nil. I think we can figure out some way to get the original file path. For example, we can intercept "kAfterOpenDocSignalResponderService", and get the original file path of the opened file from IDocumentSignalData. Though I haven't yet able to figure out a safe way to set this file path to the document, so that the save dialogs would by default point at this path.
    Utils<Facade::IWorkgroupFacade>()->InitDocumentAssetManagement(docRef, filePath) seems to do the right thing, but it seems to be quite intruding, and I'm afraid that it is overkilling and will cause bad side effect for the use case I'm looking for.
    So I'm wondering if anyone has any suggestions to achieve this without implementing/overriding the file save dialog.
    Thanks.
    -Jeff

    You should be able to avoid writing your own open-doc trap by using kDocBoss's IOpenedFileInfo to obtain the original file's path. It seems fairly reliable; the only time I've seen it come up empty is for an opened QuarkXPress document.
    I'm afraid I don't know of a sanctioned way to change IDataBase::GetSysFile() without going through the database's SaveAs machinery. Overriding this behavior might only be possible by replacing the regular Save dialog with your own.
    But if InitDocumentAssetManagement() is helping, maybe the workgroup/asset management approach is worth pursuing. Have you tried spying on that call in the debug app? You might be able to isolate and use one of the commands that it's invoking (IAMSPManager::BindAsset() / kSetAssetAttributesCmdBoss?) without all of the side-effects of the higher-level call.

  • How to set the File Path to run a javascript using Plugin Code?

    Hi All,
    Im new to Indesign Plugin Development.Can any one help me out with my problem.
    What i want to do is to run a javascript using Plugin Code.When i went through this forum i was able to find out that i should use the IscriptRunner Class to automate this.I could also figure out that the Member Function to use is "CanHandleFile" &"RunFile".
    The first parameter in CanHandleFile & RunFile Member Function is to specify the path of the JavaScript File i suppose!I could also find out that IDFile has to used to set the file path Information.
    But im clueless how to set the Javascript FilePath using IDFile.Can any one help me how to do this?Any Code Snippets Please?
    Waiting for reply.
    Thanks
    myRiaz

    Hi,  Andreas<br /><br />  Can you explain this in detail? I found it in your post before.<br /><br />  The content of elements are returned through the Characters callback function:<br /><br />From ISaxContentHandler.h:<br /><br />/**<br />        Receives character data<br /><br />The parser will call this method to report each chunk of<br />        character data. SAX parsers may return all contiguous<br />        character data in a single chunk, or they may split it into<br />        several chunks. But all characters in any single<br />        event must come from the same external entity so the<br />        Locator provides useful information.<br /><br />Note some parsers will report whitespace using the<br />        IgnorableWhitespace() method rather than this one (validating<br />        parsers must do so).<br /><br />@param Chars The characters from the XML document.<br />        */<br />virtual void Characters(const PMString& chars) = 0; <br /><br />  What i have done is implement my own SAXContentHandlerServiceBoss, and in my file XXXSAXContentHandler.cpp, I override the fonctions StartElement, EndElement, and Characters() like below: I add the PMString xmlData to collect the file content:<br /><br />class XXXSAXContentHandler : public CSAXContentHandler<br />{<br />void XXXSAXContentHandler::Characters(const WideString& chars)<br />{<br />xmlData.Append(chars);<br />}<br /><br />void XXXSAXContentHandler::StartElement(const WideString& uri, const WideString& localname, const WideString& qname, ISAXAttributes* attrs)<br />{<br />xmlData.Append("<"); xmlData.Append(localname); xmlData.Append(">");<br />}<br />void XXXSAXContentHandler::EndElement(const WideString& uri, const WideString& localname, const WideString& qname)<br />{<br />xmlData.Append("</"); xmlData.Append(localname); xmlData.Append(">");<br />}<br /><br />}<br /><br />and in my program, I use the code below to call the fonction I overrided, but I dont know how I can get the String xmlData I defined in the XXXSAXContentHandler.cpp<br /><br />InterfacePtr<IK2ServiceRegistry> serviceRegistry(gSession, UseDefaultIID());<br /><br />InterfacePtr<IK2ServiceProvider> xmlProvider(serviceRegistry->QueryServiceProviderByClassID(kXMLParserService, kXMLParserServiceBoss));<br /><br />InterfacePtr<ISAXServices> saxServices(xmlProvider, UseDefaultIID());<br />InterfacePtr<ISAXContentHandler> saxHandler(::CreateObject2<ISAXContentHandler>(kXXXSAXContentHandlerServiceBoss));<br />saxHandler->Register(saxServices);<br />bool16 parseFailed = saxServices->ParseStream(readStream, saxHandler);<br /><br />Can you give me any help?<br /><br />Thanks and regards!

  • Create logical file path and read it in main program

    Hello Experts,
    My requirement is, I have to read files from application server.
    File path/ Directory is different in different system (systid). i have to read all files starting with (xyz*) from mentioned directory.
    This path i must define in logical path.
    Following are the steps i followed.
    1)   In FILE (TCODE) i have created a logical path and assigned a physical path to it.
    2)   I have created logical file ( I am not sure about this, as i dont have to create logical file, i just need to read file from above path starting with xyz*,  but FM FILE_GET_NAME requires logical file name so i have created it).
    3) I will pass logical file name to FM FILE_GET_NAME and recieve physical file path(with file name which i can ignore).
    these all steps i found on SDN. but its not working.
    FM FILE_GET_NAME is always returning same file path ( Not even close to what i have defined ).
    I can not read data from Table path as it will return physical path as it is, but i need it replaced with system id.
    Any suggestion will be really helpful.
    Thanks in Advance.
    Regards,
    Amar

    Hi Amar,
    one difficulty defining physical path name is to know the right Syntax group.
    For example if you habe OS Linux, you need Syntax Group UNIX here. In Table OPSYSTEM you can see, which OS (OPSYS) needs which FILESYS (Syntax Group).
    If you always get a wrong physical path, this may be caused ba a wrong choice of the Syntax Group. Only the correct one will lead to the correct path.
    Regards,
    Klaus

  • Validation and F4 help on an application server file path parameter

    Hi
    I have a field on a selection screen called File Path and it is for a download program where the user needs to specify the path for the download (NOT THE ACTUAL FILENAME).
    I am trying to find a function or method that allows a user to use F4 help to browse for a directory rather than a specific file. There are lots of posts out there asking this question but all of the answers point to functions that allow you to browse for a particular file rather than just the file path/directory.
    Does anyone know of a function that provides F4 help to browse for a file path on the Server (NOT PC). I would want the user to just be able to select the directory or path and have the path returned. They should not need to pick a specific file.
    F4_DXFILENAME_TOPRECURSION is a very good function but unfortunately it makes the user pick a file rather than just a directory.
    In addition to this, does anyone know of a function or method that allows you to then validate the path\directory that is entered?
    Thanks for your help
    Nicole

    Hi,
      You can try with the FM 'EPS_GET_DIRECTORY_LISTING'. With this Fm module you will get you the list of files of a particular path in an internal table. Then you can populate this internal table in F4 help.
    Hope this solves your problem. If any difficulty, come back to me about that.
    Below are some other FM related to application server directory. Hope these Helps.
    EPS_GET_DIRECTORY_LISTING
    EPS_GET_DIRECTORY_PATH
    EPS_GET_FILE_ATTRIBUTES
    EPS_GET_FTP_SYSTEM_INFO
    Regards,
    Shailesh Jadhav

  • Regarding Application server file path browsing

    Hi All,
    I have a issue regarding Application Server File Path browsing.
    Actually in my selection-screen i will declare a parameter as <b>Application Server File Path</b> now when i press F4 in that field it should be able to browse through <b>Application Server Path's</b>.
    Just like <b>F4_FILENAME</b> in the case of <b>Presentation Server File Path</b> Browsing.
    Can anybody solve my issue.
    Thanks in advance.
    Thanks & Regards,
    Rayeez.

    Hi Shaik,
    Just copy and paste:
    Here is the code for retrieving list of files contained within specific Application server directory(SAP).
    PARAMETER: p_fdir type pfeflnamel DEFAULT '/usr/sap/tmp'.
    data: begin of it_filedir occurs 10.
    include structure salfldir.
    data: end of it_filedir.
    START-OF-SELECTION.
    Get Current Directory Listing for OUT Dir
    call function 'RZL_READ_DIR_LOCAL'
    exporting
    name = p_fdir
    tables
    file_tbl = it_filedir.
    List of files are contained within table it_filedir
    loop at it_filedir.
    write: / it_filedir-NAME.
    endloop.
    Hope this will help you.
    Let me know incase of any concerns.
    EDIT:
    There are few FM for ur refernce :
    RZL_READ_DIR_LOCAL
    SUBST_GET_FILE_LIST Return table with file list for the given directory (pattern allowed)
    F4_DXFILENAME_TOPRECURSION Popup to select one file from the given application server directory
    TH_SERVER_LIST Returns list of application servers.
    EPS_GET_DIRECTORY_LISTING – Lists filenames from the application server .
    Cheers
    Sunny
    Rewrd points, if found helpful
    Message was edited by: Sunny

  • File path

    Hi, everybody!
    Can somebody explain, is there any chance of getting file
    path working with FileReferenceList?
    This is the code:
    var listener
    bject = new Object();
    listener.onSelect = function(fileRefList:FileReferenceList) {
    trace("onSelect");
    var arr:Array = fileRefList.fileList;
    for(var i:Number = 0; i < arr.length; i++) {
    trace("name: " + arr
    .name);
    I copied this code from Flash8 Documentation.
    I can get here only file name.
    Any different solution is also very acceptable.
    Thanks.

    I have the same problem i tried looking at the filereference
    interface file no clues there ill be keeping an eye out for a
    solution the only one i could think of was returning the values
    from php by saving them to a database when the fileis uploaded but
    this just isnt as good because its not fully local

  • File path problem

    I have looked an read through almost all the file path problem post possible and I am still having issues maybe one of you guys can help me, here are my files
    I am doing this as an example so that I can apply it to all of my file problems....
    Harold Timmis
    [email protected]
    Orlando,Fl
    *Kudos always welcome
    Attachments:
    pathexample.zip ‏122 KB

    First of all, to troubleshoot the problem it would help to put some filepath indicators at each point so that you can see what is going on. Also, in your exe having an error dialog "Simple Error Handler.vi" to let you know what LabVIEW didn't like in the exe.
    Now, when you run a top level ("Main.vi") and use the "Current VI's Path " in the development mode it returns <Filepath>\"Current path"\Main.vi. So stripping once will get you to  <Filepath>\"Current path" .    Now if you make it into an exe the "Current VI's Path" returns <Filepath>\"Current path"\"Name.exe"\Main.vi so you are "nested" one deeper.
    I use the following construct to determine whether the vi is being used as in the development environment or as an exe, the parse the path accordingly, although in this instance it is used to supply different directory names to a little more complex file system.
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

Maybe you are looking for

  • MBP-mid 2009-T-style MagSafe charger faulty?

    Ok... I've read through several of the 'issues' folks are having with their MBPs and charging. My mother has a brand new MBP--bought this month--September 2010, and it came with the newer L-style MagSafe charger. My husband and I, each have a one yea

  • Why does the top and bottom of my clips get cut off?

    Hi, I'm new to iMovie and I've encountered an annoying problem. I imported all my movie files from my flash drive without any issues. I dragged a clip from the section with all the clips to the play reel. I previewed the clip, both normal screen and

  • I often recieve emails with a lot of spaces between words in sentences

    These problem letters mostly come from two friends

  • Compress movie for CD-ROM

    I've been working on a video conversion project using the ADVC300 to import old VHS clips into iMovie 6. For the past two weeks I've read and experimented every which way to get a good quality representation of my video on the computer. The only good

  • Relative URL in JSP

    Hi all, I've developed and deployed a web application on Weblogic. It extracts some data and create zip file and JSP page displays relative link to download it. All of this was working fine. Now I have to extract the data to a different drive on the