For your artboards which one do you intend to place the text on first, last all?
As for your text… It is by default point text therefore you could position the point and centre align the contents ( thats what I would do )
There are several scripts already knocking about that add such fluff like name & path to a file…
I'ts always on the first artboard.
Centre align the contents is the "magic button" im searching for!
My background is Illustrator, not scripting, and I have used other scripts and find them fantastic but i really wanted to have a go myself,
this script is my "baby steps" script.
I know once i get my head round all the syntax that scripting will make my life so much easier but its very tempting to give in when you try to do something so simple and you just simply dont know the correct syntax.
This should help you along…
#target illustrator app.coordinateSystem = CoordinateSystem.ARTBOARDCOORDINATESYSTEM; var doc = app.activeDocument; doc.artboards.setActiveArtboardIndex( 0 ); var abRect = doc.artboards.artboardRect; var txt = doc.textFrames.add(); txt.position = [ abRect/2, abRect/2 ]; txt.textRange.paragraphAttributes.justification = Justification.CENTER; txt.contents = 'Some strings…';
Works perfectly Mark !
I didnt explain fully what i wanted so i have tweaked it a little ( sound like a pro ! but i am SO not !)
I am still struggling with the numbers in the [ ] parenthesis but I will get there,
Slow drips wear away stones.
I was a little reluctant to post here asking for help in case i either sounded like a noddy or offended someone by mistake or bad grammar!
You have been very helpful thank you
Only the people who demand a script or solution ( like it's there right ) are frowned upon… Those wanting help almost never… You will find in all the scripting forums here people are willing to help those who want to learn… ( the teach a man to fish approach ). Im muppet cos thats what I was when I was a noob asking here… still am…
I am in the middle of reading the relevant documentation honest!!, but it is a slow process ( or maybe I am a slow process!!).
It is almost like giving a man a Spanish dictionary and expecting him to be able to write a piece of classic literature in perfect Spanish.
So in the eternal hope of a quick fix could you guide me in the intricacies of how to display a filename with out all the "%20" gubbings? ( "gubbings" = A yorkshire word that roughly translates into "stuff i don't understand"
This is not essential but i just dont like the way it looks.
I am currently fumbling blindly with .name and .fullName
I have seen some scripts on here that run a filter through the string looking for the odd characters and replacing them with spaces i wanted to ask the question, "am I missing the obvious?"
Can i return the filename without the URL formatting?
// CODE BEGIN
var docRef = app.activeDocument
var pointTextRef = docRef.textFrames.add();
pointTextRef.contents = docRef.name + ' ' + docRef.fullName;
pointTextRef.top = 635;
pointTextRef.left = 20;
// CODE END
.name returns my document name with normal spacing, but .fullName returns the document name and file location in a URL format. Is this purely the nature of the beast? or is it because the file is stored on a network drive?
.fullName is the entire file path to the file. It will return the same form with a few less parts if it is located on your local hard drive. Try making a file and saving it to your desktop and then run your script. If you only want the name of the file and not the path to the file then just use .name.
The "%20" is just computerese for a space character.
Object Model Viewer in ESTK
slowly (very slowly) working my way through these ...