Copy link to clipboard
Copied
Hi experts
I know how to import an attachment via JavaScript, letting the user choose the file.
Know I want to import a set of files located in the same folder, the path of this folder is known and always the same. Only the quantity of files varies, and their names.
Can I use JavaScript to programatically import all files contained in a folder as attachments in a PDF?
This script will run from an Action in Acrobat Pro DC for Windows.
Thank you
Copy link to clipboard
Copied
No.
Copy link to clipboard
Copied
Thank you
Why is JavaScript so cruel? 😞
Copy link to clipboard
Copied
To protect the users from having a script being able to access all the files on their computer...
Copy link to clipboard
Copied
Actually, you could do this with a batch process. The script would need a way to identify the target file. A global is good for this. Then the script imports each file in the batch to the target. I don't see any problems with this technique.
Copy link to clipboard
Copied
try67: This script will run from an Action in Acrobat Pro, so I didn't see any security issues. If needed the user can confirm the folder's path.
Thom : my idea was a loop inside the target folder to catch all files, would it be possible?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi JR, Unfortunatley there is no general file system access from the Acrobat scripting model. So the only way to process an arbitrary set of files is through a batch process.
Another solution that I have used frequently is to create a VB application that uses the IAC to preform a kind of psuedo-batch operation. But this is a Windows only solution, and the batch script is much easier to implement.
Copy link to clipboard
Copied
I'm not sure to undestand, what do you mean by "batch process"?
Isn't an Action a batch process?
The use of VB is excluded, I will not learn a new foreign language just for that 😉
Copy link to clipboard
Copied
Yes, for the purely JavaScript technique I mean Action. Which BTW is a very over used word.
But for my technique that uses an external VB program, I'm talking about batch processing in the generic sense, not an Action, but rather the process of iterating over a group of files, as implemented through the VB program.
Copy link to clipboard
Copied