Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #6181
    jadde29
    Participant

    Hello,
    I have tried to create a macro which cut the file name in the whole path string

    Maybe example makes things clear
    I have a string which is the whole path to the file like:

    C:folder_1folder_2myfile.ext

    I need a macro which can cut the last part of the string leaving only the path like that:

    C:folder_1folder_2

    Of course, the length of the name of the file is unknown.

    I’ve tried to find a solution but still no clue how it can be done.
    Please help gurus, I need it badly

    Thanx for your time

    #6184
    yorkane
    Member

    var fullFileName = ‘C:folder_1folder_2myfile.ext’;
    var i = fullFileName.lastIndexOf(”) +1;
    var path = fullFileName.substring(0,i);
    alert(path);

    #6185
    jadde29
    Participant

    Great thanx yorkane
    Just two questions:
    Can the result be saved or copied to the clipboard instead of pop-up window?
    Can it be more universal-I mean when the path is different or when the text file contains many path strings?

    Once again, great thanx for the responce

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.