i am writing a script that needs to write a temp file somewhere in the user's directory...
I've tried %Temp% but i am not having much luck..
where is a good place to put a temp file?
thanks
-lloyd
temp directory in windows
Moderator: Paul Tuersley
- lloydalvarez
- Enhancement master
- Posts: 460
- Joined: June 17th, 2004, 9:27 am
- Location: New York City, NY
- Contact:
is it important to write the file in the Temp directory ? ("C:\WINDOWS\Temp")
why don't you create the file anywhere on the disk and remove it when things are done (with myTempFile.remove(); )
why don't you create the file anywhere on the disk and remove it when things are done (with myTempFile.remove(); )
- lloydalvarez
- Enhancement master
- Posts: 460
- Joined: June 17th, 2004, 9:27 am
- Location: New York City, NY
- Contact:
ok, but where can i be sure i'll be able to write.. in Mac, typying ~/ assures me that i'll be in the user's directory and will be allowed to write anywhere in there..
on windows it seems i need to know the drive letter. %TEMP% is giving me an error when i call it from within the script.. unless there's a special way to use it..
on windows it seems i need to know the drive letter. %TEMP% is giving me an error when i call it from within the script.. unless there's a special way to use it..
- lloydalvarez
- Enhancement master
- Posts: 460
- Joined: June 17th, 2004, 9:27 am
- Location: New York City, NY
- Contact:
nab wrote:is it important to write the file in the Temp directory ? ("C:\WINDOWS\Temp")
why don't you create the file anywhere on the disk and remove it when things are done (with myTempFile.remove(); )
Hi Nab,
What i am doing is writing a temp.bat file to launch aerender.. If i use myTempFile.remove(); it deletes the file, but the .bat doesnt execute.. my guess is that it's being deleted before it get a chance to run.. so then i tried app.scheduleTask("myTempFile.remove();",1000,0).. now the .bat runs but it doesnt' delete the file.. I also tried adding this as the last line of the bat file: del temp.bat but that didnt work either.. The thing is that if i can write the .bat file to a temp directory, then i dont need to worry about deleting it.. I am only writing one file and overwriting that file, so i won't create a bunch of files that will need to be deleted later..
-Lloyd
scheduleTask doesn't seem to be your best friend
here is the quick test I've made.
I've created a root folder named "Projects" and place a "demo.aep" project inside (with a comp ready to render in the queue).
The following script first calls aerender via a .bat command file -to render the movie- and remove the command file after it's been executed.
ps: the local Temp directory should be something like "C:\Documents and Settings\NAB\Local Settings\Temp"

here is the quick test I've made.
I've created a root folder named "Projects" and place a "demo.aep" project inside (with a comp ready to render in the queue).
The following script first calls aerender via a .bat command file -to render the movie- and remove the command file after it's been executed.
Code: Select all
{
// paths
var myAerenderPath = "C:\\Program Files\\Adobe\\Adobe After Effects 7.0\\Support Files\\aerender.exe";
var demoFolder = "C:\\Projects\\";
// files
var myProj = demoFolder + "demo.aep";
var batFile = new File(demoFolder + "aerender.bat");
// commands
var myRenderCommand = "\"" + myAerenderPath + "\" -project " + "\"" + myProj + "\"";
var myRemoveCommand = "batFile.remove();";
// render
batFile.open("w","TEXT","????");
batFile.writeln(myRenderCommand);
batFile.close();
batFile.execute();
// remove command file
app.scheduleTask(myRemoveCommand,1000,false);
}
ps: the local Temp directory should be something like "C:\Documents and Settings\NAB\Local Settings\Temp"