Copy link to clipboard
Copied
I am writing a very simple script that exports an image's cutline for my newsroom, i am getting stuck with the having it write the file to the correct path. When I run script as below it works, writing the file to my documents:
function writeCutline () {
// Linefeed shizzle
if ($.os.search(/windows/i) != -1)
fileLineFeed = "windows";
else
fileLineFeed = "macintosh";
var fileName = app.activeDocument.name
var MetaInfo = app.activeDocument.info;
MetaInfo = MetaInfo.caption;
var fileOut = new File(Folder.myDocuments + '/'+ fileName.substring(0,fileName.length-4)+ '.txt');
fileOut.linefeed = fileLineFeed;
fileOut.open("w", "TEXT", "????");
fileOut.writeln(MetaInfo);
fileOut.close();
}
writeCutline();
What I want it to do is:
var fileOut = new File( '/c/cutlines/'+ fileName.substring(0,fileName.length-4)+ '.txt');
but this does not work. What do I have to do different?
Copy link to clipboard
Copied
The path looks fine, but does c:/cutlines folder exist? if not it needs to be created.
Copy link to clipboard
Copied
If you want the path to be absolutely identical on both OS X and XP, you will need
the folder c:/cutlines to be created on XP (as Paul noted) and the folder /c/cutlines to be created on OS X.
On OS X, this means creating a folder called 'c' in the file systems root directory with a subfolder called cutlines.
I have a couple of folders like that for some scripts I have laying around that still contain hardwired absolute paths.
Copy link to clipboard
Copied
Thanks for the help guys. I wasn't actually putting the files on C: it was actually going to a mapped network drive and for some reason last night the server was working incorrectly and that is where my problems where coming from. But that raises my next question, is there anyway to address the path with mapping the drive, so it would be a refence to the server. If i was browsing the path it would be TARHSHARE/PHOTOS/photos/DailyATS/Cutlines. With PHOTOS mapped to drive P the path is P:/Photos/Daily/ATS/Cutlines. So what I want to do is get it work without mapping the drive, so the script will work on all of the photographers accounts without mapping the drive.