View Full Version : 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
TJ_Tigger
11-04-2005, 08:22 AM
Lots of different ways to do it. I would look at the following actions
String.SplitPath (http://www.indigorose.com/webhelp/ams60/Program_Reference/Actions/String.SplitPath.htm)
String.Replace (http://www.indigorose.com/webhelp/ams60/Program_Reference/Actions/String.Replace.htm)
String.Find (http://www.indigorose.com/webhelp/ams60/Program_Reference/Actions/String.Find.htm)
String.Right (http://www.indigorose.com/webhelp/ams60/Program_Reference/Actions/String.Right.htm)
String.Mid (http://www.indigorose.com/webhelp/ams60/Program_Reference/Actions/String.Mid.htm)
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
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?
Lots of different ways to do it. I would look at the following actions
String.SplitPath (http://www.indigorose.com/webhelp/ams60/Program_Reference/Actions/String.SplitPath.htm)
String.Replace (http://www.indigorose.com/webhelp/ams60/Program_Reference/Actions/String.Replace.htm)
String.Find (http://www.indigorose.com/webhelp/ams60/Program_Reference/Actions/String.Find.htm)
String.Right (http://www.indigorose.com/webhelp/ams60/Program_Reference/Actions/String.Right.htm)
String.Mid (http://www.indigorose.com/webhelp/ams60/Program_Reference/Actions/String.Mid.htm)
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
11-04-2005, 08:35 AM
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.:D
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?
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);
:)
TJ_Tigger
11-05-2005, 10:37 AM
Congratulations. :D Glad we were of some help.
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.