Illustrator Scripting :: How To Get User Input Via Prompt
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]...
Is there a method available to have the plugin pause and wait for a user to click some object, then continue? Or does all user interaction have to happen before/after the plugin is run?
Is there a way to allow user to select multiple files inside the file dialog using scripts? So not just something like "*.ai" or "*.eps" but where the user can actually use their shift key to select a batch of files inside the file dialog and then the script would process each one.
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?
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.
What or where is the setting to change the dimension value input to automatic rather than accepting the default every time I put a dimension in? I don't want to be prompted for input.
I'm building a script that will open a dialog box allowing the user to select a font family from a drop down list (not a list of all of the fonts), and then compare that value against the fonts that are in use, highlighting everything that doesn't match. I have not yet built the dialog, but I've got everything else working as I want except the list of font families.
The following code loops through the list of fonts (only 20 for testing purposes), compares the family name to the previous on the list (error trapped for the first loop), and pushes the family name (if it doesn't match the previous) into an array which will be used in the dialog box. With the two alerts at the bottom (for troubleshooting), I expect the alerts to show the same family name. For the first three fonts they do, but after that the array value is "undefined."
var iCount = 20; //var iCount = textFonts.length; var nameHolder = ""; var nameArray = new Array();
[Code]...
Questions:
1) Any speculation on why this behavior is happening (it isn't truetype versus opentype)? 2) Is there a better way to get the list of font families without duplicates?? 2) Is an array the best way to populate a dropdown list in a JS dialog box??? [this will be my first dialog with a dropdown, the others have user-typed values]
EDIT: Additional Info When it reaches the ninth font in the list, the above script starts writing undefined, but when tested manually, as below, it works fine. Hmmm.
alert (textFonts[9].family); var nameArray = new Array(); nameArray.push(textFonts[9].family); alert (nameArray[0]);
EDIT: More info tried replacing nameArray.push(familyName); with nameArray.splice(i,0,familyName); bad behavior remains
I need my users to pick a point p, enter a distance r and a direction v. A new point should be created r units away in vectorial direction. Therefore, the new point is located on an imaginary circle with radius r and center p.
Currently, the user picks the first point and enters a distance. Then, he has to pick another point (Editor.GetPoint with UseBasePoint = true), I calculate the vector between both points, create a new point (with location = BasePoint.location) and translate it d units in vectorial direction. This works of course, but the problem is, that the user doesn't see directly, where his new point is located, since he may pick a point closer to or farther away then r units.
Naively spoken, I want to restrict the line between BasePoint and new point while prompting the user to a fixed length. Native calls to ObjectARX-methods would be also okay.
The template has two user input box (User and Password). I did all the design modifications to the template, but when I want to save it for web, both user input are only images, and the user can't write anything on it.
I develop addins for Inventor primarily, so the AutoCAD api is very new to me. I'm working in AutoCAD 2010 and visual studio 2012.
I've looked at many posts for getting block attributes, but they either seem to assume I already have the Blockreference, or they give a prompt to the user. I'm hoping to avoid both of those.
I know the info I need is inside of a blockTable by the name of "DET".
Database acCurDb = openDoc.Database;using (Transaction acTrans = CurDb.TransactionManager.StartTransaction()) { //How can I access the blockreference in here which corresponds to the blockTable "DET"? }
Any way to trap when the user hits the escape key without a user input function. The idea is to loop infinitely and perform some analysis until the user hits the escape key.
I suppose I could do the same thing with a form but I would not.
I'm trying to build an action that makes thumbnails out of images and adds a few effects, but I want it to let me select what area of the image it takes the thumbnail from and making that thumbnail size instead of shrinking the whole thing to 100x100 and losing all the detail. Any suggestions?
I want to create an action that will take individual pictures and put them on a template, and then ask for user input as to the name, year, etc. How do I get a user input box? If i can't get a user input box,
Create a Form that can be sent to a customer as an email attachment. The customer must be able to Save and Open the Form with software that is available on most Windows computers. The customer should then be able to enter the requested information in the Form, Save the Form and then attach it to an email and return it to the sender.
I could achieve the above using MS Word. But it is a real pain to layout a complex Form using Word. I would much prefer to do this using DP6 as it is considerably easier to lay the Form out.
But... I simply cannot see a DP6 Export file-format that I could use to achieve this result.
I have a form with some textbox on it, which should be filled in with imperial dimension. Like foot and inch. Users right now complain about it is not user friendly ,to put data in form, and honestly they are right. I didn't a good job .
Some people like to put vetting in inch and then by the time textbox lost it focus it should automatically convert data to feet-inch format. Some other user like to put decimal I have to be able to should them in 1/8 inch.
some user like to use space as separator between foot and inch and some other like to use dash.
Bottom line I stocked. Is there any function for this in autocad ?
when I look at my code I just struggled with pure string. I thought maybe there is something in autocad which give developer this option. Like the way we input dimension in command prompt.
I have got a problem about getting user input. In a function i am first getting a selection from the user by editor.getselection(...)
then i show a palette set with my user control in the same function. everything is fine so far.
but after showing paletteset i try to get a string from the user by editor.getstring(...) in the same function but statement continues as i never request it. when i check the PromptResult status it is equal to cancel.
i tried to lock the document but it doesnt work either. when i comment out "showpalette(true)" it works correctly. i realized that if my document window s state is not WindowState.Maximized then my code works just fine but if it is WindowState.Maximized it does not work.
I'm inquiring whether or not it is possible for Revit ceilings to be customized by the input of a user regarding the shapes and sizes without using a .pat file. Almost like a parametric object with predefined limitations. For example: a rectangular ceiling tile 'x' can be from 6 inches to 10 feet and side 'y' can be from 6 inches to 6 feet. So someone can select the ceiling type and actually input what size 'x' and 'y' they'd like while staying within those limitations.
Is there any way to save colors to the Paint.net Palette, For instance, I have a list of colors made from user input and I want to put the in the palette...any code for that? Is that a valid Urinary Pixel Operation?
I made a toolbar button with the macros @, and tried also @ pause.
I need this in order to shorten the procedure for relative coordinate input, but, after pressing the button the last point is entered and i cannot continue entering values like in the manual input at the command like, like: @5,5
Even if i use the "@ pause " sequence it doesn't work.
I want to write a very simple AutoLISP program to scale selected objects by a factor of (1/25.4). How to I get the program to pause and allow the user to select the base point? I know that "~" will bring up a selection window, but what is the character that will allow point selection (in this context)? While we're at it, what is the operator that would trigger a pause and allow user command line input?
Is there a way to have an alert box pop up at a certain point in the code which gives the user a chance to cancel the LISP program and not proceed any further?