Illustrator Scripting :: Regex - Limit Input To A Positive Number (float Or Int)
May 14, 2013
I wish to limit the user input of and edittext to only allow a positive number, float or int. I do not yet know my Regex good enough to do this. I realize that I must get better at regex but in the meantime how to do this ?
I have used this so far on the edittext:
function checkTextInput()
{
if (this.text.match(/[^0-9.]/g))
{
this.text = this.text.replace(/[^0-9.]/g, "");
}
}
Which matches
000.0001
0.45.000.1
...1
which is not desired.
Desired is
0.n
.n
n.n
View 1 Replies
ADVERTISEMENT
Feb 24, 2013
I have a bit of a problem with apple script, I'm creating a Text item and setting the stroke to 0.4pt then i want the stroke miter limit to be set to 2 but it wont work i get :-
Adobe Illustrator got an error: Can’t set properties of text frame 1 of layer 1 of document 1 to {stroke miter limit:2}. (error -10006) but im am able to apply a stroke miter limit of 2 on a path item, is there a way of converting the text frame to a path item then applying the stroke miter limit to it.
on TicketFront_(posX, posY)
tell application "Adobe Illustrator"
activate
set ticketItem to make new text frame in theDoc with properties {contents:{"Some Text"}, position:{(35.7 + posX) * 2.834645, (173.5 - posY) * 2.834645}}
set properties of the text of ticketItem to {text font:text font "Raleway-Thin", size:5.54, justification:center, fill color:{class:spot color info, tint:100.0, spot:spot "PANTONE 4535 U" of document 1}, stroke color:{class:spot color info, tint:100.0, spot:spot "PANTONE 4535 U" of document 1}, horizontal scale:126.46, stroke weight:0.4}
[code]...
ive also tryed putting convert to paths ticketItem in the script which converts the text to paths but the stroke miter limit still dont work.
View 17 Replies
View Related
Oct 3, 2013
I have this working without the prompt, if I under manually the margin via var margin = 10; it works. it also seems to return correctly when I print what the input from the user is, but it doesn't seem to want to work and freezes.
it says "point value expected"
//Helper functions
function print(i) {
if(i == "object"){
print("you are trying to printObject, use printObj(); function");
}
else {
$.write(i+"
[code]...
View 1 Replies
View Related
Aug 24, 2013
How do I read input parameters from a script file name? For example, let’s say I want to run a script that requires 3 variables as input, but rather than prompting for the values I wish to read them from the script file name … e.g., the file name might be “Myscript.js (my_variable1, my_variable2, my_variable2)” … where variables are all real numbers. So I assume the script name when run should look something like … Myscript.js (10, 10, 100), but how do I then read these and assign these values to a var statement within the script?
View 3 Replies
View Related
May 15, 2013
I have to write a loop statement wich has to be able to identify odd numbers from even numbers:
View 2 Replies
View Related
Feb 3, 2014
I am trying to add a number to a variable. var n=y+36...So I am creating a new variable (n) whose vaule is 36 points more than the variable "y".
View 5 Replies
View Related
May 13, 2013
Is it possible to use an imported text as a number? I would like to import a .txt tab formatted file containing some values (ex: 22.5; 50.00; 150.00, etc.), and I want to treat those values as numbers in my script. Is this possible?
View 2 Replies
View Related
Jul 26, 2012
I'm using the variables panel in Illustrator to pull a data set I've got.
For example there's 2 text variables and 1 number going from 0-359. I'm looking for a script which looks at the variable name and pulls the number, then uses that number to rotate a shape by that many degrees.
View 2 Replies
View Related
Jun 13, 2013
I've had to rescale some artwork, but now I'm left with type sizes that are 71.68px tall, 34.51px tall, etc.
Is there a script that'll snap all the text in a document to it's nearest whole number or 0.1 decimal?
View 7 Replies
View Related
Apr 18, 2013
I've written a script to allow you to select an image to replace any number of selected files. Each file starts out as an embeded image with a .note to determine where the basis of alignment for the new file should be (i.e. "top," "bottom," "left," "right"). You'll find the code below:
#target illustrator
if (app.documents.length > 0) {
var docRef=app.activeDocument;
var docSelection = docRef.selection;
// ** Get new file
[Code]...
For some reason, the ".note" added at the end of the script gets erased once the script is complete. I can even get it to confirm that it applied the note to the image, but once it's complete, it's gone.
View 6 Replies
View Related
Oct 27, 2013
Problem:
How to read real number data from selected columns in an Excel spreadsheet into an illustrator javascript array variable, so that then I can use this information to construct an illustrator polygon.
Further information:
I am new to javascript (and not much of a programmer in the best case, but do have some basic knowledge using ancient languages like FORTRAN 88). I am sure I am just missing an important step here despite all morning browsing with Google for answers (something to do with variable definition I assume?). I have some survey data defining the outline of features in map view listed in a string of point (x,y) values in adjacent columns in excel (these x,y point values calculated from GPS data using a commercial program to converted 3D position to a 2D x,y by geoid projection, and then in excel to re-scale point locations to illustrator’s artboard). What I am trying to do is select columns of x,y value pairs in an excel spreadsheet, copy these values to the clipboard, and then develop an IA JavaScript to draw a polygon through the specified set of x,y points. It seems easy enough to script illustrator to draw the polygon once I get the values from the clipboard are in a javascript array (lots a good tips here [URL] ....), but pulling in the clipboard data seems to be beyond me. I have tried populating a defined array with various combinations of array declarations and app.paste(); or windows.clipboardData.getData('text/plain'); with no satisfaction. I then had the idea to try to pull in the clipboard to one long continuous string, place that in a text box (see see its structure), andthen read and split up the text in a loop to populate the JavaScript array…but that deposited a complex illustrator table object into my text box, and several attempts to force the clipboard to paste text did not work (again probably having problems understanding variable type declaration).
I would be happy to find any method of scripting the pull of the selected on an excel spreadsheet for use in an Illustrator script…so if I am making this all harder than it needs, be I would be grateful to know that also!
View 4 Replies
View Related
Aug 18, 2012
I have created a design for a t-shirt competition. I have not read till now that you are only allowed to use a maximum of 8 colours in you design!! Trouble is that I do not know how many colours I have actually used :/I have read blogs on how to convert the colours by saving the file as a giff as well as posterising which all seem to make my work look like a waste of time..
View 6 Replies
View Related
Mar 21, 2013
I installed my photoshop brushes in the gimp brush folder, almost 2.0 GB of Brushes. Now GIMP crashes.
GLib-ERROR gmem.c:165 failed to allocate
And shuts down with a run time error.How do I get around this and is there a limit on the number of brushes that GIMP can handle?
View 4 Replies
View Related
Feb 6, 2012
I've got a large job and Object Isolate has been good for our drawing prodeuction but now we're running into some glitches on a regular basis the last few weeks.
1st Undo is being disabled. Thia really only started since we've begun plotting drawings and Isolating objects.
2nd We can't isolate everything. Is there a limit to the number of objects that can be isolated? or anything that controls that?
View 2 Replies
View Related
Oct 18, 2012
Does Photoshop Elements 10 limit the number of styles that can be installed at one time? I can't seem to load in any more than I already have. If so, how to I have access to others? There doesn't seem to be a place where I can load new styles like you can with brushes.
View 2 Replies
View Related
May 4, 2013
I swear I remember being able to limit the number of files that came up on startup to speed up E-9, but can't find it anywhere!
View 2 Replies
View Related
Nov 10, 2012
Is there any limit to the number of images that can be put into a PSE10 catalog? If so, what is the limit?
View 3 Replies
View Related
Feb 22, 2012
Is there a setting to not have adobe Photoshop round up or down to the nearest full number? My X-rite scanner reads in the hundreds and I would like more color accuracy.
I read here that humans can't see any difference smaller than 1. I disagree, maybe 1 in the L value, but a and b seem to be a little less.
View 1 Replies
View Related
Oct 15, 2013
So I have created 2 text fields via composition ready
$("<input type='text' value='' name='input1' id='input1' size='5'>").appendTo("#Stage");
sym.$("#input1").css({"position":"absolute","top":"70px", "left":"52px"});
$("<input type='text' value='' name='input2' id='input2' size='5'>").appendTo("#Stage");
sym.$("#input2").css({"position":"absolute","top":"90px", "left":"52px"});
input1 AND input2.
The user then puts a number in each field.
I have a 3rd field created to hold the answer. I also made a text field with the name "scorefield" to see if that would work, either will do.
Then on a button on the stage, the user clicks on it to add those first two numbers together and have the sum appear in the 3rd field or the text field that has the symbol name "scorefield".
However I can not seem to be able to add the 2 values of the text fields. On the submit button I have:
var number1 = $("#input1").val();
var number2 = $("#input2").val();
var additionresult = number1 + number2;
sym.$('scorefield').html(additionresult);
answer1.value = additionresult;
The problem is that it is NOT adding number1 and number2 together!
If I substitute + for - or / or * it works using those symbols, but if I try to use the plus sign and add the two, it does not work and instead physically adds the numbers next to eachtoher.
So If I were to put a 5 in field one, and a 2 in field 2, the result comes out to be 52...instead of adding the two values, it places them next to eachother.
I know those ARE numeric values because any other mathamatical sign works. I can multiplay, subtract and divide those two numbers. I can even check to se if its higher or lower of a value using > or <.
But when I use the + sign, it breaks.
Is there some other sign I must use to add two values?
View 2 Replies
View Related
Aug 1, 2012
I'm fumbling around with a Python script. Is it possible to make an input dialog with a "Browse" button so the user can find a folder (to be loaded into a variable in the script)?
View 5 Replies
View Related
Jan 20, 2011
I have created a column graph with a large amount of data. I would like to apply two different colors to the positive and negative columns. Whenever I click on a column and go to object>graph> the column section is unavailable. I checked to see if the graph had become ungrouped, even though I never selected it. If I select the graph as a whole it does not say ungrouped. When I select a column the ungroup tab is greyed out. Does that mean my columns are ungrouped?
View 6 Replies
View Related
Sep 14, 2012
I want to image trace this photo to create logo. However the way the logo will be applied means that there can be no negative space less than .35mm or 1pt or the heat transfer will have them blend together.
How can I image trace while maintain all spaces (both positive and negative) are atleast 1pt sq?
View 3 Replies
View Related
Dec 18, 2012
I'm try to automate the importing of the Varaible and datasets into my graphs via Scripting, but the ImportVaraibles() function doesn't seem to work. Here is my Script, mostly copied from the example script provided with Illustrator (CS5). And, this works manually, using the file names in the script, via Load Variable Library
Set appRef = CreateObject(strIllistratorVersion)
'Open the file and import the datasets
Set docRef = appRef.Open(strTemplate & "200-500.ai")
'docRef.Datasets.RemoveAll
docRef.Variables("Yearbook").Delete
Here is the problem, after I delete the previous library, then this next line, right from the example, does nothing
The script then exits with 'No Datasets in this document'
docRef.ImportVariables (strXMLFolder & "Lumber_200-500.xml")
'appRef.DoJavaScript "alert('Template:" & strTemplate & strRange & ".ai | XML file:" & strXMLFolder & "" & objFile.Name & "^')"
If (appRef.Documents.Count > 0) Then
Set docRef = appRef.Documents(1)
[Code]....
If I remove that delete line, the script runs, but just uses whatever Variables I had last loaded, not the XML file.
It's simply not loading. What do I need to do to get it to load?
View 8 Replies
View Related
May 6, 2012
Can you access graph data through the scripting DOM?
View 3 Replies
View Related
Mar 14, 2013
I'm trying to create a 283.28" by 85" document, but the 283.28" part keeps automatically changing to 227.54". Is there some kind of size limit? What am I missing?
View 4 Replies
View Related
Apr 17, 2013
When I tried to scale an object to more than 200%, I kept getting the message that this would make some objects too large. I tried making my artboard larger but still got the same message. Am I doing something wrong?
View 2 Replies
View Related
Aug 3, 2012
I'm having a bit of problem with my CS6 Illustrator and it started in illustrator CS5, I can create an eps file within Illustrator save it as CS6, but when i go to open it again i get an error " Can't open the illustration. The illustration exceeds an implementation limit. I get an option to click ok and when i do i get a blank artboard with nothing on it.
I can see the artwork preview in the finder window when i select the eps file, I can open it in photoshop, convert it in preivew and if i place the file back into illustrator i can see the artwork and click embed to edit it.
View 2 Replies
View Related
Jun 26, 2012
This came to my attention around the CS4 era, but I've recently noticed still remains with CS6 - but just why is there a limit as to what image sizes we can export PNG files at [AKA around the 8000x8000 area at 400dpi for me]?
Surely as long as we have the computing power [and RAM] than we should be able to export beyond the 10000/400dpi pixels range [or does it depend on the computer]?
View 6 Replies
View Related
Aug 14, 2013
I've got some letters with a black inside stroke. These are 3D letters, therefore the stroke must be in the inside otherwise it spills out the edges if I put it outside or centered.
I've tried adjusting the cap/limit and all other options on the stroke menu without luck How can I fix these corner errors? I'm on Illustrator CS5.
View 4 Replies
View Related
Feb 4, 2013
My need is to create up to 50 points from the same origin in a three dimensional Cartesian coordinate system but I’d also like to have a labels for each point that show up in the feature tree.
Are there Inventor 2013 plugin (i.e., add-on, 3rd party, AP) to convert a list 3D Cartesian coordinate system locations (i.e., points) to Inventor to work points(x, y, z)?
I found that I cannot create 3D points in the assembly. Is this correct? I did find that an Inventor part may be used to create a 3D sketch that creates points in 3D space. In the past few days, I found two ways to create 3D points within a iPRT; the batch way uses an Excel file but it then does not allow me to name the points in the feature tree. The second way is to create them one at a time but that take way too much time.
View 4 Replies
View Related
Feb 25, 2012
I saw another thread on this, but it went unanswered, so I am going to ask it with some better information.I installed inventor pro 2012, and it was working fine for a few days, but it now is missing the input boxes for the Precise Input window. URL....
View 5 Replies
View Related