These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

- dataImportObject -

lucianopilla
Registered: Oct 18 2007
Posts: 76

function attach()
{
var namefile = this.documentFileName;
var str = namefile;
var aWord = namefile.split("_");
var Cod_Fornitore = aWord[1];
var Ragin = aWord[0];
var nuovo = Ragin + "A"+ Cod_Fornitore +".pdf";
this.importDataObject("sd","nuovo");
}

hi thomp, i'd like to insert the variable nuovo into CDIPath of importDataObject, is it possible? i tied several ways to do it but it doesn't work.
thnaks in advance!

Adding intelligence to documents

My Product Information:
Acrobat Pro 8.1.2, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
You need to remove the quotation marks around nuovo in order for JS to treat it as a variable and not a string.

So this:
this.importDataObject("sd","nuovo");
Should be:
this.importDataObject("sd",nuovo);

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

lucianopilla
Registered: Oct 18 2007
Posts: 76
thanks but it's not so easy!

Adding intelligence to documents

try67
Expert
Registered: Oct 30 2008
Posts: 2398
You need to be a bit more specific than that... What exactly is going wrong now?

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

lucianopilla
Registered: Oct 18 2007
Posts: 76
...it doesn't work. I have the need to insert attchment with batch sequence, the name of the attachment is the same of the namefile with the prefix _A before the name. for example if i have a file with name 080001 the attchment is _A080001. i develop a script to recognize the attachment but the problem is that i can't insert this as variable into the CDIPath of the insertDataObject method. I hope to be more clear. So the problem is not connected to " " but i think is another. in regard of i'd like to know if is possible to insert a variable as a path? thanks

Adding intelligence to documents

try67
Expert
Registered: Oct 30 2008
Posts: 2398
First of all, the quotation marks ARE a problem. If you'll use them, nothing will work. You have to get rid of them for JS to look for the right file.

Second, what you described is different to what the script you gave in your post is doing. The script seems to break the filename into two parts and then put them back together with an "A" in the middle... is this what you wanted it to do? Also, I think you will get a ".pdf" too many. You should not add it another time, it already exists in the original documentFileName.

Third, remember that documentFileName returns just the name of the PDF (+extension), not it's full path. So the files you are trying to import must be in the same directory as the original PDF for this to work.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

lucianopilla
Registered: Oct 18 2007
Posts: 76
ok. you are right, the code i wrote identify the attachment file. Afert i idenify the attachment i want to attach it, i also tried to add the path to namefile but it doesn't work. i'd like to know if it is possible to declare a variable into CDIPath!! thanks for your reply but you don't answer to my question. until now you don't say me nothing new.

Adding intelligence to documents

try67
Expert
Registered: Oct 30 2008
Posts: 2398
Yes, it's possible, but you're not doing it correctly.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com