Quantcast
Channel: Indigo Rose Software Forums - Forums
Viewing all articles
Browse latest Browse all 2105

Help Rename File with special character

$
0
0
Hello everyone i am having trouble to rename a specific file. although i can do a rename it manually but i want to do it in the software.

here is the example file name
Original file name: All I Want For Christmas Is You - Mariah Carey【cover 】.mp3

the files name when loaded it will replaces all special character into a question mark ?

since the file has special character the media player cannot play the music. i try to rename it on the software before loaded in media player but i have no success..

Here is my code after browse the file:

nD = String.SplitPath(mp3[1]).Drive;
nF = String.SplitPath(mp3[1]).Folder;
nSp = nD..nF

sText = String.SplitPath(mp3[1]).Filename;
sExt = String.SplitPath(mp3[1]).Extension;
tText = sText..sExt;


_target1 = String.Find(sText, "?", 1, false);
if _target1 > 0 then


nName = String.Replace(sText, "?", "", false);

File.Rename(nSp..tText, nSp..nName..sExt);

--Check to see if an error occurred.
error = Application.GetLastError();
-- If an error occurred, display the error message.
if (error ~= 0) then
Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
end

MediaPlayer.Load("Plugin1", nSp..nName..sExt);

end

Anyhelp..? Thanks...

Viewing all articles
Browse latest Browse all 2105

Trending Articles