Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 6 of 6

Thread: Cut path

  1. #1
    Join Date
    Jul 2005
    Posts
    50

    Cut path

    How can i cut the pathName "Pinnacle" to the end of the path?

    D:\Program Files\Pinnacle\Studio 9\bin\amcap.exe
    Pinnacle\Studio 9\bin\amcap.exe

  2. #2
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    Lots of different ways to do it. I would look at the following actions

    String.SplitPath
    String.Replace
    String.Find
    String.Right
    String.Mid

    You could use any of those actions to extract the path. For instance, use String.SplitPath to split the parts of the path into pieces, and then use String.Replace to replace the string "\\ProgramFiles\\" with "" and then piece the folder, filename and extension back together.

    HTH Tigg
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  3. #3
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    Also you could look in the Gallery for the scripts. In the DelimitedStringFunctions.lua file, there is a function, DelimitedStringToTable. Use the backslash as a the delimiter and you'd have the whole path in a table, traverse in reverse til you hit the base folder you want.

    traverse in reverse... sounds fun, huh?

    Quote Originally Posted by TJ_Tigger
    Lots of different ways to do it. I would look at the following actions

    String.SplitPath
    String.Replace
    String.Find
    String.Right
    String.Mid

    You could use any of those actions to extract the path. For instance, use String.SplitPath to split the parts of the path into pieces, and then use String.Replace to replace the string "\\ProgramFiles\\" with "" and then piece the folder, filename and extension back together.

    HTH Tigg

  4. #4
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    Or you could search the string for the path in reverse without going to a table for the base folder you want, and then use that position to extract the string you want from the mid point to the end of the string.

    I do like the traverse in reverse . . . one step forward, two back.. the daily grind.
    Quote Originally Posted by Worm
    Also you could look in the Gallery for the scripts. In the DelimitedStringFunctions.lua file, there is a function, DelimitedStringToTable. Use the backslash as a the delimiter and you'd have the whole path in a table, traverse in reverse til you hit the base folder you want.

    traverse in reverse... sounds fun, huh?
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  5. #5
    Join Date
    Jul 2005
    Posts
    50
    tnx guys i success to make something with this code:

    result1 = Input.GetText("file");
    result = String.Find(result1, "Pinnacle", 1, true);
    strEnd = String.Mid(result1, result, -1);
    Input.SetText("file", strEnd);


  6. #6
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    Congratulations. Glad we were of some help.
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

Similar Threads

  1. How do I add to my PATH statement at install?
    By Tnygaard in forum Setup Factory 6.0
    Replies: 3
    Last Post: 05-27-2002, 01:38 AM
  2. Path problems in NT when executing file with spaces in path
    By tomarppe in forum Setup Factory 6.0
    Replies: 6
    Last Post: 03-21-2002, 02:01 PM
  3. PATH environment variable
    By RDodson in forum Setup Factory 6.0
    Replies: 4
    Last Post: 02-27-2002, 12:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts