Modification Date changed
hi,
i trying create folders , copy file pick. below code working fine in indesign. need work in illustrator well. please me?
original thread: modification date changed
function myfolder(){ var _files = file.opendialog("select indesign/illustrator file","*",true); if(_files==null){return;} myfolder = folder.selectdialog("choose main folder created subfolders"); if(myfolder==null){return;} _parent = _files[0].parent.tostring().replace(_files[0].parent.parent,""); var mygetname=prompt("please enter event id",""); if(mygetname==null){return;} var myartname=prompt("please enter part number",""); if(myartname==null){return;} var myartnamew=myartname+"_aa" new folder(myfolder + "/" + mygetname).create(); new folder(myfolder + "/" + mygetname+ "/ot"+ "/" + myartnamew).create(); new folder(myfolder + "/" + mygetname+ "/ot"+ "/" + myartnamew+ "/art").create(); new folder(myfolder + "/" + mygetname+ "/ot"+ "/" + myartnamew +"/soft").create(); mymodified=_files[0].modified; myfile=new file(myfolder + "/" + mygetname+ "/ot"+ "/" + myartnamew+ "/art"+ "/"+myartnamew+ "/" ); _files[0].copy(new file(myfolder + "/" + mygetname+ "/ot"+ "/" + myartnamew+ "/art"+ "/"+myartnamew+ "/" )); changedate(myfile.fsname, mymodified); } myfolder(); function changedate(file, date) { var year, month, dayofmonth, hours, minutes, command, appledate; year = 1900 + date.getyear(); month = pad(1 + date.getmonth()); dayofmonth = pad(date.getdate()); hours = pad(date.gethours()); minutes = pad(date.getminutes()); appledate = "" + year + month + dayofmonth + hours + minutes; command = ["try", "do shell script \"touch -ft " + appledate + " '" + file + "'\"", "end try" ].join('\n'); try { app.doscript(command, scriptlanguage.applescript_language); } catch (e) { $.writeln(command + "\n" + e); } return undefined; function pad(value, digits) { value = "" + value; digits = digits || 2; var padding = new array(digits + 1).join("0"); return (padding + value).slice(value.length); } }
thanks,
k
More discussions in Illustrator Scripting
adobe
Comments
Post a Comment