omgh4x0rz
2007-05-22 16:08:13
Is there a way you can determine the name of the file the script is saved as? Kinda like ScriptPath determines the file path, but I need the actual name of the file.
Bobarkinator
2007-05-22 16:26:58
get the script path then delete everything but the name.
omgh4x0rz
2007-05-22 16:42:27
From: bobarkinator
get the script path then delete everything but the name.
ScriptPath only returns the path. It does not include the file name.
Bobarkinator
2007-05-22 18:52:17
Have a const of file name.
omgh4x0rz
2007-05-22 19:23:53
From: bobarkinator
Have a const of file name.
I'm trying to make something where the user can click a button on the form and auto-update the script. However, what they have the file saved under won't necessarily coorespond with what I
want the name to be and what I put in the const. I could make my const = 'awesome script.scar', but that doesn't stop them from saving it as "omgh4x0rz shitty chopper.scar"
Yea?
Bobarkinator
2007-05-22 23:19:27
Edit: I was just looking somewhere and someone used this
TheFileNumber := ReWriteFile(ScriptPath + [B]ScriptName[/B], false);
It was from Sumilions something and was on an application.
Yakman
2007-05-23 02:45:18
in divi, there is a function called something like ListFiles(dir,extention:string):array of string;
which return an array of the files in a directory with an extention,
so choose extention 'scar' and for every file you get, open it and read the first few lines, in your script put something like,
program MyScript; //MyScript by SomeGuy
then when you're reading, if it has that, it means its your script and thats the file name
omgh4x0rz
2007-05-23 13:12:26
Ah thank you very much yakman! I guess that is a reason for me to download divi now.