App.open not responding if called from inside onclick()

Hi all.
Working on a script for InDesign CC 2014 I found this problem : if I call app.open() from inside button.onclick() it stops and nothing happens. Since I'm a beginner with Javascript I'm probably doing something wrong, but I can not figure out where I'm wrong. If executed without onclick it works....
There is another method to achieve the same result?
As my project is still under construction, I place only the portion of code relating to the problem.
I hope someone can help me, I can not get out of this hitch.
Thanks in advance.
var book_info;
var w1 = new Window ("dialog", "TEST");
    w1.minimumSize.height = 50;
    w1.minimumSize.width = 50;
     var p1 = w1.add ("panel");
        sel_button = p1.add ("button", undefined, "Open a book");
     var g1 = w1.add ("group");
        g1.add("button", undefined, "Cancel");
        g1.add("button", undefined, "OK");
sel_button.onClick = function(){
    var theFile = File.openDialog ("Select the book file to open...");
    get_data(theFile);
        alert(book_info.filePath + "\r" + book_info.name);
    book_info.close();
w1.show();
function get_data(data) {
    app.open(data);
    book_info = app.activeBook;
        alert("INSIDE FUNCTION" + book_info.filePath + "\r" + book_info.name);
    return data;

Thanks,Loic.Aigon
A better solution than mine. I just used a variable set inside the select button and check for the value after the window close. You can use different variables for different buttons. The approach is quite  similar. Reusing Loic.Aigon code:
var book_info;  
var theFile;
var getData;
var w1 = new Window ("dialog", "TEST");  
    w1.minimumSize.height = 50;  
    w1.minimumSize.width = 50;  
    var p1 = w1.add ("panel");  
        sel_button = p1.add ("button", undefined, "Open a book");  
    var g1 = w1.add ("group");  
        g1.add("button", undefined, "Cancel");  
        g1.add("button", undefined, "OK");  
sel_button.onClick = function(){  
    theFile = File.openDialog ("Select the book file to open..."); 
  getData =1;        
  w1.close(1);
w1.show()
if (  getData ==1) {
  if ( theFile ) {
  get_data(theFile);  
function get_data(data) {  
    app.open(data);  
    book_info = app.activeBook;  
        alert("INSIDE FUNCTION" + book_info.filePath + "\r" + book_info.name);  
    return data;  

Similar Messages

  • Apps do not respond when waking from sleep mode in Mountain Lion

    updated to the new OS a few weeks ago (no more than 14days) - since the upgrade, everytime the Mac awakens from the sleep mode, nothing responds. 
    If you select the app the app will just bop up and down. 
    If you try to clear trash, the message window appears but doesn't complete the task. 
    If in Safari, the page doesn't load. 
    In iPhoto the a blank window opens but nothing else apears and the loading icon continues to rotate but nothing else happens.
    The mac is using an ether net cable and not over wifi. 
    There is no problem if once I restart the machine, however this has to be done via the power scoket as the "restart and shutdown" options again do not respond and timeout.
    To save energy I use the sleep mode all week Sunday PM to Friday AM.  The machine is usally switched off all Day Saturday.  However as I use it everyday during the week I avoid turning it on and off everyday.  It is only 2 years old and I did not have this problem before the upgrade.
    Anyone got any ideas or having simliar issues?

    Hello:
    From what you describe, I would probably reinstall OS X 10.8.  In answer to your question, I have not seen anything similar.
    You might also look at your log files around the wake time to see if anything looks "odd."
    Barry

  • I am facing problem in using viber...can not receive  any call from Viber whn keypad is locked and whn i unlock phone thn on opening viber i can see the missed call notification... kindly guide me there is any setting so0 tht i can receive viber calls

    I am facing problem in using viber...can not receive  any call from Viber whn keypad is locked and whn i unlock phone thn on opening viber i can see the missed call notification... kindly guide me there is any setting so0 tht i can receive viber calls whn my phone is locked even as i can receive calls on HTC

    Hi,
    This is an official representative of Viber Media.
    Unfortunately we cannot change this feature due to Apple's restrictions. :/
    For more questions or technical support, please visit our official HelpDesk.
    Thanks,
    Viber

  • My Mail App is not responding

    My MacBook Pro Mail App is not responding.  Can anyone offer a suggestion to fix this?

    Back up all data before proceeding.
    Step 1
    If Mail crashes or freezes immediately on launch, try the steps suggested on this page. Sometimes a corrupt message on a mail server can be deleted by logging in to the server through its web page. If Mail still won't launch, skip to Step 3.
    Step 2
    Select all your mailboxes, and then select
              Mailbox ▹ Export Mailbox...
    from the Mail menu bar. Export the mailboxes to the Desktop folder.
    Make a note of the settings for all your Mail accounts – everything you'd need to reconstruct the settings from scratch.
    Quit Mail.
    Step 3
    In the Finder, hold down the option key and select
              Go ▹ Library
    from the menu bar. Move the following items (some may not exist) from the folder that opens to the Desktop:
              Application Support/AddressBook/MailRecents-v4.abcdmr
              Containers/com.apple.corerecents.recentsd
              Containers/com.apple.mail
              Containers/com.apple.MailServiceAgent
              Mail
    Note: you are not moving the Mail application. You’re moving a folder named “Mail.”
    Launch Mail. It will behave as if you were setting it up for the first time. Go through the setup process with one of your accounts, using the information you noted earlier. Test. If Mail works now, recreate the rest of your settings.
    If there’s no improvement, quit Mail and put back the items you moved to the Desktop, replacing any newer ones that may have been created in their place. Stop here and post your results.
    Step 4
    This step should not be necessary with IMAP or Exchange mailboxes, because they synchronize automatically with the server. Nevertheless, if the mailboxes are very large, importing them may spare you the need for a long download.
    If you took Step 2, import the mailboxes you exported:
              File ▹ Import Mailbox...
    If you skipped Step 2, look inside the Mail folder on the Desktop for a subfolder Mail/V2/Mailboxes. Import the mailboxes it contains.
    Test. If Mail is still working, delete the items you moved to the Desktop in Step 3.

  • Most apps keep not responding

    I was using Mountain Lion, but it cannot play the music in iTunes. It shows it's playing, but there's no sound and the progress bar is not moving. Then i brought it to Apple Care in mu country. The sales reinstalled the OS. Then it was working fine. Not so long after that, i upgraded to Mavericks. I don't use this Macbook Pro often. I installed BitTorrent, it cannot start, the apps keep showing not responding, but when i start BitTorrent in safe mode, it works normally, when i started it again in normal mode, it keeps showing not responding. This condition is the same like Macgo Player, VLC,  DiVX player and some other apps, mostly video player. Because when i double-click the video file, the VLC only shows the playlist, when i click play, it froze. Or when i clicked the VLC and click file-open it froze too. When i installed Macgo Player and DiVX player, it was installed successfully, but when i started it, it won't start and keeps saying apps is not responding!
    I am stressed with this error because i cannot use this MacBook Pro normally. Help needed. Thanks.

    Hi,
    Would the Apache port be defined in the $APPL_TOP/admin/SID_NAME.xml file or is it in a different location?It should be set in the application context file and in Apache config files (if you have run AutoConfig recently).
    I have compared the old .xml file to the new one and the ports all seem to be the same, 8115 is listed as oprocmgr_port and only used once. This is the same in the new and old files.
    How would I verify that nothing else is using that port from the command line?Use netstat and/or rpcinfo commands to verify this.
    Regards,
    Hussein

  • Re: I bought an app - storytime for kids, it had just two books and i downloaded three more books but when i tried to download the fourth book the app is not responding. can you help me? thank you.

    Hi I bought an app - storytime for kids, it had just two books and i downloaded three more books but when i tried to download the fourth book the app is not responding. can you help me? thank you.

    Try force quiting the app.  From the users guide:
    Force quit an app:  Press and hold the On/Off Sleep/Wake button for a few seconds
    until a red slider appears, then press and hold the Home  button until the app quits.
    You can also remove an app from the recents list to force it to quit. See “Opening and
    Switching Apps” on page 23.

  • Updated 7.1 having iphone 4 but temple run2 not responding good, calling interface is little slow.. hope apple will solve it..

    updated 7.1 having iphone 4 but temple run2 not responding good, calling interface is little slow.. hope apple will solve it..

    Try to solve it yourself... Standard troubleshooting...
    1. Try a Restart by pressing the sleep/lock button until you see the slider.  Slide to power off.  Restart by pressing the sleep/lock button until you see the Apple logo.
    2. Try a Reset by pressing the home and sleep buttons until you see the Apple logo. Takes about 5-15 secs of button holding and you won't lose any data or settings.
    3. Remove apps from Recently Used (multi-tasking) list...
    - From any Home Screen, double tap the home button to bring up the Recents List
    - Swipe up on the app preview card to remove it from the list
    - Press the home button when done.
    4. If still a problem restore with your backup.
    5. If still a problem restore as new, i.e. without your backup. See how it runs with nothing synced to it.
    6. If still a problem, it's likely a hardware issue.

  • App World not responding :(

    Tried to open the appworld app, but it just goes in circles and then returns back with app world not responding. There is a problem with appworld.
    Tried Software Update, it says the update server is temporarily unavailable. error code 2032.

    sorry my bad, my wifi was acting up.

  • What's the best way to transfer (not forward) a call from one iPhone to another?

    What's the best way to transfer (not forward) a call from one iPhone to another? Is there an app available that does this? I'm asking about receiving a call, then transferring that caller to another iPhone on a separate number and then disconnecting while those two users are joined up in a conversation.

    Ask your carrier. This would be a feature provided by them.

  • Nokia mail app is not responding in C1 01.

    While checking my mail in nokia mail app in my NOKIA C1-01, mobile suddenly switched off and i restarted and restored factory settings and again switched on to check my mail again. The app is not responding ie. It is not opening and even Chat is not opening. I need a immediate help because i use it alot.

    hi mate,
    have you checked via nokia Suite on your PC if there are any firmware upgrades available for your phone? if there are any, please update to the latest version offered. failing that, you can try re-installing your current firmware thru Nokia Suite.
    if that doesn't work, then you need to take your phone tro Nokia Care for inspection: http://nokia.com/support

  • Photosmart 7510 Touchsmart web app is not responding

    I have had this printer for awhile (1-2 years maybe?) and have never encountered any errors.  I went to print quick forms from the device's display and got the following error
    "Touchsmart web app is not responding.  Please try again later."
    I am on the correct network, I can print and scan wirelessly from my computer with no problems.  I have reset the wireless connection, our modem and router.  I checked for updates and there are no new updates.
    I saw that many have had this problem in the past, but have not seen anyone who has gotten it fixed.
    Is there a solution or is this now just a basic printer again?

    Hi pepoc,
    Welcome to the HP Support Forums. I see that you are getting a connection error when trying to access the HP Quick Forms printable found on the front panel of your Photosmart 7510 printer.
    Please set a manual IP address and manual DNS servers for the printer. I have included a link to another post with the steps, including screen shots, on how to do this.
    If you run into any issues, please let me know at what step things went hairy and what any error messages said.
    Regards,
    Happytohelp01
    Please click on the Thumbs Up on the right to say “Thanks” for helping!
    Please click “Accept as Solution ” on the post that solves your issue to help others find the solution.
    I work on behalf of HP

  • Access 2010 on 64 Bit Windows 7 Access "Not Responding" when changing from forms view to design view and back

    I am running
    Windows 7 64 bit
    Access 2010 32 bit
    Developing an application with a split FE BE with both files local but continue to have the message "Not Responding" when switching from forms view to design view and back as well as if I try to connect to a subform or object on the sub form.

    I have seen this behavior when the form's RecordSource is a complex query such as a crosstab or a query with several nested queries. To test if this is your case, remove the RecordSource and see if the form starts acting normal again.
    Then again, if the form has several subforms they might be slowing up the loading time.
    Bill Mosca
    www.thatlldoit.com
    http://tech.groups.yahoo.com/group/MS_Access_Professionals

  • Kindle app is not responding

    kindle app is not responding - frozen & then just closes

    mvonaulock,
    Delete the Kindle App, reboot the iPad, and re-download the Kindle App.

  • The start/stop bar on my i Tunes app does not respond properly. Please advise.

    The start/sop bar on my i Tunes app does not respond properly. Please help.

    It can be that the library path, or files, are corrupted. What happens if you set a different path to save the library?

  • How do I uninstall an app entirely, not just deleting it from the Launchpad?

    How do I uninstall an app entirely, not just deleting it from the Launchpad? I've delete the app at the Launchpad, but the remaining files of it are taking up space in my macbook. How do I do that?

    As Cunnla says, the best way to remove an application and all auxiliary files associated with it is to use a developer supplied uninstaller or, lacking that, directions on uninstalling from the developer. Unfortunately, there are a number of applications which have no developer uninstaller nor instructions.
    Some won't recommend it, but I use AppDelete for those apps with no instructions. It gets rid of most auxiliary files and I've never had a problem with it. I just make certain that the auxiliary files that AppDelete selects are, in fact, associated with the application.
    My 2¢...
    Clinton
    MacBook Pro (15” Late 2011), OS X 10.??, 16GB Crucial RAM, 960GB M500 Crucial SSD, 27” Apple Thunderbolt Display

Maybe you are looking for

  • I am brand new to Photoshop Elements.  I cannot even open my file to edit it!

    I am brand new to Photoshop Elements.  I have Photoshop Elements 11.  I cannot do anything!  I need to open my jpgs and cannot.  I need to edit them!

  • KE30....HOW TO USE IT?

    Hello SAP Gurus! Kindly give me ideas on how to use KE30 tcode and is it possible to make a new report. thank you very much!

  • FF7B - Liquidity Forecast

    FF7B - Liquidity Forecast Hello, does anyone have a documentation for the above transaction? Do you know how the program works? Thanks and regards, Davide

  • Count of number of record

    hi friends, my task was one file to one idoc the file has large no of records Condition is that if the number of items in the idoc after conversion crosses 999 it should report as error. i did some work for usual file to idoc procdure,ie. normal mapp

  • Windows XP instantly freezes after login

    Hey, So lately I've been having some problems with Windows XP. It seems that my MBP will completely freeze up and become unresponsive, when I finally get it to work via voodoo or go into safe mode the event log shows nothing wrong. WXP works just fin