I have simple script that is placing files on to the page.
var myDate = new Date();
var myMonth=myDate.getMonth() + 1;
var myTotal = myDay + "/" + myMonth + "/" + myYear;
var myDoc = app.activeDocument;
var afile = File("/Files/max/Desktop/'myTotal'_name.txt") >>>>Could please someone suggest how I can use variable myTotal - as prefix for the name of the file ? I need to open files with actual date
var bfile = File("/Files/max/Desktop/b.txt")
var cfile = File("/Files/Max/Desktop/c.txt")
if (!afile.exists || !bfile.exists || !cfile.exists)
alert ("Text file missing...")
The argument to File(...) is a simple text string, and simple text strings are concatenated using the + operator:
a = "b";
b = "c";
c = a+b; -> c = "bc";
By the way, as you can see in your own File(..) line, the forward slash is defined as a path separator. It's possible you have a folder structure "Files", containing "max", containing "Desktop", but since you add 'myTotal' to the mix -- which also contains forward slashes -- you have to ensure all path elements in that exist as well.
(As it seems you were not intending that, I'd suggest using other date separators than forward -- or backward! -- slashes.)
Thank You that was easy....
I will take your suggestions ...
I did change slashes to underscore in date...