Hey thanks!

That is just right for the job
I have more questions; is this tex_name a string? Because I'm trying to work with this variable but nothing works. I tried:
test_string = tex_name;
(test_string is a global string variable that I show in a panel)
I also tried:
if(tex_name == "bluetex.pcx") ...
Where am I doing something wrong? o_O