Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Use xfa.host.beep to trigger two consecutive beeps?

Avatar

Avatar
Validate 1
Level 2
Brian3_14
Level 2

Likes

3 likes

Total Posts

61 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
Brian3_14
Level 2

Likes

3 likes

Total Posts

61 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile
Brian3_14
Level 2

01-05-2015

Seems like this should be pretty straight forward but apparently not.

I've tried various combinations, placing xfa.host.beep(1) in:

- consecutively in the click event of button;

- separately in the mouseUp and click event;

- placing xfa.host.beep into a function and calling the function twice

- calling the function then xfa.host.beep(1);

Even tried xfa.host.beep(1) in the click event of Button1 and then executing the click event of hidden Button 2, which contained xfa.host.beep(1).

Any work around suggestions? Thanks!

Brian

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 50
MVP
_Bruce_Robertson
MVP

Likes

270 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 250
Boost 25
View profile

Avatar
Boost 50
MVP
_Bruce_Robertson
MVP

Likes

270 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 250
Boost 25
View profile
_Bruce_Robertson
MVP

02-05-2015

Hi Brian,

Try this;

xfa.host.beep(1)

app.setTimeOut("xfa.host.beep(1)",500);

   

Which calls the beep, then half a second (or 500 m/s) later calls it again.

Regards

Bruce

Answers (3)

Answers (3)

Avatar

Avatar
Validate 1
Level 2
Brian3_14
Level 2

Likes

3 likes

Total Posts

61 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
Brian3_14
Level 2

Likes

3 likes

Total Posts

61 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile
Brian3_14
Level 2

05-05-2015

Copy all.  Thanks, as always, Sensei.

Best,

Brian

Avatar

Avatar
Boost 50
MVP
_Bruce_Robertson
MVP

Likes

270 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 250
Boost 25
View profile

Avatar
Boost 50
MVP
_Bruce_Robertson
MVP

Likes

270 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 250
Boost 25
View profile
_Bruce_Robertson
MVP

03-05-2015

Hi,

You could pass in the xfa.host object so you could call the beep() method.  But in a custom dialog the setTimeOut doesn't work, so you could try looping for half a second between beeps.


function dialog()


{


var dialogDescriptor =


{


  description:


  {


   name: "Beep Test",


   elements: [


    {


     type: "button",


     item_id: "beep",


     name: "Beep Beep",


    },


    {


     type: "ok",


    }


   ]


  },


  beep : function(dialog)


  {


   dialogObject.host.beep(1);


   var startTime = Date.now();


   while (Date.now() - startTime < 500) { }


   dialogObject.host.beep(1);


  },


  validate : function(dialog)


  {


   //add validate code here


   return true;


  },


};


var dialogObject =


{


  execDialog: function() { return app.execDialog(dialogDescriptor); },


};


return dialogObject;


}


var d = dialog();


d.host = xfa.host;


d.execDialog();




Acrobat also has an app.beep(1) which you could use.

Regards

Bruce

Avatar

Avatar
Validate 1
Level 2
Brian3_14
Level 2

Likes

3 likes

Total Posts

61 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
Brian3_14
Level 2

Likes

3 likes

Total Posts

61 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile
Brian3_14
Level 2

03-05-2015

Bruce -

Thanks for the great response; works perfectly.

As a follow-up, could xfa.host.beep(1) be placed within the code for a custom dialog? So rather than calling the beep first, then triggering the dialog box, just place xfa.host.beep(1) within the dialog code so when the dialog box appears, the beep is triggered?  I've tried placing it in various locations within a  dialog's code without out success.

Thanks much again.

B