Dialog results 'not a number '.

Hello! I am new to InDesign scripting (to date) and has difficulties with the help of dialog box results in my script. The script that I put in place creates calligraphy guide line to the bottom of a page and got this works well but then wanted to be able to specify the distance between the lines in a dialog box, rather than in the script, and it does not work now.

I know that everything from line 43 down works if I remove the dialog box and create variables using parseInt() rather than pulling them from the box of dialogue, but as soon as I try to use the values of the dialog box, what happens with error on line 60 30491 that ascenderHeight is not a number (and so he can probably use it to calculate in geometricBounds). I tried to convert a variable to test entire under line 43, but it makes no difference. Initially, I used the measurementEditBox as in the tutorial of InDesign scripting, but thought that the whole it would remove any excess baggage. If someone could let me know where I am going wrong, I would really appreciate it!

var myDialog = app.dialogs.add({name: "Set line guide parameters",canCancel:true}) ;
with (myDialog){
//Add labels dialog column.
with(dialogColumns.add()){
    staticTexts.add({staticLabel:"X-height to ascender (mm)"});
    staticTexts.add({staticLabel:"X-height (mm)"});
    staticTexts.add({staticLabel:"Descender height (mm)"});
    staticTexts.add({staticLabel:"Slant angle"});
    }


//Add entry dialog column
with(dialogColumns.add()){
  //Create integer & angle entry fields.
    var ascenderHeightField = integerEditboxes.add({editValue:5}) ;
    var xHeightmmField = integerEditboxes.add({editValue:5}) ;
    var descenderHeightField = integerEditboxes.add({editValue:2}) ;
    var slantAngleField = angleEditboxes.add({editValue:-30}) ;
}
}
    //Display the dialog box.
    var myResult = myDialog.show() ;
    if (myResult == true) {
        //Get the values from the dialog box controls
        var ascenderHeight = ascenderHeightField;
        var xHeightmm = xHeightmmField;
        var descenderHeight = descenderHeightField;
        var slantAngle = slantAngleField;
        //Remove the dialog box from memory.
        myDialog.destroy();
        buildGuide (ascenderHeight, xHeightmm, descenderHeight, slantAngle);
        }
    else{
        myDialog.destroy() ;
        }
    






function buildGuide (ascenderHeight, xHeightmm, descenderHeight, slantAngle) {
    
var ascenderHeight = parseInt(ascenderHeight);


var lineHeight = (descenderHeight+xHeightmm+ascenderHeight);


//Create lines for guide, specified distance apart on margin of 13mm (set this in variables once maths is working!)


var capHeight = app.activeWindow.activePage.graphicLines.add() ;
capHeight.geometricBounds = [13, 13, 13, 197] ;
capHeight.strokeWeight = 2 ;


var xHeight = app.activeWindow.activePage.graphicLines.add() ;
xHeight.geometricBounds = [(13+ ascenderHeight), 13, (13+ ascenderHeight), 197] ;
xHeight.strokeWeight = 1.5 ;


var baseLine = app.activeWindow.activePage.graphicLines.add() ;
baseLine.geometricBounds = [(13+ +ascenderHeight+ xHeightmm), 13, (13+ascenderHeight+xHeightmm), 197] ;
baseLine.strokeWeight = 2 ;


var Descender = app.activeWindow.activePage.graphicLines.add() ;
Descender.geometricBounds = [(13+lineHeight), 13, (13+lineHeight), 197] ;
Descender.strokeWeight = 1.5 ; 


/*app.activeDocument.distribute(
app.activeWindow.activeSpread.pageItems.everyItem().getElements(),
DistributeOptions.VERTICAL_SPACE, undefined, true, xHeightmm);*/ 


//Create an x to mark the baseline and a diagonal at specified slant
var lineMarker = app.activeWindow.activePage.textFrames.add() ;
lineMarker.geometricBounds = [(13+ascenderHeight), 13,(13+lineHeight),17] ;
lineMarker.contents = "X" ;


var Diagonal = app.activeWindow.activePage.graphicLines.add() ;
Diagonal.geometricBounds = [13, 30, (13+lineHeight+2), 30] ;
Diagonal.strokeWeight = 1.5 ;
Diagonal.absoluteRotationAngle = slantAngle ;


//Group all created then duplicate down length of page
var myGroup = new Array () ;
myGroup.push(capHeight) ;
myGroup.push(xHeight) ;
myGroup.push(baseLine) ;
myGroup.push(Descender) ;
myGroup.push(lineMarker) ;
myGroup.push(Diagonal) ;
var myLineGroup = app.activeWindow.activePage.groups.add(myGroup);


var myGroup2 = myLineGroup.duplicate(undefined,[0,lineHeight+2]);


for (var i = lineHeight+2; i < (271-lineHeight); i=i+lineHeight+2){
    var dup_groups = app.activeWindow.activePage.groups.lastItem().duplicate(undefined, [0,i]) ;
    } ; 


} ;

Without going into all of your script, let's look at your dialog box:

Take the code to your dialog box and copy it to a separate script.

Now instead of calling the construction guide, replace this line with a test to check the values of variables:

[ascenderHeight, xHeightmm, descenderHeight, slantAngle];

When you run the script, you will see where is your problem: the result is:

Result: [object IntegerEditbox], [IntegerEditbox object], [object IntegerEditbox] [object AngleEditbox]

You have found a reference for widgets dialog box, not the edit value.

Add .editValue to each of your definitions of variables so that they read:

var ascenderHeight = ascenderHeightField.editValue;

var xHeightmm = xHeightmmField.editValue;

var descenderHeight = descenderHeightField.editValue;

var slantAngle = slantAngleField.editValue;

This should solve your problem.

Bottom line: when you encounter problems, isolate the code and assess the results.

I hope this helps.

Tags: InDesign

Similar Questions

  • Refnum control is not a number/path/refnum

    Hi all

    I'm working on a LV7.1 program. It has a control refnum on the façade. If this control is not signed by the appellant, the follow-up 'Not a number/path/refnum' will return TRUE. It's like a 'default'. But I don't know how to implement this function. I mean, I can't find a way to set the control of refnum with a default value as "not a number/path/refnum". Can someone give me a hint?

    Thank you

    stable

    Under file e / s-> constants file, there is a constant "not a Refnum". (Why under file e/s? Do not know?)

    You can change your control to an indicator, it wire up to now, the VI run once and then change things at the back (you now have not a Refnum value).  You can then make it worth stick by right-clicking on the control of data operations by choosing-> do default to the current value.

    This assumes that the control has managed to be pre-initialized with one value other than not a refnum.

  • Impossible to check the FPGA reference with "not a number/path/Refnum?

    How can I check if an FPGA interface refnum is valid?  It seems (LabVIEW 2009) that "Not a number/path/Refnum?" always returns true when connected to the output of open FPGA VI reference.  I write code that needs to be able to run without an FPGA for testing purposes, so I wrapped all calls to the FPGA in a case structure that I thought would run only if the FPGA reference is valid.  Turns out that they run ever, even when the FPGA reference is valid (probe shows it has a numerical value, and the FPGA VI is running).  I guess it's sort of similar to semaphore and appointment of references that have their own special function to verify the validity, but I do not see such a function for FPGA.  I have to cast to int and check if it is not equal to zero?


  • Why do write can not be performed because the number of data channels does not match number of channels in the task.

    Possible reasons:

    Scripture cannot be performed because the number of data channels does not match number of channels in the task.

    When writing, provide data for all channels in the task. You can also change the task so that it contains the same number of channels as the written data.

    Number of job channels: 8
    Number of data channels: 1

    Lama says:

    The DAQmx vi writing gives me the error. If I run a single channel, isn't a problem. Multichannel gives me error.

    You are funny! Why tie yourself to work VI (single channel) instead of one that gives you errors (multichannel)?

    (If your car does not work, you bring car your wives to the mechanic, right!)

    What is the exact text in the multichannel 'physical channels' when you do the AO control?

    Lama says:

    I did a sequence to ensure that each function has been run in the correct order. Wouldn't a race condition.

    All you have to do is wire the 'start of task' error at the entrance of error of the DAQ assistant and then back to 'stop task' and things will run in order. Guaranteed! Think the stream! Everything else can run in parallel or the order is irrelevant.

    First convert the sequence stacked to a sequence of plate, remove the flat sequence and add the mentioned son. Now, do a "cleaning pattern.

    A when stacked with the inhabitants of the sequence is one of the worst construction you can possibly do. It makes the code difficult to follow, impossible to maintain, difficult to debug.

  • Not a number/path/Refnum? Does not work with a reference SE

    Hi all

    I am writing a LabVIEW application and check that the Switch Executive session is valid before I allow the user to validate the test to run. I connect the not A number/path/Refnum? Function to reference session SE and it connects correctly, but the output of the function is never wrong even though I see the session reference is valid and non-null. Any ideas why this is?

    Thank you

    Nick

    It was a trick to convert a reference internal in an external shared library (usually a pointer memory) in a datalog refnum strict typedefed. This safely prevents a user to connect to what anyone, but this type of refnum at the VI in question. But this wasn't really a datalog refnum and the is not a number/path/Refnum refnum, which subsystem to question the validity of a refnum to determine based on the subtype. The LabVIEW datalog Manager ever created this refnum and hence will return correctly (not one of my refnums which is currently known to be valid).

    Because of this problem the misuse of datalog refnums as a unique resource identifier has been abandoned more in recent years. Also it will work with any external resources representing pointers memory when using 64-bit LabVIEW, since memory pointers are big in this 64-bit environment LabVIEW refnums are still 32-bit.

    Collate OR if they have a newer version of the Switch Executive in gestation or perhaps already out.

  • Not a number/path/refnum simple Boolean?

    Y at - it an easy way for not a number/path/refnum return a single Boolean value telling if the entry had NaN // any where in its structure.

    I have a cluster of clusters of references I want to validate but I can't find an easy way to convert something that I can get a single Boolean of the structure. If only there wasn't a single cluster I would convert it the cluster in a table then or the elements of the array to see if it had references not valid.

    I did the examples above with NaN because it is easier to show than references.

    If I'm not mistaken, the in-memory representation for a cluster of clusters of Boolean data should be the same as a 1 d of Boolean array, so I think you should be able to type cast to a 1 d of Boolean array, you can then OR.

  • I have a new computer with Windows 10 and will use Acrobat 9.0 Standard of my old computer (Windows 7). I download the program for Adpbe and when I install it so I put my serial number and get the answer, it is not a number valid serial. What it takes

    I have a new computer with Windows 10 and I use Acrobat 9.0 Standard of my old computer (Windows 7). I download the program from Adobe, and when I install it then I put my serial number and get the response "is not a number valid serial. What should do? I have an account at Adobe with all my serial number

    Hi rolfb13339293,

    I would like to inform you that acrobat 9 is not compatible with windows 10.

    You can check system requirements here: Adobe Acrobat required configuration

    The latest version is Acrobat DC.

    Please let us know if you need additional assistance.

    Concerning

    Sarojini

  • What settings can I change my captivate program so that when a user does the program into an LMS they are marked as being completed when they hit a specific slide (not a number of slides) or the percentage of slides

    What settings can I change my captivate program so that when a user does the program into an LMS they are marked as being completed when they hit a specific slide (not a number of slides) or the percentage of slides

    I have duplicate slides that the user can jump. When they do the program is marked as progress when really, they have seen everything but technically not each slide.

    I wish that the LMS to makr as complete when they consult the last slide so that they are marked as being completed independently to know if they jumped the previous slides.

    Thank you. In fact, I managed to find a solution that does not require the user to press the button! You can add an action to a slide itself using Javascript execution on success. In the Script window, you add that scorm_setcompleted() and that tell of the SGA to mark the complete project on enter on this slide. So that's what to do if someone reads this

  • How to let lightroom shows the number of files actrual in a card and not a number whose total all submaps?

    How to let lightroom shows the number of files actrual in a card and not a number whose total all submaps?

    If by 'map', you hear directory or folder, in the library menu there is a toggle to "see the pictures in subfolders.

  • Not a number

    When the enemy reached the player, health must come down, but it says NaN (not a number).

    The name of the instance of the health life text, it is a dynamic text and the variable is health.

    1 (menu) frame:

    Health = 0

    2 (level) frame:

    Life.Text = ' health: "+ health;»

    Player:
    If (this.hitTest (_root.enemy))
    {
    _root. Health-= 1;
    }

    which variable allows you to keep your player's health should NOT be a textfield variable.

  • Not a number errors

    I'm trying to set up a text box that displays different text each time a button is pressed. It will display different text on slide 1, slide 2, etc.

    var slideNumber:Number = 1;
    var slide1:String = "Some Text"
    var slide2:String = "Text" more
    etc...
    var narration_str:String;

    my_btn.onRelease = function() {}
    narration_str = slide + slideNumber;
    }


    I receive not a number errors, so I think that I have to convert the slideNumber into a string to make it readable. Or, if it's not her suggestions? Thank you.

    var slide1:String = "please work!
    var slideNumber:Number = 1;
    var display_str = this ["slide" + slideNumber.toString ()];

    trace (this ["Slide" + slideNumber.ToString ()]);

  • Button change dialog results in the research does not launch an editor (RH11)

    It's a question since HR is passed to the interface of multi-doc, but I just worked around it so far.

    I'm looking for a specific string and then I need to edit each file where it occurs. Won't a simple replacement.

    After using find & replace in files I get a list of topic titles in the search results dialog box. If I right click on a file name and choose the command Edition or or double-click a result in the list, I get a window which allows me to only replace, all replace, cancel, then file or save.

    How to open a file from the search results in the editor of HR? Or even any editor? The login window is not a Publisher.


    Right now, I put the search results on the left, list of topics on the right (sort by file name) and manually open and edit each file in the list of topics. It is painful and slow.


    If it got better in 2015? I cannot upgrade this project but would be good to know for future reference.


    Thank you!

    Jeanne

    Yes in RoboHelp 2015 the topic opens in the design editor where you can edit in the normal way.

    See www.grainge.org for creating tips and RoboHelp

    @petergrainge

  • View of the AppleScript dialog box not turn

    Hello

    I have the following Applescript, defined as the first step of a folder automator action.  When the two files in the folder, a display dialog box is supposed to pop up.  It works, but for some reason that the dialog box is not selected, so I have to click on it first, before I can enter data.  It's tedious because I use a scanner barcoder and want him to be able to enter information in the dialog box without clicking each time.  Any ideas as to what is wrong?

    Thank you!

    value of ' Macintosh HD:Users:christian:Pictures:Photo Booth library: photos:

    Tell application "Finder".

    Define filenumber as of (files in the folder appear)

    tell the end

    If filenumber is equal to 2, then

    display the default dialog response «Serial number "«»

    SerialNumber Set text returned of the result

    Returns the number of series

    on the other

    tell me to stop smoking

    end if

    When I run your AppleScript under workflow action unique in a file Automator action, the dialog box will prompt you for a serial number, and as text entry already has the focus, all I have to do is type the serial number, then press return. Tested: OS X El Capitan 10.11.2.

  • The upgrade to service pack 2, it tells me this driver does not work: number-967752 MSDSM

    I'm running Sp1 and experience a few crashes need to update my PC, vista 64 bit sp2. But he said that a driver will be compatible and it has no solutions. It gives me the number 967752 after MSDSM please read article microsoft knowladge base. I don't know that to continue with the update or not.

    Thank you
    Tomtastic

    Also I would say that the blue screen, I received several times last night for normal use. Something about minidump and his qorrying me, the laptop is not even a day old yet and I got the blue screen, as long as the office, we had for 9 years now. Is this vista mess up or do I need to get a new laptop?

    Thanks again

    Hey CLJ3,

    I've also heard mention KB972036 up-to-date potentially causing such problems in some areas but I have not yet confirmed.  If you don't see the KB973879 check to see if you have KB972036 instead and try to remove that one to see if it solves the problem to uninstall an update.  Please ensure you view with your results.  If it does not resolve the issue please make sure to reinstall the update that has just been uninstalled to secure the.

    I hope this helps.

    If you find my answer was what you're looking for, remember to click on the box "mark as answer" below!

  • Page ARE 3300 Audit Export CSV results not correct

    When the file on an ES3300 with Firmware version 8.2.1.4969 of audit trying to export to the CSV file, it will only export the contents of the 1st page of results, regardless of the page is displayed. For example, I select a range of dates with 400 records to display per page. All resulting has 495 records, so there are two pages of results; 400 on the 1st page and 95 on the second. If I click on the export to CSV button, only 1 400 enrigestrements to the CSV file regardless if I'm on the 1st page or page 2. It does not export the 495 full records.

    Is this new behavior, or has it always been broken? Trying to create reports on the volume of e-mail to and from specific e-mail addresses will be problematic if we cannot work with the limited selections in order to less then 400 records are returned

    I can confirm that that has been fixed in paragraph 8.3. It now returns a maximum of 20,000 files if there is no filter in the audit log.

    Problem solved
    163544 ID number
    Only the first page of data is exported by the cvs export audit > Messages page to view incoming or outgoing.
    Occurs when clients include characters that are allowed in the game in the channels marked as GB2312 GB18030 characters.

Maybe you are looking for

  • I hear myself in the headphones as I speak. How to cancel it?

    I noticed that when I use Skype, while I am talking to the other person, I hear an echo of something I say. How can I cancel this feedback?

  • Is there anything like Tivo for computers?

    Greetings my friends smarter. Well Tiff has a type 'Blonde Girl' of question... but strangely enough, she's a flamboyant redhead!... go figure... must have the blond roots?  Welcome back to the question. Is there a kind of Tivo service/device of a co

  • Amazon cloud player doesn't work with no more just error message

    Amazon cloud player leaves just at different times for no reason known in Windows 8.  The drive opens and has my music, but can simply stop while I use it.  At any specific time or during any specific task; just closed unexpectedly and simply looking

  • Performance problem: entries needing

    Dear all,I have the SECONDARY table with 100 plate having indexes on key columns that are frequently used for filter criteria in my application. If I create a table nested with only key column and the primary key of the DETAIL table and then use this

  • SQL Server edition full for vCenter Server 6.0

    HelloJust learn that vCenter 6.0 does not support SQL Server Express.We intend to use SQL Server 2008R2 as the database of vCenter Server 6.We would like to ask for your opinion if we should use the full 32-bit or 64-bit SQL Server Edition?  For SQL