App.Open does not so called inside onclick()

!

Hi all.

Working on a script for InDesign CC 2014 I found this problem: if I call app.open () from inside the button.onclick (), it stops and nothing happens. Since I am a beginner with Javascript I'm probably wrong, but I don't know where I am going wrong. If executed without onclick it works...

There is another method to achieve the same result?

My project is still under construction, so I put only the part of the code regarding the problem.

I hope someone can help me, I can't get out of this team.

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;
}

Hello

Since you are using a modal dialog box, it is likely that InDesign cannot open a document, or do anything until you close the dialog box. Your solution is to use a modeless dialog box (i.e. "the palette") or to close the dialog box before you open the document.

HTH,

Loïc

http://www.ozalto.com

Tags: InDesign

Similar Questions

  • my browser cannot open google and facebook and other https sites that it does not open even the app store does not work, I tried to change my DNS google DNS and disable IPv6 but still no use, help PLZ!

    my browser cannot open google and facebook and other https sites that it does not open even the app store does not work, I tried to change my DNS google DNS and disable IPv6 but still no use, help PLZ!

    You may have installed one or more variants of the malware "VSearch' ad-injection. Please back up all data, and then take the steps below to disable it.

    Do not use any type of product, "anti-virus" or "anti-malware" on a Mac. It is never necessary for her, and relying on it for protection makes you more vulnerable to attacks, not less.

    Malware is constantly evolving to work around defenses against it. This procedure works now, I know. It will not work in the future. Anyone finding this comment a couple of days or more after it was published should look for a more recent discussion, or start a new one.

    Step 1

    VSearch malware tries to hide by varying names of the files it installs. It regenerates itself also if you try to remove it when it is run. To remove it, you must first start in safe mode temporarily disable the malware.

    Note: If FileVault is enabled in OS X 10.9 or an earlier version, or if a firmware password is defined, or if the boot volume is a software RAID, you can not do this. Ask for other instructions.

    Step 2

    When running in safe mode, load the web page and then triple - click on the line below to select. Copy the text to the Clipboard by pressing Control-C key combination:

    /Library/LaunchDaemons

    In the Finder, select

    Go ▹ go to the folder...

    from the menu bar and paste it into the box that opens by pressing command + V. You won't see what you pasted a newline being included. Press return.

    A folder named "LaunchDaemons" can open. If this is the case, press the combination of keys command-2 to select the display of the list, if it is not already selected.

    There should be a column in the update Finder window. Click this title two times to sort the content by date with the most recent at the top. Please don't skip this step. Files that belong to an instance of VSearch will have the same date of change for a few minutes, then they will be grouped together when you sort the folder this way, which makes them easy to identify.

    Step 3

    In the LaunchDaemons folder, there may be one or more files with the name of this form:

    com Apple.something.plist

    When something is a random string, without the letters, different in each case.

    Note that the name consists of four words separated by dots. Typical examples are:

    com Apple.builins.plist

    com Apple.cereng.plist

    com Apple.nysgar.plist

    There may be one or more items with a name of the form:

    com.something.plist

    Yet once something is a random string, without meaning - not necessarily the same as that which appears in one of the other file names.

    These names consist of three words separated by dots. Typical examples are:

    com.semifasciaUpd.plist

    com.ubuiling.plist

    Sometimes there are items (usually not more than one) with the name of this form:

    com.something .net - preferences.plist

    This name consists of four words (the third hyphen) separated by periods. Typical example:

    com.jangly .net - preferences.plist

    Drag all items in the basket. You may be prompted for administrator login password.

    Restart the computer and empty the trash.

    Examples of legitimate files located in the same folder:

    com.apple.FinalCutServer.fcsvr_ldsd.plist

    com Apple.Installer.osmessagetracing.plist

    com Apple.Qmaster.qmasterd.plist

    com Apple.aelwriter.plist

    com Apple.SERVERD.plist

    com Tether.plist

    The first three are clearly not VSearch files because the names do not match the above models. The last three are not easy to distinguish by the name alone, but the modification date will be earlier than the date at which VSearch has been installed, perhaps several years. None of these files will be present in most installations of Mac OS X.

    Do not delete the folder 'LaunchDaemons' or anything else inside, unless you know you have another type of unwanted software and more VSearch. The file is a normal part of Mac OS X. The "demon" refers to a program that starts automatically. This is not inherently bad, but the mechanism is sometimes exploited by hackers for malicious software.

    If you are not sure whether a file is part of the malware, order the contents of the folder by date modified I wrote in step 2, no name. Malicious files will be grouped together. There could be more than one such group, if you attacked more than once. A file dated far in the past is not part of the malware. A folder in date dated Middle an obviously malicious cluster is almost certainly too malicious.

    If the files come back after you remove the, they are replaced by others with similar names, then either you didn't start in safe mode or you do not have all the. Return to step 1 and try again.

    Step 4

    Reset the home page in each of your browsers, if it has been modified. In Safari, first load the desired home page, then select

    ▹ Safari preferences... ▹ General

    and click on

    Set on the current Page

    If you use Firefox or Chrome web browser, remove the extensions or add-ons that you don't know that you need. When in doubt, remove all of them.

    The malware is now permanently inactivated, as long as you reinstall it never. A few small files will be left behind, but they have no effect, and trying to find all them is more trouble that it's worth.

    Step 5

    The malware lets the web proxy discovery in the network settings. If you know that the setting was already enabled for a reason, skip this step. Otherwise, you should undo the change.

    Open the network pane in system preferences. If there is a padlock icon in the lower left corner of the window, click it and authenticate to unlock the settings. Click the Advanced button, and then select Proxies in the sheet that drops down. Uncheck that Auto Discovery Proxy if it is checked. Click OK, and then apply.

    Step 6

    This step is optional. Open the users and groups in the system preferences and click on the lock icon to unlock the settings. In the list of users, there may be some with random names that have been added by the malware. You can remove these users. If you are not sure whether a user is legitimate, do not delete it.

  • App Store does not open

    Under OS X El Capitan 10.11.4 iMac.  When you click on the App Store, it does not; the wheel of time turns just in the upper left corner.  The last time that the App Store has opened, I tried to update of the Keynote, and Numbers (I clicked on update and walked away); now they show on the Launchpad as if suspended so I open them via the Finder.  It is a problem I've had for at least a month; I have no trouble to solve because I rarely use the iMac, but I don't want to correct any suggestion would be gr.

    Hello

    Since the App Store does not open, check if the startup disk need to repair and restore OS X using OS X Recovery.

    Start your Mac while pressing the command + R keys.

    From there, you should be able to access the built in utilities in OS X recovery to repair the boot and OS X restore disc.

  • BlackBerry smartphone App World does not open

    I downloaded the latest version of my phone and now the app world does not open.  I already took out battery, removed and reloaded program.

    Not sure if this is something that will fix itself but I need to download a program.

    Well done...

  • Cloud app creation does not open

    Windows 10. Cloud app creation does not open. Tried several times. Tried to uninstall, but the dialogue came telling me that several applications necessary so not able to uninstall.

    Tried to install on it. The app downloaded, he gave permission to install, and then nothing happened.

    Apps like Id and opened all right, but not the CC app all I can try?

    This can work...

    Sign out of your account... Uninstall... to run vacuuming...

    -http://helpx.adobe.com/creative-cloud/help/install-apps.html (and uninstall)

    -using the vacuuming after uninstalling and before reinstalling is often necessary

    -https://helpx.adobe.com/creative-suite/kb/cs5-cleaner-tool-installation-problems.html

    -Restart your computer... Sign in to your account... Reinstall

  • App-Manager does not connect to the Simulator OS Firefox on Windows 7

    OS: Windows 7

    Firefox: 28

    6.0pre8.20140112 Simulator 1.2 Firefox OS

    When I run the simulator it opens fine and I see a Firefox OS Desktop
    But the App Manager does not connect. The console at the bottom right says:

    .. localhost:56455 options (the port varies)

    .. connection timeout. Possible causes: has not clicked 'accept' (guest).

    .. .disconnecting

    .. .disconnected

    I have disabled my firewall, restarted firefox and even system - did not help
    There is a similar bug - but I don't know if we are talking about the same thing:
    https://support.Mozilla.org/en-us/questions/988385

    Thank you

    Well - I already knew these links and I can't find anything useful
    Anyway, I tried the Simulator instead of 1.2 1.3 (unstable)
    This one works very well

  • App tab does not load

    My App tab does not load in the drop-down list creative cloud. I got the spinning wheel of death. Someone please help!

    Screen Shot 2016-07-11 at 6.04.13 PM.png

    Try Adobe Creative Cloud desktop application does not open or shows a spinning wheel of progress

  • Creative cloud office 'Apps' tab does not work

    I bought the license to CC a couple of days, but since installing I couldn't install/manage applications. Office CC 'Applications' tab will not open correctly only saying "download error".

    I got the CC on this computer in the past by another employer, but I uninstalled it when the project took end. I never encountered this problem with the CC of this time. I also got CS5 on this computer all the time and in the past with CS5 and CC has not caused any problems.

    I have now uninstalled and reinstalled this new CC a couple of times but the 'Apps' tab does not always work.

    I then also uninstall the CS5 and to be sure, I removed manually all the Adobe stuff like this guide: Re: how to remove and cancel the creation could f...

    After that, I reinstalled the CC but always the 'Apps' tab does not work. May be there is always something left (on this computer) the subscription of Creative previous cloud (another license) that is causing the problem with this new CC subscription?

    I have a Mac Book Pro with Mac OS X 10.9.5

    If you have uninstalled but did not follow upwards with the help of the vacuum of CS then you have probably some remains that could interfere with other facilities.  If you uninstall, then use the cleaning tool, you may have better luck.

    Adobe Creative Suite cleanup tool

    helps resolve installation for CS3 thru CS6 and creative cloud problems

    http://www.Adobe.com/support/contact/cscleanertool.html

    In addition, it should have been without having to uninstall the original CC that you had with another employer.  You must only have signed out of it, and then you could connect you with another subscription thereafter.

  • Cloud app creation does not

    Hello.

    I re - install photoshop, so this morning I opened the creative cloud, but there is a problem that the app section does not load even after the wheel, he returned in the section of hope, as a loop.

    I tried all the solutions from the link below. I tried to reinstall the cloud and etc.

    https://helpx.Adobe.com/creative-cloud/KB/creative-cloud-app-doesn ' t - open.html

    I don't know what to do anymore. Thanks for the help.

    Hello

    You can see the threads below where this issue has been addressed:

    Adobe Creative Cloud / Desktop App / Home Screen: constant spinning wheel

    Creative Cloud Desktop App taped blue spinning wheel after update.

    Kind regards

    Sheena

  • Buttons to blend into the background. Button menu to open does not have a menu.

    Button, button "home" to move forward, back, bookmark this page button, show your bookmarks and open menu buttons are present, but you can not see them. Button menu to open does not have a menu drop-down.

    . Hello

    Some Firefox problems can be solved by performing a clean reinstall. This means that you remove Firefox program files, and then reinstall Firefox. Please follow these steps:

    Note: You can print these steps or consult them in another browser.

    1. Download the latest version of Firefox from http://www.mozilla.org office and save the installer to your computer.
    2. Once the download is complete, close all Firefox Windows (click on quit in the file menu or Firefox).
    3. Remove the Firefox installation folder, which is located in one of these locations, by default:
      • Windows:

        • C:\Program Files\Mozilla Firefox
        • C:\Program Files (x 86) \Mozilla Firefox
      • Mac: Delete Firefox in the Applications folder.
      • Linux: If you have installed Firefox with the distribution-based package manager, you must use the same way to uninstall: see Install Firefox on Linux. If you have downloaded and installed the binary package from the Firefox download page, simply remove the folder firefox in your home directory.
    4. Now, go ahead and reinstall Firefox:
      1. Double-click on the downloaded Setup file and go through the steps in the installation wizard.
      2. Once the wizard is completed, click to open Firefox directly after clicking the Finish button.

    More information on the resettlement of Firefox can be found here.

    WARNING: Uninstaller or the use of Firefox and not run a third remover as part of this process, because who could permanently delete your Firefox data, including but not limited to, extensions, cache, cookies, bookmarks, personal settings and passwords saved. These can be recovered, unless they have been backed up on an external device!

    Please report back to see if this helped you!

    Thank you.

  • App Store does not work

    Dear Apple, personal,

    My App Store does not work. I'm not sure but I think since I upgraded my iOS version 9.3 the App Store has stopped working. I mean I tried to download several apps and their icons still display the word "pending"... It doesn't matter if I'm with a Wi - fi or cellular... It just doesn't... I have an iPhone 6 (bought on March 2016 in Houston - TX). Please, help me to solve this problem. Thank you very much. Paola Pereira.

    Have you ever tried to force restart the phone after the update into the button sleep and home for 10 seconds, until the Apple logo comes back again?

    You won't lose data, but force the reboot can cure some problems after installing new software or applications.

    Also try logging out of your account in the settings/iTunes and AppStore, reboot the phone and you log in again.

    In the event that you have implemented in settings/general/Restrictions of restrictions, turn them off and try again to update or download your applications.

  • How to disable the AppStore offers updated app that does not exist on the ipod touch 5g ios 9 and Reset counter app

    Regularly I receive notifications of updated Brainiacs Sudoku which I had deleted Ipod Touch 5 g a long time ago.  I can't disable the app update counter until I have download the update.  So, how to disable the AppStore offers updated app that does not exist on the ipod touch 5g ios 9 and Reset counter of the application once and for all?

    Try to hide this purchase

    Hide and show purchases iTunes or iBooks on your Mac or PC - Apple Support

  • Lenovo K3 notes App Lock does not

    Lenovo K3 notes App Lock does not work after update from 85 MB

    There isn't that one solution to the problem of blocking app first install app https://play.google.com/store/apps/details?id=com.domobile.applock or https://play.google.com/store/apps/details?id=com.thinkyeah.smartlockfree first go to setting - security - administrator of the device after that click on the option audit and that yet once back in the Security tab option applications with access to the use , click the button for the installed locking software app now check your phone two software work well some lenevo k3 phones also support https://play.google.com/store/apps/details?id=com.sp.protector.free&hl=en this request, so go ahead and enjoy with lenovo k3 updatessssssssssssssss

  • applock and smart app lock does not work on 5.1.1

    Hello. I just upgraded to 5.1.1

    But applock and smart app lock does not work more that is very important to me.

    Who else has experienced the same problem? If you know a solution, let me know pleasr. Thank you

    @avacs

    It's a new update, application developers must check and fix this compatibility problems, not Sony. If the application has been developed by Sony, Sony should fix the problem.

  • Smartphones from blackBerry APP World does not recognize apps!

    I was downloading a game Bubble Breaker, and I lost the connection.  I had already received the email that PayPal had sent payment because it is a paid app.  When I tried to reinstall, App World wanted me to pay for it AGAIN.  The company sent me a link to download because they had been paid, and APP World does not recognize.

    I completely uninstalled App World and reinstalled and it does nothing to help.

    OK, good try.

    Your ISP offer support for AppWorld... contact them and explain. If they say they can't help you, they can. They take over AppWorld. Ask the question to be reassigned to a medium technical level RIM.

Maybe you are looking for