Error "app.addMenuItem is not a function".

Hey,.

New to Acrobat and Javascript in general.  I wanted to be able to create a custom toolbar with four buttons when a document is loaded (we don't want the buttons on the documents themselves), and I copied and pasted the following code in a module named "Open" to give me an example of how the controls work.  When I run it, I get the error in the title of the thread.  So I copied the first block of code - the "addMenuItem" command in the Javascript console and tried to run from there, and I get the same error.  Someone has an idea of what's going on here?  Thanks for any help you can give me.

function() {return A.apply (null, [this] .concat ($A (arguments)))}


//-------------------------------------------------------------
-Do not change the tags XML-
//-------------------------------------------------------------

> to the document level.
Open < ACRO_source > < / ACRO_source >
< ACRO_script >
/ * belongs to: Document-level: open * /.
var atbtoolbuttons;
app.addMenuItem({)
cName: "atbToolButtonSet."
cUser: "my Menu."
cParent: 'tools. '
cMarked: "event.rc = ((typeof atbtoolbuttons! = "undefined") & &! atbtoolbuttons). "
cEnable: "event.rc = (event.target == null);"
cExec: 'loadATBToolButton();', NPO: 0
});

var loadATBToolButton = app.trustedFunction (function)
{
If (typeof atbtoolbuttons is "undefined")
atbtoolbuttons = true;
else {}
If (! atbtoolbuttons) {}
app.removeToolButton ("atbToolButton1");
app.removeToolButton ("atbToolButton2");
atbtoolbuttons = true;
return;
}
}
If {(atbtoolbuttons)
app.beginPriv ();
Get the path to the folder the user JavaScript
var atbPath = app.getPath ({cCategory: Cfolders, "user": "javascript"});
try {}
Try to open the doc of the icon as in hidden mode and recover his doc
object.
var doc = app.openDoc ({}
cPath: atbPath + "/ icon_toolbar.pdf" {, acachees: true}); ' "
} catch (e) {console.println ("could not open file icon"); return ;}}
Get the flow of the hidden myIcon1 of the doc icon
var oIcon = util.iconStreamFromIcon (doc.getIcon ("myIcon1"));
Add a tool button using this icon
app.addToolButton({)
cName: "atbToolButton1."
oIcon: oIcon,.
cExec: 'atbTask1();',
cTooltext: "my toolbar button 1."
NPO: 0
});

Download now myIcon2 of the document hidden.
oIcon = util.iconStreamFromIcon (doc.getIcon ("myIcon2"));
and install this toolbar and button
app.addToolButton({)
cName: "atbToolButton2."
oIcon: oIcon,.
cExec: "atbTask2()."
cTooltext: "my toolbar button 2."
NPO: 0
});
Close our document hidden with the icons.
doc.closeDoc ();
app.endPriv ();
Set this variable to point out that the toolbars are installed.
atbtoolbuttons = false;
}
})

< / ACRO_script >
< / at the level of the document >

In the documentation, read the note for the addMenuItem method.

Tags: Acrobat

Similar Questions

  • TypeError: app.execDialog is not a function

    I created a dynamic stamp with the following code in the JavaScript section for a TextBox on the stamp.  App.alert message, the custom (very simple) dialog box does not appear, and I see this error in the console JavaScript in 2015 of matrix AcroPlot: TypeError: app.execDialog is not a function

    var oDlg = {}

    Description: {name: 'Dialogue box Test', items: []}

    {name: 'Hello World', type: "static_text"},

    {type: 'ok'},

    ] }

    };

    If (event.source.forReal & & (event.source.stampName == "1cd91ce4-fd1f - 4 c 90-9caea76fd2ac6fbf"))

    {

    App.Alert ("HI");

    Activation of the dialog box

    app.execDialog (oDlg);

    }

    I edit in Adobe Acrobat Pro ms and test in AcroPlot matrix 2015.

    Thanks for taking a peek at this.

    It is unimportant to you, because we were talking about who runs the code

    Acrobat, that you do not.

    It seems that AcroPlot Matrix support not at all, the dialog object

    from what you described.

    This question might be more appropriate in a forum dedicated to that

    application, not in Acrobat.

    Wednesday, August 26, 2015, at 22:02, c31954441, [email protected]>

  • Error #1006: setChildIndex is not a function.

    This part of my application when I run:

    var topPosition:uint = this.numChildren - 1;

    .

    .

    .

    function showSettingPage2(event:MouseEvent):void
    {
    ...

    settingPage1.visible = false;
    settingPage2.visible = true;
    this.setChildIndex (settingPage2, topPosition);
    }

    I get this error:

    TypeError: Error #1006: setChildIndex is not a function.

    While in my app several times I used this method without error:

    this.setChildIndex (MovieClip, topPosition);

    Moreover, I know than the other method to put "settingPage2" on the top it is (and it works):

    stage.addChild (settingPage2);

    But I don't want to add a new child, please, someone knows why I get the above error?

    Thank you very much
    Ali

    because ' ' is not a displayobjectcontainer.  That is to say, check your goggle.

  • TypeError: Error #1006: value is not a function.   mdas_fla::MainTimeline/ans() problem

    can you help me with this. This error pop up when I run my fla file.

    TypeError: Error #1006: value is not a function.

    at mdas_fla::MainTimeline/ans()

    This is my code:

    import flash.events. *;

    Import flashx.textLayout.conversion.PlainTextExporter;

    equal_btn.addEventListener (MouseEvent.CLICK, years);

    function ans(event:MouseEvent):void

    {

    var op: Array = new Array (String [10]);

    var num:Array = new Array(Number[10]);

    var dock: String;

    result_txt. Text = input_txt.text;

    keep = input_txt.text;

    var g:int = 0; var ctr:int = 0; var ctr2:int = 0; var str:String ="";

    while(g < Hold.Length)

    {

    If (hold.charAt (g) == '+' | hold.charAt (g) == '-' | hold.charAt (g) == ' *' | hold.charAt (g) == ' / ')

    {

    OP [ctr] = ' "+ hold.charAt (g);

    trace (op [CTR]);

    CTR ++; Ctr2 ++; Str ="";

    }

    on the other

    {

    Str += ' ' + hold.charAt (g);

    NUM [ctr2] = parseInt (str);

    trace (num [Ctr2]);

    }

    g ++ ;

    }

    var pl:int = 0; var val: Number = 0;

    for (var a: int = 0; has < op.length (); a ++)

    {

    Try

    {

    If (op [a] == ' *')

    {

    NUM [pl + 1] = num [pl] * num [pl + 1];

    }

    ElseIf (op [a] == ' /')

    {

    NUM [pl + 1] = num [pl] / num [pl + 1];

    }

    ElseIf (op [a] == '+')

    {

    NUM [pl + 1] = num [pl] + num [pl + 1];

    }

    on the other

    {

    NUM [pl + 1] is [pl] - [pl + 1] num num;.

    }

    }

    catch (error)

    {

    Val = num [pl];

    break;

    }

    PL ++;

    }

    trace (Val);

    result_txt. Text = "" + val;

    }

    pls... Help me solve this problem...

    Length() must be of length.  That is to say, the class array has a length property, no method.  Flash thinks you are trying to define a new function, length().

    PS so that debugging, click file > publishing settings > swf and check the box "enable debugging" so the number of problematic line of your error (s) is in error messages.  This makes it much faster to debug your code.

  • Error #1006: textBoxSet is not a function

    Here's a little background on myself and this error:

    I tried to solve this problem for about 2 hours, no other than how or resolve. I am a Java programmer and the tutor in my school and to this language, because it was "easier" to have GUI, animation and interaction. As a result, I'm still stumbling around actionscript a little.

    As or right now, copy the following code is for 1) set up a red rectangle movieClip, 2) move 200 pixels and 3) do call a function "textBoxSet' of the VeggieDisplay class that is imported and supposed to work.

    1 and 2 work very well, because they are relatively easy steps. However, when I try to launch displayItem.textBoxSet (); I get:

    TypeError: Error #1006: textBoxSet is not a function.

    at ProduceProject_fla::MainTimeline/frame1()

    I'm not sure why this is happening. I have everything set up and it should work. The methods are not nested, etc. etc. and such.

    For now, that's all I ask. I don't want to worry about the other thing that does not work more later (class element is not set in the timeline when should not be etc..)

    Code in the Timeline to Frame 1:

    import packages. VegetableDisplay;

    var displayItem:VegetableDisplay = new VegetableDisplay();

    trace (displayItem);

    displayItem.x = 200;

    this.addChild (displayItem);

    displayItem.textBoxSet ();

    Code for VegetableDisplay:

    the package packages {}

    import flash.display.MovieClip;

    import packages. Vegetable;

    import flash.text.TextField;

    SerializableAttribute public class VegetableDisplay extends MovieClip {}

    public var veggieItem:Vegetable;

    two text boxes are in the movieclip

    var nameText:TextField = new TextField();

    var typeText:TextField = new TextField();

    "Builder". Do not build a large part

    public void VegetableDisplay() {}

    the constructor code

    trace ("9");

    veggieItem = new Vegetable();

    trace ("veggieItem" + veggieItem.getName ());

    }

    set these text boxes in the movieClip

    private void textBoxSet (): void {}

    trace ("in");

    nameText.text = veggieItem.getName ();

    typeText.text = veggieItem.getType ();

    }

    }

    }

    Class of vegetables:

    the package packages {}

    public class {vegetables

    / * Actually, I have a problem with this class as well. When values are called the form, they come as "not defined" rather than what they should be.

    Why and how I could fix TI * /.

    private var myName:String = new String();                                        element name

    private var typeNum:Number = 0;                                                                      0: vegetable 1: fruits

    private var myType:String = new String();                                        corresponding channel

    private var classNum:Number = 0;                                                            fruit kernels and other

    private var itemClass:String = new String();                                        corresponding channel

    private var growingSeason:Array;                                                            month

    private var growingArea:Array;                                                                      areas

    public void Vegetable() {}

    the constructor code

    myName = "tomato."                                                                                           temporary up to begin importing rather than static.

    myType = "fruit";

    }

    Get methods

    public function getName (): String {}

    return MyName;

    }

    public function getTypeNum (): number {}

    TypeNum return;

    }

    public function getType (): String {}

    Return myType;

    }

    public function getClassNum (): number {}

    Return classNum;

    }

    public function getItemClass (): String {}

    return itemClass;

    }

    public function getGrowingSeason (): Array {}

    return which;

    }

    public function getGrowingArea (): Array {}

    Return growingArea;

    }

    Methods of definition

    public void setName (mName) {}

    myName = mName;

    }

    public void setTypeNum (tyNum) {}

    typeNum = tyNum;

    }

    public void setMyType (mType) {}

    myType = mType;

    }

    public void setClassNum (claNum) {}

    classNum = claNum;

    }

    public void setItemClass (itClass) {}

    itemClass = itClass;

    }

    public void setGrowingSeason (growSeason) {}

    Which = growSeason;

    }

    public void setGrowingArea (growArea) {}

    growingArea = growArea;

    }

    }

    }

    Any help would be greatly appreciated. Thank you.

    Class vegetable added if anyone bothers to build the class and test. The composition of the text box is just a rectangle with two text boxes "nameText" and 'typeText' so far, the dynamic and other text value.

    Also realized that I have never done with the name of the issue, so I did it is less ambiguous.

    You can start with a new set of files.  If I am controlled by using your last interpretation of the VegetableDisplay class so that other elements of coding your first assignment I get no error and exit following...

    9

    veggieItem tomato

    [object VegetableDisplay]

    in

  • TypeError: Error #1006: value is not a function.

    I get this error:

    TypeError: Error #1006: value is not a function.
    at project_fla::MainTimeline/createMap()
    at project_fla::MainTimeline/frame1()

    The following actionscript code:

    [A]

    function createMap(target:Object,_map:Array,_tilesize:Number):void {}
    for (var ix:Number = 0; ix < card [0] .length; ix ++) {}
    for (var iy:Number = 0; iy < map.length; iy ++) {}
    This ["t" + String (IX) + "x" + String (iy)] = new Object();
    This ["t" + String (IX) + "x" + String (iy)] = new tile();
    This ["t" + String (IX) + "x" + String (iy)] .gotoAndStop (Map [ix] [Iy]);
    This ["t" + String (IX) + "x" + String (iy)] .x = Flxy (new Point(ix,iy), tilesize) .x;
    This ["t" + String (IX) + "x" + String (iy)] = Flxy (new Point(ix,iy), tilesize) there there;
    target.addChild (this ["t" + String (ix) + "x" + String (iy)]);
    }
    }
    }

    {/ A]

    What is the problem with the code?

    There are go. You must give your clip on stage an instance name - when you select the clip - the name of the instance is the field above the behavior instance drop-down list at the top of the properties panel.

  • App.Open () is not a function

    Hey

    Win7/PS2014x64

    At some point, these scripts have recently worked.  Ive changed, other things in the file (there is no clashes for the name "app") but not these functions.

    When I took a test the first time it happened, it would work if there is no other function in the file.

    Now when I try to access app.someMethod () it says that it is not a function.

    My script load in extendscript without error.  I have chosen as a target in extendscript photoshop.

    This happens on at least app.open () and app.stringIDtoTypeID () and app.documents

    When it stops on app.open () in the debugger, there is no application object in Data Explorer, vars only 2 of my friends and 'this' (which has a property app which is on behalf of my group, CEP)

    If I stop executing the script, the app object appears in the data browser

    do I make sure the application is available? a loop that keeps simply check to see if it is available?

    is this a bug?

    Thank you

    Chris rogers

    It was a name conflict.

    The solution is to declare outside the service at the beginning of the jsx file

    var app = app

    and PAP to reference the photoshop app and not the CEP app

  • Get the error: DROPDOWN list is not a function - works in IE9

    I'm trying to remove the default selected value in a drop-down list.

    The call to the function is the following:
    OnChange = "JavaScript:Remove_Default_Value (this); »

    Here's the function:

    function Remove_Default_Value(DROPDOWN) {
     var i = DROPDOWN.options.length - 1;
     for ( i; i >= 0; i--)
     {
      DROPDOWN(i).defaultSelected = false;
     }
    } 

    The error I get is "drop-DOWN list is not a function".

    Any ideas is greatly appreciated.

    It is not a function, but a table and you also use getElementsByTagName()

    function Remove_Default_Value(DROPDOWN) {
     var i = DROPDOWN.getElementsByTagName("option").length - 1;
     for ( i; i >= 0; i-- )
     {
      DROPDOWN.getElementsByTagName("option")[i].defaultSelected = false;
     }
    } 

    A good place to ask for advice on web development is to the 'Web Standards Development/evangelism' MozillaZine forum.

    Aid to this forum are better informed on issues related to web development.

    You must register on MozillaZine forum site to post in this forum.

  • error TypeError: Error #1006: invalidateList is not a function. ?

    Hello

    I update the data for a tree control. Whenever I call it tree.invalidateDisplayList () or tree.invalidateList (), I always get an error saying that it is not a function.  Someone saw this beast before and if you slayed it, what did you use.


    Here is the offending code:

    public void click(event:Event):void
    {
    var object: = dataTree.openItems;
    dataTree.invalidateList ();                              //Process kicks the buc KET here
    xmlList = new XMLListCollection (xml2.user);
    dataTree.openItems = object;
    }

    Sincerely,

    D

    The error is thrown because dataTree is an array of trees and it's because your tree is declared in a Repeater. You can access individual trees using the dataTree [0], dataTree [1], etc. However, I'm not sure of what to need to invalidate the trees because the Repeater will update after the click handler, causing the trees to be recreated.

    Also note that XML does not need to be declared as a string in Actionscript. Compile the following text:

    [Bindable]
    public var xml2:XML =


                 

    ;

  • error 1066 - drag is not a function.

    I have the following

    (1) Main.as - a document class

    (2) main.fla - the document with a circle

    (3) Drag.as - with drag code

    Drag is not a function is thrown. This means that main.as cannot access custom drag function but how is this possible if

    It is public and in the same folder?

    Thanks in advance.

    MAIN.as

    package {}

    import flash.display. *;
    import flash.events. *;
    import drag;

    SerializableAttribute public class Main extends MovieClip
    {

    public void Main (): void
    {
    circle. drag (); This is how you implement a method NOT Drag (circle);
    }


    }
    }

    DRAG.as

    package
    {
    import flash.display. *.
    import flash.events. *;
    //————————————
    Drag/public class extends MovieClip {}
    public var clip: MovieClip = new MovieClip();
    //————————————
    public void Drag() {}

    }
    public function drag (): void {}
    this.addEventListener (MouseEvent.MOUSE_DOWN, onMouseDownF) ;// we use it to indicate the object (instance of the class) who called (named) it.
    this.addEventListener (MouseEvent.MOUSE_UP, onMouseUpF);
    }
    //————————————
    private void onMouseDownF(e:Event):void {}
    this.startDrag)
    }
    //————————————
    private void onMouseUpF(e:Event):void {}
    this.stopDrag ();
    }
    }

    In addition, you must always specify namespace (such as public, private, protected, internal, etc.) when you declare variables.

    In addition, do not use datatyoe back with constructor. Constructor creates an object of the instance itself.

    Try this with the circle on the timeline:

    package {
         import flash.display.*;
         import flash.events.*;
    
         public class Main extends MovieClip
         {
         public var circle:Drag;
            public function Main()
            {
                   circle.drag();
              }
         }
    }
    
  • Unable to connect to Windows error app store "could not be installed.

    * Original title: problem of Windows 8 Store

    I have Windows 8 in my pc. The app store windows works and showing all the tools and applications available. But when I click to install it, it displays a message on the top right of the screen indicating this-"XYZ could not be installed. On checking the details, it shows that "you are not connected to internet" while I'm.

    I installed all windows updates, there is no firewall does not block the store and I use a proxy server connection to connect to the internet. Many of my friends using the same proxy server access and use the windows store. Also I can't update Windows 8.1 that the store does not work. Please address the issue.

    Hi Shubham,

    I would like to inform you that the proxy server is not recommended to access the app Store of Windows because it does not work, disable proxy server try the following methods and then try to connect to the Windows store.

    Method 1: Disable the Proxy Server.

    1. open Internet Explorer.

    2. click on the gear in the top right of the Internet Explorer icon.

    3. click on Internet Options.

    4. now click on the Connections tab and click LAN settings.

    5. clear the use a proxy server for your LAN box.

    6. now try to connect to the Windows store and see if it works.

    Method 2: If the steps above has not resolved the problem, I suggest you to refer to the article below and perform troubleshooting.

    Why can't find or install the application on the Windows Store?
    http://Windows.Microsoft.com/en-CA/Windows-8/why-find-install-app-Windows-store

     
    The use of proxies authenticated with Windows 8
    Additional information:

    If no help to the steps above, please refer to the procedure described in the article below to re-register the App Store.

    Hope this information can help, just reply to the State of the question for any other help.
  • DPS error App Builder could not the signed output file created because the certificates may be invalid

    Hello

    I work at the school and I use indesign dps for educational material. I generated folios of apple store and googleplay market.

    I loaded it to apple, but I did not charge for android.

    My problem is to create .p12 certificate and I used step by step this documant ().html http://helpx.adobe.com/digital-publishing-suite/kb/publishing-process-android-amazon-mobil)

    I have create this certificate with Terminal Server.

    Ekran Resmi 2012-12-05 08.44.26.jpg

    I load this certificate to dps generator app and the on-screen display is here.

    screenn.jpgscreen.jpg

    My version of folios and dps is the same. I can do really I don't know, can you help me please?

    I build of Android Applications just fine on my end, it looks like a specific problem or a system account. Contact the Gold technical support.

  • Error message: trim is not a function

    I can't get the standard string Trim() method works in Acro 11 Pro.

    What is happening with this?

    No work around?

    The string trim method was introduced with JavaScript 1.8.1. Acrobat 10/11 is documented as supporting 1.8, which I guess means 1.8.0. It is quite easy to create your own trim function, which will also work with the pre-10 versions Acrobat/Reader.

  • [CS3] [JS] error "everyItem() is not a function".

    I'm adapting ChangeCaseOfSelectedParaStyle of Dave Saunder to work a CS4 natively without version control with the CS3 version. See the following code:

    myDoc = app.activeDocument;

    myStyles = myDoc.allParagraphStyles;

    myStringList = myStyles.everyItem () .name;

    However, it throws the following error: myStyles.everyItem is not a function

    Any ideas? (or Dave, if you see that you already have an adapted version).

    Nye

    JavaScript is case-sensitive: use myDoc.paragraphStyles, not myDoc.ParagraphStyles

    Peter

  • Problem setting up of sublayer ("not a function")

    Hello. I came up with an idea for a script to read a data set and use it to manipulate objects inside of IT. The data is a simple table with several key: values, which matches the identifier of a "set of lines. I stored these values in an array of objects, where each object is a line.

    First I wanted to create a layer accession, where 1) each key of these objects of data would create a sub inside a main layer layer. (2) each value of a key would create a layer of sub within the previous layer of created under key. For now I am bypassing the problem of duplication, because the object will share several keys and values, and I don't want duplicates of those.

    For the moment I can not finish coz task (2) of the error: "parent.add (); is not a function ". Impossible to find out why, but I have to say that my programming skills are weak. Hope you can help me on this

    var doc = app.activeDocument;
    
    var layerPrincipal=doc.layers.getByName("RES");
    var subLayers=layerPrincipal.layers;
    
    
    //loteObj's are omitted for brevity.
    var lotesArrCom=[loteObj1,loteObj2]; 
    
    
    //Snipped that from the forum.
    function doesLayerExist(layers, name) {
      for (i=0; i<layers.length; i++) {
      if (layers[i].name==name) return true;
      }
      return false;
    }
    //Snipped that from the forum.
    function createLayer(parent,nome){
      var lay = parent.add();
      lay.name = nome;
    }
    //Loop trough an Array of Objects storing pairs of data.
    for(var i=0;i<lotesArrRes.length;i++){
      var loteObj=lotesArrRes[i];
      for (var key in loteObj) {
      if (loteObj.hasOwnProperty(key)&&key!="nome") {
      var keyValue=loteObj[key];
      if(!doesLayerExist(subLayers, key)){
      createLayer(subLayers,key){
    
      var keyValue=loteObj[key];
      var sLayers=subLayers.getByName(key);
      //It seems to stuck here. The previous function is executed as expected, but the following triggers the error in the 'CreateLayer' function declaration that "parent.add(); is not a function".
      createLayer(sLayers,keyValue){
      }
      }
      
    

    In the first case, you call "createLayer (sublayers, key);" - where sublayers = object [layers], in the second case, when you call "createLayer (sLayers, keyValue)' - where sLayers = object [layer] and layer property 'Add ()' is not available.

    That is to say in the first case, you call «createLayer (doc.layers.getByName ("RES").» Layers, key)", in the second case, you call"createLayer (doc.layers.getByName ("RES"). " Layers.getByName (key), keyValue) "- but in this case you forgot to add 'intact' - 'createLayer ( )

    doc.layers.getByName ("RES") layers.getByName (key) intact)«» ...

    //It seems to stuck here. The previous function is executed as expected, but the following triggers the error in the 'CreateLayer' function declaration that "parent.add(); is not a function".
    createLayer( sLayers.layers, keyValue );
    

Maybe you are looking for