Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
pdf_export [2024/04/04 09:05] – [Javascript] o2adminpdf_export [2024/04/04 09:08] (current) – [Javascript] o2admin
Line 29: Line 29:
 ==== Javascript ==== ==== Javascript ====
  
-You can run Extendscript (Illustrator's built-in version of Javascript) to modify the file and path. Your code will be wrapped in a function so ensure that you include a return statement with the required data structure.+You can run Extendscript (Illustrator's built-in version of Javascript) to modify the file and path. Your code will be wrapped in a functionso ensure that you include a return statement with the required data structure.
  
   * Return an array with the find and replace values such as [{ find: "ABC", replace: "123"},{find: "Cat", replace: "Dog"}], which will be applied to the filename template   * Return an array with the find and replace values such as [{ find: "ABC", replace: "123"},{find: "Cat", replace: "Dog"}], which will be applied to the filename template
Line 49: Line 49:
 <sxh javascript; > <sxh javascript; >
  
-// This example will extract the ID number from a filename and save the  PDF to a master folder based on the ID +// This example will extract the ID number from a filename and  
-// "Example filename "F123246 Test File.pdf"+// save the  PDF to a master folder based on the ID in the X: drive 
 +// "Example filename "Customer F123246 Test File.pdf"
  
 +// Get the current document filename
 var docName = getData('doc.filename'); var docName = getData('doc.filename');
-var matches = docName .match(/J(\F+)/);+ 
 +// Use a Regular Expression to get the ID 
 +var matches = docName.match(/F(\d+)/);
 if (matches) { if (matches) {
-  setPath('X:\' + matches[1] + '\');+  setPath('X:/' + matches[1] + '/');
   return [];   return [];
 } }