What the line of statement do

put items 1 to -2 delimited by "/" of my folder into SuiteFolder

what it will do . Please explain

Comments

  • EggplantMattEggplantMatt ForumAdmin admin
    This statement gets the folder that the current script is located in (my folder) which will look something like this:

    /Documents/MySuite.suite/Scripts/

    Then parses out the pieces of the path (with a piece or item being defined by the slash character) and takes the first item to the next to the last item (the -2 tells it to count backwards from the end) and put that value into a variable called SuiteFolder, which would give this value:

    /Documents/MySuite.suite

    Using the designation "items 1 to -2" allows the code to extract the full suite path no matter how deep the folder structure is. It will work whether the suite folder is at the root of the file structure or 10 or more folders deep. If you were absolutely sure that the suite was always going to be 5 folders into the file system hierarchy you could say "items 1 to 5", but the approach used in the example is more robust.

    Hope that helps.
Sign In or Register to comment.