PDA

View Full Version : Copy and Paste files


floyd1510
06-30-2008, 02:31 AM
Hi all,

This is my first post here. I was wondering if someone could help me with the code to copy paste .scn XSI files via the script editor.

Cheers,
Vikram.

P.S: I would preferably need the syntax in Javascript since its for a script i'm making using Jscript

toma
07-01-2008, 12:25 PM
hi, this should work :

var oFS = new ActiveXObject( "Scripting.FileSystemObject" )

var oFile= oFS.GetFile(oFilePath) // oFilePath = "C:\etc.scn" : the file to copy

oFS.CopyFile(oFile,oFolder,true) // oFolder = "C:\bla" : where you want to copy the file ( true to enable overwrite )


if you want, you can get the actual scene's file with :

var oScene = ActiveProject.ActiveScene

var oFilePath =oScene.FileName.value // it's path

var oSceneFolder = oFS.GetParentFolderName(oFile) // it's location

btw, there is a good (I mean simple, fast, can fit in a small window) reference for JScript here :

http://www.host-web.fr/iishelp/JScript/htm/JStoc.htm

[edit] oups ! it's in french....

floyd1510
08-11-2008, 08:55 PM
Thanks dude for this,

Actually I was trying to create a custom Autoback system for the animators, where I needed it. i'm too busy to continue with it for now.

Thanks for the copy paste code though. Have used it in other scripts

toma
08-19-2008, 10:20 AM
here's mine... the command's name is : "axl_Save" (no arguments needed)

what it does :

before saving it, the current scene file is copied to a backup folder (created in the current scene's folder) and renamed "scene v_xxx", then the scene is saved.

this way, you have incremental backups of your scene, but the file of the current version is always the same...

you can just bind this command to ctrl-S... :)

(of course I'm no developer so use by your own risk etc.)

thomas.