[Closed] drag and drop in the viewport; path to the script
Hi,
I was hoping this would work but unfortunately id doesn’t.
I’m dropping my script into the viewport, it runs properly. Then I run command
sysInfo.currentdir
and the path does not match.
Is there any other way I could drag and drop the script and get it’s path?
Do you want to get a path to the script that you have just dropped into the viewport from, say an explorer window? As Dave said, use getThisScriptFilename()
(
local script = getThisScriptFilename()
local scriptPath = getfilenamepath script
messagebox scriptPath title:"And that's all I have to say about that..."
)
Save this to an external file, then drag and drop it into the viewport, it should say where it has come from.
There is a function which is
getThisScriptFilename()
Which will get the filename of a script that is being run, but it has to be in the script that is being dropped in.
Indeed this is working. I don’t know why when I tied this in my script it kept me giving wrong paths.
Thanks!