Copy link to clipboard
Copied
Hello,
I have a cummon workflow for creating and file Labels witch i created.
After my Label is created, it needs a titleblock with history due the needs from ISO 9001.
It needs the following infos:
Designed - eq Autor
Date of creation
Modified - date of a change
Verified - who checked the doc
Approved - who and when
What I would like to have is the following.
When I Start a script it should popup a form with all infos from the titleblock with editable textfields.
After they are filled I want to export a pdf to a new created folder, named after the Partnumber
Here you can download my template: https://adobe.ly/2JJqUuZ
I dont know java very well...
How can i created a from and access to the text in the titleblock?
Thanks for any help!
1 Correct answer
Hello Silly-V,
I tried to outsource it to a freelancer with no result (250$ was to expensive for my opinion). As I don't know javascript but other languages, I tried myself.
After some Hours reading into javascrip, I come with this. It's still under Progress and more a working-script and a bit messi^^ .
But it already pops up a window and i can insert designer, date and Titel. I think it's ok for my first try.
!
#target illustrator
var w = new Window ("dialog", "Titelblock Eingabe");
w.orientation
...Explore related tutorials & articles
Copy link to clipboard
Copied
Sounds like a good amount of work and challenge to a person who has some free time. To do this yourself, you will need to use ScriptUI to make a custom dialog so that it can reflect the amount of fields you have in your document.
Do you have any javascript experience at all?
Copy link to clipboard
Copied
Not rly. I know .NET but not javascript. At least i can read codelines like in this post:https://forums.adobe.com/message/2953998#2953998
I was able to change this a bit to suite better for me. We have some software developers in our company speaking java.
It would also help if i could give them some understanding of the behaviors of illustrator so they could write me the script.
Copy link to clipboard
Copied
Bonjour,
J'ai déjà fait ce genre de script.
Il me faudrait un modèle enregistré pour la version CS6. (.ai)
(on peut aussi charger un fichier .txt ou CSV contenant les données)
Cordialement elleere
Copy link to clipboard
Copied
Hello Silly-V,
I tried to outsource it to a freelancer with no result (250$ was to expensive for my opinion). As I don't know javascript but other languages, I tried myself.
After some Hours reading into javascrip, I come with this. It's still under Progress and more a working-script and a bit messi^^ .
But it already pops up a window and i can insert designer, date and Titel. I think it's ok for my first try.
!
#target illustrator
var w = new Window ("dialog", "Titelblock Eingabe");
w.orientation = "column";
var aText = app.activeDocument.textFrames.getByName ("designer");
var bText = app.activeDocument.textFrames.getByName ("date_of_creation");
var cText = app.activeDocument.textFrames.getByName ("titel") ;
var groupgen = w.add("group",undefined,'');
groupgen.alignChildren = "fill";
groupgen.orientation = "row";
var group1 = groupgen.add("panel",undefined, "Erstellung");
group1.orentation = "column";
group1.alignChildren = "fill";
var group2 = groupgen.add("panel",undefined, "Nummerierung");
group2.orentation = "column";
group2.alignChildren = "fill";
var todaydate = new Date();
var dd = todaydate.getDate();
var mm = todaydate.getMonth()+1; //January is 0!
var yyyy = todaydate.getFullYear();
if(dd<10) {
dd = '0'+dd
}
if(mm<10) {
mm = '0'+mm
}
todaydate= dd + '.' + mm + '.' + yyyy;
var myDesigner = group1.add ("Panel", undefined, "Designer:");
myDesigner.alignChildren = "fill";
myDesigner.orientation ="column";
var Designer= myDesigner.add ("edittext", undefined, "FVO");
Designer.preferredSize = [250,23];
var myDate = group1.add ("Panel", undefined, "Erstellungsdatum");
myDate.alignChildren = "fill";
myDate.orientation ="column";
var Datum= myDate.add ("edittext", undefined, todaydate);
Datum.preferredSize = [250,23];
var myTitel = group1.add ("panel", undefined, "Titel:");
myDesigner.alignChildren = "fill";
myDesigner.orientation ="column";
var Titel= myTitel.add ("edittext", undefined, "");
Titel.preferredSize = [250,23];
var myArtikelnummer = group2.add ("panel", undefined, "Artikelnummer:");
myArtikelnummer.alignChildren = "fill";
myArtikelnummer.orientation ="column";
var Artikelnummer= myArtikelnummer.add ("edittext", undefined, "");
Artikelnummer.preferredSize = [250,23];
var myButtongroup = w.add("group");
myButtongroup.alignment ="center";
myButtongroup.add ("button", undefined, "OK");
myButtongroup.add ("button", undefined, "Cancel");
w.show ();
aText.contents = Designer.text;
bText.contents = Datum.text;
cText.contents = Titel.text;
redraw();
Copy link to clipboard
Copied
Hello,
Je peux t'aider pour ton script,
Il me faut un document enregistré pour la version CS6
avec tous les rensiegnements utiles.
René.
PS me contacter par mail,
Copy link to clipboard
Copied
I don't speak french, sorry
Copy link to clipboard
Copied
Just found this funny little translate button ^^
Here the link to the CS6 version
Copy link to clipboard
Copied
Dein Code lässt vermuten, dass du Deutsch sprichst.
Copy link to clipboard
Copied
Das ist korrekt
Copy link to clipboard
Copied
Merci pour le fichier CS6, je regarde.
Il faut une version du fichier après modification afin bien comprendre
et une maquette de la boîte de dialog
a+
René
Le mail peut être écrit en allemand...
Copy link to clipboard
Copied
I am on a good way,
textboxes are now retrieving content from textframes. The script now generates a folder under given path and stores a pdf copy in there.
var w = new Window ("dialog", "Titelblock Eingabe");
w.orientation = "column";
var aText = app.activeDocument.textFrames.getByName ("designer");
var bText = app.activeDocument.textFrames.getByName ("date_of_creation");
var cText = app.activeDocument.textFrames.getByName ("titel") ;
var groupgen = w.add("group",undefined,'');
groupgen.alignChildren = "fill";
groupgen.orientation = "row";
var group1 = groupgen.add("panel",undefined, "Erstellung");
group1.orentation = "column";
group1.alignChildren = "fill";
var group2 = groupgen.add("panel",undefined, "Nummerierung");
group2.orentation = "column";
group2.alignChildren = "fill";
var todaydate = new Date();
var dd = todaydate.getDate();
var mm = todaydate.getMonth()+1; //January is 0!
var yyyy = todaydate.getFullYear();
if(dd<10) {
dd = '0'+dd
}
if(mm<10) {
mm = '0'+mm
}
todaydate= dd + '.' + mm + '.' + yyyy;
var myDesigner = group1.add ("Panel", undefined, "Designer:");
myDesigner.alignChildren = "fill";
myDesigner.orientation ="column";
var Designer= myDesigner.add ("edittext", undefined, aText.contents);
Designer.preferredSize = [250,23];
var myDate = group1.add ("Panel", undefined, "Erstellungsdatum");
myDate.alignChildren = "fill";
myDate.orientation ="column";
var Datum= myDate.add ("edittext", undefined, todaydate);
Datum.preferredSize = [250,23];
var myTitel = group1.add ("panel", undefined, "Titel:");
myDesigner.alignChildren = "fill";
myDesigner.orientation ="column";
var Titel= myTitel.add ("edittext", undefined, cText.contents);
Titel.preferredSize = [250,23];
var myArtikelnummer = group2.add ("panel", undefined, "Artikelnummer:");
myArtikelnummer.alignChildren = "fill";
myArtikelnummer.orientation ="column";
var Artikelnummer= myArtikelnummer.add ("edittext", undefined, "");
Artikelnummer.preferredSize = [250,23];
var myButtongroup = w.add("group");
myButtongroup.alignment ="center";
myButtongroup.add ("button", undefined, "OK");
myButtongroup.add ("button", undefined, "Cancel");
w.show ();
aText.contents = Designer.text;
bText.contents = Datum.text;
cText.contents = Titel.text;
redraw();
//export
var doc = app.activeDocument; // Name of the active document
var original_file = doc.fullName; // we need to store the original file and path
var pdfOption = 'Adobe PDF-Vorgabe 1'; // Name of PDF settings
var pdfSuff = '.pdf'; // Suffix for PDF
var arr = doc.name.split(".");
var extension = "";
if (arr.length>1) extension = "." + arr.pop();
var filename = arr.join("."); // Just generate a clean file name
var name_pdfpreview = Titel.text + pdfSuff; // new name and suffix for PDF
var export_folder = new Folder ("C:/Users/fvo/Desktop/AR-Nummern Ablage/" + Titel.text + "/" ); // Define path where to save PDF
if (!export_folder.exists)
export_folder .create();
// save as PDF and tell function which options to use and how to name the PDF
function saveCopyAsPDF (setPDF, namePDF) {
var destFolder = null;
destFolder = export_folder;
var options = null;
options = new PDFSaveOptions ();
options.pDFPreset = setPDF;
options.viewAfterSaving = false; // just to be sure not to open Acrobat
var targetFile = null;
targetFile = new File (destFolder + "/" + namePDF);
doc.saveAs (targetFile, options); // here we save the PDF
// doc.close (); // now we close it in Illustrator ...
// app.open (File (original_file)); // ... and re-open the Illustrator file
}
saveCopyAsPDF (pdfOption, name_pdfpreview);

