10 Replies Latest reply on Jan 11, 2017 12:41 AM by jabulanim57049389

    Trusted function throwing exceptions when called initially but work afterwards

    jabulanim57049389

      Hi,

       

      I have a working plugin that adds buttons to a toolbox, the issue I'm having is that when adding the buttons using the trusted functions e.g doc.addField, doc.addToolButton, it works but it keeps throwing exceptions and it looks as if it is affecting the application, the app crashes, the toolbox window is too small and I need to scroll instead of it fitting all the items. the error messages I get back are all from one call. The weird part that I am failing to understand is that these functions will work flawlessly on the second call but not on the first? instead I get the following exceptions being hit:

       

      InitializeFormsTrackerJS is not defined

      InitAnnot is not defined

      SetRSSMethods is not defined

       

      I am using Acrobat X Pro.

       

      Thank you.

        • 1. Re: Trusted function throwing exceptions when called initially but work afterwards
          Bernd Alheit Adobe Community Professional & MVP

          What can you see when you execute following in the console:

           

          for ( var i in this ) {

            console.println( i + " : " + ( typeof this[i]) );

          }

          • 2. Re: Trusted function throwing exceptions when called initially but work afterwards
            jabulanim57049389 Level 1

            This is the output I get from the print.

             

            app : object

            global : object

            console : object

            util : object

            search : object

            catalog : object

            identity : object

            shareIdentity : object

            SOAP : object

            Net : object

            RSS : object

            Collab : object

            AnnotsString : object

            EScriptString : object

            SOAPString : object

            Preflight : object

            PreflightResult : object

            PreflightProfile : object

            PreflightAuditTrail : object

            tts : object

            spell : object

            FormsString : object

            XMLData : object

            FormWorkflow : object

            security : object

            dbg : object

            event : object

            aActiveDocs : object

            aNewDoc : object

            numpages : number

            name : string

            i : string

            inUMSSession : string

            edtFinish : object

            fileString : undefined

            appViewerType : undefined

            btnOpenRubric : undefined

            addCommentMarkIcon : undefined

            addMarkIcon : undefined

            addTickIcon : undefined

            addCrossIcon : undefined

            addCountIcon : undefined

            addStampIcon : undefined

            addDeselectIcon : undefined

            addHalfTick : undefined

            oo : undefined

             

            The above is before I call one of the trusted functions I mentioned, the following is what I got after the initial call:

             

            app : object

            global : object

            console : object

            util : object

            search : object

            catalog : object

            identity : object

            shareIdentity : object

            EScriptString : object

            Preflight : object

            PreflightResult : object

            PreflightProfile : object

            PreflightAuditTrail : object

            tts : object

            spell : object

            FormsString : object

            XMLData : object

            FormWorkflow : object

            security : object

            dbg : object

            aActiveDocs : object

            aNewDoc : object

            numpages : number

            name : string

            i : string

            inUMSSession : string

            edtFinish : object

            fileString : string

            appViewerType : string

            btnOpenRubric : object

            addCommentMarkIcon : object

            addMarkIcon : object

            addTickIcon : object

            addCrossIcon : object

            addCountIcon : object

            addStampIcon : object

            addDeselectIcon : object

            addHalfTick : object

            oo : undefined

            • 3. Re: Trusted function throwing exceptions when called initially but work afterwards
              Bernd Alheit Adobe Community Professional & MVP

              What can you see when you execute the code without the plugin?

              • 4. Re: Trusted function throwing exceptions when called initially but work afterwards
                jabulanim57049389 Level 1

                There seems to be  a lot that is not being initialized because of the plugin...

                 

                app : object

                global : object

                console : object

                util : object

                search : object

                catalog : object

                identity : object

                shareIdentity : object

                EScriptString : object

                Preflight : object

                PreflightResult : object

                PreflightProfile : object

                PreflightAuditTrail : object

                tts : object

                spell : object

                FormsString : object

                XMLData : object

                FormWorkflow : object

                security : object

                dbg : object

                cTableOddRowColor : string

                cTableEvenRowColor : string

                cTableHeaderColor : string

                myReviewTrackerDebugAlert : function

                getFormsString : function

                CBAutoConfigCommentRepository : function

                IWEmailSteps : object

                IWEmailFormSteps : object

                IWSteps : object

                IWFDSteps : object

                ShareFileSteps : object

                UploadFileSteps : object

                DocCenterLoginSteps : object

                DocCenterSignupSteps : object

                ERTCSteps : object

                OldSRIWsteps : object

                filesAtDocCenter : object

                deadlineDate : string

                internalDeadlineDate : string

                objectDeadlineDate : object

                RT : undefined

                SharedReviewDocCenterInitiator : object

                SharedReviewWebDAVInitiator : object

                SharedReviewAppleiDiskInitiator : object

                SharedReviewSMBInitiator : object

                SharedReviewSharepointInitiator : object

                InitializeFormsTrackerJS : function

                InitializeMultimediaJS : function

                IDS_GREATER_THAN : string

                IDS_GT_AND_LT : string

                IDS_LESS_THAN : string

                IDS_INVALID_MONTH : string

                IDS_INVALID_DATE : string

                IDS_INVALID_DATE2 : string

                IDS_INVALID_VALUE : string

                IDS_AM : string

                IDS_PM : string

                IDS_MONTH_INFO : string

                IDS_STARTUP_CONSOLE_MSG : string

                RE_NUMBER_ENTRY_DOT_SEP : object

                RE_NUMBER_COMMIT_DOT_SEP : object

                RE_NUMBER_ENTRY_COMMA_SEP : object

                RE_NUMBER_COMMIT_COMMA_SEP : object

                RE_ZIP_ENTRY : object

                RE_ZIP_COMMIT : object

                RE_ZIP4_ENTRY : object

                RE_ZIP4_COMMIT : object

                RE_PHONE_ENTRY : object

                RE_PHONE_COMMIT : object

                RE_SSN_ENTRY : object

                RE_SSN_COMMIT : object

                ColorConvert : function

                ColorEqual : function

                color : object

                font : object

                border : object

                style : object

                highlight : object

                zoomtype : object

                cursor : object

                trans : object

                position : object

                scaleWhen : object

                scaleHow : object

                display : object

                permission : object

                submitFormUsageRights : object

                fileSystem : object

                encoding : object

                requirements : object

                HostContainerDisclosurePolicy : object

                AFDigitsRegExp : object

                AFPMRegExp : object

                AFAMRegExp : object

                AFTimeLongRegExp : object

                AFTimeShortRegExp : object

                AFTimeGarbageRegExp : object

                AFBuildRegExps : function

                AFNumberDotSepEntryRegExp : object

                AFNumberDotSepCommitRegExp : object

                AFNumberCommaSepEntryRegExp : object

                AFNumberCommaSepCommitRegExp : object

                AFZipEntryRegExp : object

                AFZipCommitRegExp : object

                AFZip4EntryRegExp : object

                AFZip4CommitRegExp : object

                AFPhoneEntryRegExp : object

                AFPhoneCommitRegExp : object

                AFSSNEntryRegExp : object

                AFSSNCommitRegExp : object

                AFMonthsRegExp : object

                AFExactMatch : function

                AFExtractNums : function

                AFMakeNumber : function

                AFExtractRegExp : function

                AFMakeArrayFromList : function

                AFExtractTime : function

                AFGetMonthIndex : function

                AFMatchMonth : function

                AFGetMonthString : function

                AFParseTime : function

                AFDateFromYMD : function

                AFParseDateEx : function

                AFDateHorizon : function

                AFParseDate : function

                AFParseDateWithPDF : function

                AFMergeChange : function

                AFRange_Validate : function

                AFSimpleInit : function

                AFSimple : function

                AFSimple_Calculate : function

                AFNumber_Keystroke : function

                AFPercent_Keystroke : function

                isNumber : function

                isAlphabetic : function

                isAlphaNumeric : function

                isReservedMaskChar : function

                maskSatisfied : function

                indexOfNextEssential : function

                AFSpecial_KeystrokeEx : function

                AFSpecial_Keystroke : function

                AFDate_KeystrokeEx : function

                AFDate_Keystroke : function

                AFTime_Keystroke : function

                AFNumber_Format : function

                AFPercent_Format : function

                AFSpecial_Format : function

                AFParseDateYCount : function

                AFParseDateOrder : function

                AFParseGMTDateString : function

                AFDate_FormatEx : function

                AFDate_Format : function

                AFTime_Format : function

                AFTime_FormatEx : function

                AFSignatureLock : function

                AFSignature_Format : function

                AFStringReplace : function

                LookUpWordEnable : function

                LookUpWordDefinitionURL : function

                encryptUsingPolicyForJSObject : function

                LoginForGuardian : function

                RefreshPoliciesForGuardian : function

                ANSB_None : number

                ANSB_Page : number

                ANSB_Seq : number

                ANSB_Author : number

                ANSB_ModDate : number

                ANSB_Type : number

                ANSB_Subject : number

                ANFB_ShouldPrint : number

                ANFB_ShouldView : number

                ANFB_ShouldEdit : number

                ANFB_ShouldAppearInPanel : number

                ANFB_ShouldSummarize : number

                ANFB_ShouldExport : number

                ANFB_ShouldCollaborate : number

                ANFB_ShouldNone : number

                IPV6Type : number

                IPV4Type : number

                debugExcept : function

                ANTrustPropagateAll : function

                ANClipPrec3 : function

                CBEncodeMaybeInternalStrings : function

                CBCanDoReviewWorkflowCheckExpr : string

                CBCanDoWorkflowCheckExprAPR : string

                ANsums : object

                ANsumorder : object

                binsert : function

                isort : function

                ANstateful : function

                ANsumFlatten : function

                ANsummAnnot : function

                ANsummarize : function

                CBFNiceTableName : number

                CBFNiceDBName : number

                CBFDBPerDoc : number

                CBgetTableDesc : function

                CBgetTableConnect : function

                CBgetInfo : function

                CBsetInfo : function

                CBcreateTable : function

                CBconnect : function

                CBannotdata : object

                CBannotData : function

                CBannotSetData : function

                CBDeleteReplyChain : function

                CBGetReplyChain : function

                CBPutReplyChain : function

                ADBCAnnotEnumerator : function

                CBStrToLongColumnThing : function

                ADBCAnnotStore : function

                WDmungeURL : function

                WDAnnotEnumerator : function

                ANSendForReviewEnabled : function

                ANSendForSharedReviewEnabled : function

                ANSendForFormDistributionEnabled : function

                ANSendCommentsToAuthorEnabled : function

                ANVerifyComments : function

                ANDoSend : function

                CreateViewerVersionCheck70 : function

                CreateViewerVersionCheckCase : function

                CreateViewerVersionCheckString : function

                CreateViewerVersionCheckStringsCluster : function

                ANContinueApproval : function

                ANEndApproval : function

                ANRejectApproval : function

                ANApprovalGetStrings : function

                eMailValidate : function

                DoIdentityDialog : function

                ANStartApproval : function

                ANSendForApproval : function

                ANSendForBrowserReview : function

                ANSendForReview : function

                ANSendCommentsToAuthor : function

                ANSendApprovalToAuthorEnabled : function

                ANAuthenticateResource : function

                TestHSShare : function

                ANMatchString : function

                ANMatchStringCaseInsensitive : function

                ANShareFile2 : function

                ANDefaultInvite : function

                CBdef : function

                Matrix2D : function

                hasHanko : function

                SetHTTPMethods : function

                SetRSSMethods : function

                InitAnnot : function

                DebugAlert : function

                DebugThrow : function

                SharedString : function

                getDriver : function

                AnnotsString : object

                SOAPString : object

                Collab : object

                RSS : object

                Net : object

                SOAP : object

                GetStepNum : function

                ANDumpObj : function

                DebugPrintln : function

                TestReview : function

                ANCreateMLSElement : function

                ANCreateMLSEElementsFromArray : function

                ANCreateTipElements : function

                ANCreateSkipElements : function

                CBSetProductVariant : function

                CBIsValidEmail : function

                ANFancyAlertImpl : function

                ANPlatformPathToURL : function

                ANSMBURLToPlatformPath : function

                SplitAddrs : function

                CBTrustPropagateWiz : function

                CBCreateStepNavElements : function

                CBStartWizStep : function

                CBRunSimpleWiz : function

                CBStartWizStepNew : function

                CBRunSimpleWizNew : function

                CBCreateInviteStepDescription : function

                CBCreateInviteStepDescriptionApproval : function

                CBCreateSendInvitationStepDescription : function

                IWBrowseDocStepCommitWork : function

                IWBrowseDoc : function

                IWBrowseAnyDoc : function

                IWUploadFileError_UniqueFilenameDialog : function

                getFS : function

                IWShowFileError : function

                IWShowLocalFolderError : function

                IWShowFolderError : function

                getnextnumber : function

                populateFilesAtDocCenter : function

                isValidSaveLocationAtDocCtr : function

                SilentDocCenterLogin : function

                longFileName : function

                getAsciiSafeDocName : function

                DistributionServerStepCommitWork : function

                RemoveWebdav : function

                IWDistributionServer : function

                IWERTCWelcome : function

                IWShowSharepointWorkspace : function

                IWNewInternalServer : function

                IWSubmitButton : function

                IWDistributeStepDescription : function

                IWSaveProfileStepDescription : function

                filterAddrs : function

                setDateAndTime : function

                IWEmailStepDescription : function

                CBCreateGettingStartedStepDescription : function

                CBSharedReviewInviteReviewers : function

                IWSharedReviewDocCenterServicesDialog : function

                IWSharedReviewDocCenterLogin : function

                IWSharedReviewDocCenterEligibilityErrorDialog : function

                IWSharedReviewDocCenterCreateID : function

                IWSharedReviewDocCenterCreateConfirm : function

                CBSharedReviewDistributeStepDescription : function

                CBSharedReviewComplete : function

                CBFormDistributionEmailComplete : function

                CBFormDistributionComplete : function

                CBSharedReviewSelectServerTypeDescription : function

                CBSharedReviewConfigureServerStepDescription : function

                getFolderNameRemovedPath : function

                CBSharedReviewStatusDialog : function

                ANIdentityDialog : function

                ANValidateIdentity : function

                IWIdentityDialog : function

                CBSharedReviewSecurityDialog : function

                CBSharedReviewIfOfflineDialog : function

                CBSharedReviewCloseDialog : function

                CBCreateUploadStepDescription : function

                CBRunEmailReviewWizard : function

                CBRunEmailApprovalWizard : function

                CBRunBBRReviewWizard : function

                CBRunSharedReviewWizard : function

                CBRunFormDistributionWizard : function

                CBRunShareFileWizard : function

                CBRunERTCWizard : function

                CBEncodeURL : function

                CBFreezeFunc : function

                ANSendForSharedReview : function

                ANRunSharedReviewEmailStep : function

                ANSendForFormDistribution : function

                CBRunFormDistributionWizardEmail : function

                IWUploadFileFailedDialog : function

                IWShareFileConfirmDialog : function

                ANShareFile : function

                CBShareFileComplete : function

                ANDocCenterLogin : function

                ANDocCenterLoginForAddReviewers : function

                ANDocCenterSignup : function

                ANERTC : function

                CBBBRInit : function

                CBBBRInvite : function

                CBRunReturnResponseDialog : function

                CBRunReviewOptionsDialog : function

                CBRunApproveDialog : function

                InitAnWizard : function

                ScriptBridgeUtils : object

                DynamicAnnotStore : function

                SOAPMessageStyle : object

                SOAPVersion : object

                StreamDigest : object

                ServiceDiscovery : object

                SOAPRequestStyle : object

                event : object

                i : string

                • 5. Re: Trusted function throwing exceptions when called initially but work afterwards
                  Bernd Alheit Adobe Community Professional & MVP

                  This output is correct. You should contact the provider of the plugin.

                  • 6. Re: Trusted function throwing exceptions when called initially but work afterwards
                    jabulanim57049389 Level 1

                    I am attempting to fix some bugs on the existing plugin, the author cannot be reached anymore.

                     

                    The issue I'm having is that a trusted function that is seemingly being called in a correct manner throws an exception initially but the very same call a second time round throws no exceptions at all...

                     

                    Here is a sample of the code that throws the exception:

                     

                    var btnOpenRubric = aNewDoc.addField("btnOpenRubric", "button", 0, [5, 5, 70, 30]);

                    btnOpenRubric.buttonSetCaption("Open Rubric");

                    btnOpenRubric.setAction("MouseUp", "openRubricForMarking(aNewDoc)");

                    btnOpenRubric.borderStyle = "beveled";

                    btnOpenRubric.highlight = "push";

                    btnOpenRubric.lineWidth = 2;

                    • 7. Re: Trusted function throwing exceptions when called initially but work afterwards
                      Bernd Alheit Adobe Community Professional & MVP

                      For the borderStyle you must use the keyword border.b. For highlight you must use highlight.p.

                       

                      All is documented in the Acrobat JavaScript Reference.

                      • 8. Re: Trusted function throwing exceptions when called initially but work afterwards
                        jabulanim57049389 Level 1

                        I've looked in the reference docs and I couldn't find anything that would explain why the first call breaks(still creates the button) and the second doesn't. I'll just have to go over them again and continue to debug. Thanks for your help.

                        • 10. Re: Trusted function throwing exceptions when called initially but work afterwards
                          jabulanim57049389 Level 1

                          Thanks for putting me on the right track, I was able to determine that the plugins config file (config.js) needed to be renamed and now all the objects are being initialized without any exceptions. Thanks.