I am trying to cutdown similar file names to these
comp - nameabc11 - pr_code11.txt
to pr_code11
comp - nameaaaadbc21 - pd_code21.txt
to pd_code21
I end up getting results like this
- pr_code11
and
c21 - pd_code21
I tried doing this way
Code:--================================================ -- Get Selected Item Number from this Listbox --================================================ nSelected = ListBox.GetSelected(this)[1]; if nSelected then --================================================= -- Getting Original Full name and Path --================================================= org_name = ListBox.GetItemData(this, nSelected); --================================================= -- Splitting up Path, Name, and Ext --================================================= splt_path = String.SplitPath(org_name); --================================================= -- Assining the Filename to a varible --================================================= file_name = splt_path.Filename --================================================= -- Removing the "comp - " out of the filename --================================================= rem_comp = String.Replace(file_name, "comp - ", "", false); --================================================= -- Find Position number of the next " - " --================================================= pos_no = String.Find(rem_comp, "-", false); --pos_no = String.ReverseFind(rem_comp, "-", false); --================================================= -- Creating a new word to the right of the position number --================================================= final_name = String.Right(rem_comp, pos_no); --================================================= -- Getting Values From INI --================================================= price_1 = INIFile.GetValue("myinifile.ini", final_name, "price"); image_1 = INIFile.GetValue("myinifile.ini", final_name, "image"); name_1 = INIFile.GetValue("myinifile.ini", final_name, "name"); --================================================= -- Set Values From INI To Objects --================================================= Input.SetText("Input2", price_1); Label.SetText("Label1", name_1); Image.Load("Image2", image_1); --================================================= -- Create a global variable and assign a string to it --================================================= --current_sel = result1; gl_image = image_1 --================================================= -- A Test Just to see results of file renameing --================================================= Label.SetText("Label3", pos_no); Input.SetText("Input1", final_name); end

