Opening a document with a dialog open

I am trying to open a document with a window open created by javascript, but I get an error when the window is open and I try to open the document. See attached:
Is there no way to have a window open and the application open a document at the same time?
See code, do you see any errors:
#target "InDesign-7.0"
#strict on
UserInteractionLevels.neverInteract;
var dlg;
Validate the input by the user
function validate()
     if(dlg.iPanel.inputPath.text == "")
            alert("Error, please define a directory to convert.");
            return -1;
    if(dlg.oPanel.outputPath.text == "")
            alert("Error, please define an output directory.");
            return -1;
    return 0
define user text file
input to define file path
function getInput()
    var input_folder = Folder.selectDialog( 'Select the directory where you wish to open the files: ', '' );
    if (input_folder != null)
        this.parent.inputPath.text = input_folder.toString();
        this.parent.inputPath.enabled = false;
define user output path
function getOutput()
var output = Folder.selectDialog( 'Select the directory where you wish to output the files: ', '' );
try
this.parent.outputPath.text = output.toString();
catch(e)
alert("Path is undefined");
this.parent.outputPath.enabled = false;
return;
function for writting out
errors.
function log_status(msg, file)
if(errorFile.exists == true)
alert("File  exist")
errorFile.open("e", "", "")
errorFile.write(msg + "\n");
errorFile.close();
else
alert("File no exists");
errorFile.open("w", "", "")
errorFile.write(msg+ "\n") ;
errorFile.close();
return;
open indesign file
function openFile(file)
    try
    app.open(File(file));
    catch(e)
    alert(e);   
return;
Export PDF
function exportPDF(output)
main function to convert
indesign files to pdf
function main()
    var errorFileObj = new File("c:/errorFile.txt");
    var successFileObj = new File("c:/successFile.txt");
    errorFileObj.open("w", "", "");
    successFileObj.open("w", "", "");
    if(validate() == -1)
        return;
    var input_folder = new Folder(dlg.iPanel.inputPath.text);
    files_array = input_folder.getFiles( '*.indd' );
    //dlg.close(1);
    for(var i = 0; i < files_array.length; i++)
        try
            openFile(files_array[i]);
        catch(e)
            errorFileObj.write(files_array[i]+ "\n") ;
            continue;
        try
            //exportPDF(output);
            successFileObj.write(files_array[i]+ "\n") ;
        catch(e)
            errorFileObj.write(files_array[i]+ "\n") ;
            continue;
        alert(files_array[i]);
    successFileObj.close();
    errorFileObj.close();
    alert ("Files finished converting");
create an instance of GUI for
user input
function createGUI()
dlg = new Window('dialog', 'Indesign to PDF:', [100,100,480,300]);
dlg.iPanel = dlg.add('panel',[5,10,375,80], 'Define Input');
dlg.iPanel.inputText = dlg.iPanel.add('statictext', [10,12,125,25], 'Browse for directory:');
dlg.iPanel.inputBtn = dlg.iPanel.add('button', [10,30,110,50], 'Browse');
dlg.iPanel.inputPath = dlg.iPanel.add('edittext', [120,30,350,50], '');
dlg.iPanel.inputBtn.onClick = getInput;
dlg.oPanel = dlg.add('panel',[5,80,375,150], 'Define Output');
dlg.oPanel.outputText = dlg.oPanel.add('statictext', [10,12,165,25], 'Browse for output directory:');
dlg.oPanel.outputBtn = dlg.oPanel.add('button', [10,30,110,50], 'Browse');
dlg.oPanel.outputPath = dlg.oPanel.add('edittext', [120,30,350,50], '');
dlg.oPanel.outputBtn.onClick = getOutput;
dlg.startBtn = dlg.add('button', [225,160,375,185], 'Start Conversion');
dlg.startBtn.onClick = main;
dlg.show();
createGUI();//entry point for the script

Okay, this works....LAME....
#target "InDesign-7.0"
#strict on
UserInteractionLevels.neverInteract;
var dlg;
var files_array;
Validate the input by the user
function validate()
     if(dlg.iPanel.inputPath.text == "")
            alert("Error, please define a directory to convert.");
            return -1;
    if(dlg.oPanel.outputPath.text == "")
            alert("Error, please define an output directory.");
            return -1;
    return 0
define user text file
input to define file path
function getInput()
    var input_folder = Folder.selectDialog( 'Select the directory where you wish to open the files: ', '' );
    if (input_folder != null)
        this.parent.inputPath.text = input_folder.toString();
        this.parent.inputPath.enabled = false;
define user output path
function getOutput()
var output = Folder.selectDialog( 'Select the directory where you wish to output the files: ', '' );
try
this.parent.outputPath.text = output.toString();
catch(e)
alert("Path is undefined");
this.parent.outputPath.enabled = false;
return;
function for writting out
errors.
function log_status(msg, file)
if(errorFile.exists == true)
alert("File  exist")
errorFile.open("e", "", "")
errorFile.write(msg + "\n");
errorFile.close();
else
alert("File no exists");
errorFile.open("w", "", "")
errorFile.write(msg+ "\n") ;
errorFile.close();
return;
open indesign file
function openFile(files_array)
    for(var i = 0; i < files_array.length; i++)
        try
            app.open(File(files_array[i]));
        catch(e)
            alert(e);
            continue;
return;
Export PDF
function exportPDF(output)
main function to convert
indesign files to pdf
function main()
    var errorFileObj = new File("c:/errorFile.txt");
    var successFileObj = new File("c:/successFile.txt");
    errorFileObj.open("w", "", "");
    successFileObj.open("w", "", "");
    if(validate() == -1)
        return;
    var input_folder = new Folder(dlg.iPanel.inputPath.text);
    files_array = input_folder.getFiles( '*.indd' );
    dlg.close ();
    //dlg.destroy();
    for(var i = 0; i < files_array.length; i++)
        try
            openFile(files_array[i]);
        catch(e)
            errorFileObj.write(files_array[i]+ "\n") ;
            continue;
        try
            //exportPDF(output);
            successFileObj.write(files_array[i]+ "\n") ;
        catch(e)
            errorFileObj.write(files_array[i]+ "\n") ;
            continue;
        alert(files_array[i]);
    successFileObj.close();
    errorFileObj.close();
    alert ("Files finished converting");
create an instance of GUI for
user input
function createGUI()
dlg = new Window('dialog', 'Indesign to PDF:', [100,100,480,300]);
dlg.iPanel = dlg.add('panel',[5,10,375,80], 'Define Input');
dlg.iPanel.inputText = dlg.iPanel.add('statictext', [10,12,125,25], 'Browse for directory:');
dlg.iPanel.inputBtn = dlg.iPanel.add('button', [10,30,110,50], 'Browse');
dlg.iPanel.inputPath = dlg.iPanel.add('edittext', [120,30,350,50], '');
dlg.iPanel.inputBtn.onClick = getInput;
dlg.oPanel = dlg.add('panel',[5,80,375,150], 'Define Output');
dlg.oPanel.outputText = dlg.oPanel.add('statictext', [10,12,165,25], 'Browse for output directory:');
dlg.oPanel.outputBtn = dlg.oPanel.add('button', [10,30,110,50], 'Browse');
dlg.oPanel.outputPath = dlg.oPanel.add('edittext', [120,30,350,50], '');
dlg.oPanel.outputBtn.onClick = getOutput;
dlg.startBtn = dlg.add('button', [225,160,375,185], 'Start Conversion');
dlg.startBtn.onClick = main;
dlg.show();
createGUI();//entry point for the script
openFile(files_array);

Similar Messages

  • How can I open a document with applescript without the doc. window opening.

    How can I open a document with applescript without opening the document window and speak the text of the document?  I can get it to open the file but the doc window always opens up. 

    try
              set pathToMyFolderOnDesktop to ("Macintosh HD:Users:jodyconnor:Desktop:") & "Dsource:" as alias
              set rnd to (random number from 1 to 6)
              set rndFileName to (rnd as text) & ".scpt"
              set FullPath to pathToMyFolderOnDesktop & rndFileName as text
              set myScript to load script (FullPath as alias)
      run script myScript
    on error the error_message number the error_number
              display dialog "Error: " & the error_number & ". " & the error_message buttons {"OK"} default button 1
              return
    end try
    This code answered my question:  Hats off to Digimonk from stackoverflow and Darrick Herewe from stackoverflow.

  • Itunes document manager pro will not open a document with .cwk extension. It will catch the document then error message states that it cannot open document. Can anyone tell me what Im doing wrong?

    Itunes document manager pro will not open a document with .cwk extension. It will catch the document then error message states that it cannot open document. Can anyone tell me what Im doing wrong?

    Forgive my ignorance but I have never hear of iTunes Document Manager Pro. If you mean Document Manager Pro, i was able to find that. Back to your problem, have you tried opening one of those files in the iOS iWorks apps? Form the quick read that I did about this, .cwk files can be opened by Pages, Numbers or Keynote, depending on what type of document that it is and those files can be read by Document Manager Pro, after properly saving them. I don't see that you can go directly from the .cwk file in Document Manager Pro without converting them first.
    I took a very quick look at the app, so I may be a missing something about its capability.

  • Opening a document with its default application on the client

    In 6i I use Win_API_Shell.StartFile("path\file", WIN_API.SW_SHOWNORMAL, TRUE);
    to open a document with it's default windows application. How is this done in 10g?
    Do I use webutil? and could someone supply me an example. Again, the document
    would be on the local machine, or a mapped drive, not on the app server.
    I know I could probably use client_host('start ....') but is there a better way?
    Thanks in advance.

    Hi!
    In Forms 10g you have to use webutil for this. No way...
    Why do you think that client_host ( 'cmd /C start path\file.sfx' )
    or
    webutil_host.nonblocking ( 'cmd /C start path\file.sfx' ) is not a good way?
    Regards
    Edited by: Magoo on 05.09.2009 13:15

  • Opening Word documents with Appleworks

    I often receive Word documents as email attachments (though my hotmail account). I can download these Word documents to my desktop but when I click on them to open them I get an offer to purchase MS Word (which I do not have). I would like to be able to simply open the Word documents with Apple works--and I am hoping I can just click on them and have that happen automatically. But it doesn't. I have tried opening Appleworks and going into the wordprocessing program and then opening the Word document through that, but it only is successful part of the time. What can I do? I would like to have these Word douments open automatically in Appleworks but every time I click on them (i.e., their icon on my desktop) I get that advertisement from Microsoft asking me to buy Word. Is this ad blocking a normal function of Appleworks that would otherwise allow me to open Word documents with a click? And in any case, how can I proceed?

    The ad for Word is almost certainly being tacked on through or at Hotmail (taglines or adware from Hotmail? Hoodathunk .....) ; it sure isn't coming from AppleWorks or from anything on your own system, unless you have that demo copy of Office still lurking somewhere. I suppose it could come from that, somehow.
    Assuming you can get a clean attachment downloaded to your Desktop from Hotmail, the procedure for having what you want to happen automatically is fairly straightforward and, really, has nothing at all to do with Appleworks. Try the following:
    --> Select (highlight) one of those downloaded .doc files from Word, then
    --> use the Finder's Get Info command (⌘-I). In the window which appears,
    --> see the "Open with" section, and set it to AppleWorks.

  • Why can't I open a document with the password

    why can't I open a document with the said right password!!!! !

    Hi Anthony,
    What problem are you facing in opening the document? Is there any error message?
    I would recommend you to try again and as passwords are case sensitive so please make sure that you type the password in exactly same case sequence as you did when you set the password.
    Regards,
    Rahul

  • How do you get the pop up box that ask what you want to open a document with, to not pop up at all when you want to open something from your email?

    When I open a attachment from an email a box always pops up that says what program do i want to open this document with. How do i get rid of this pop up box?

    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
    *Do NOT click the Reset button on the Safe mode start window or otherwise make changes.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes
    *https://support.mozilla.org/kb/Troubleshooting+plugins
    Do a malware check with some malware scanning programs on the Windows computer.<br />
    Please scan with all programs because each program detects different malware.
    Make sure that you update each program to get the latest version of their databases before doing a scan.
    *Malwarebytes' Anti-Malware:<br>http://www.malwarebytes.org/mbam.php
    *SuperAntispyware:<br>http://www.superantispyware.com/
    *Microsoft Safety Scanner:<br>http://www.microsoft.com/security/scanner/en-us/default.aspx
    *Windows Defender: Home Page:<br>http://www.microsoft.com/windows/products/winfamily/defender/default.mspx
    *Spybot Search & Destroy:<br>http://www.safer-networking.org/en/index.html
    *Kasperky Free Security Scan:<br>http://www.kaspersky.com/security-scan
    You can also do a check for a rootkit infection with TDSSKiller.
    *http://support.kaspersky.com/viruses/solutions?qid=208280684
    See also:
    *"Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked

  • Will Lion open Appleworks documents with Pages or Numbers as Snow Leopard does?

    Will Lion open Appleworks documents with Pages or Numbers like Snow Leopard does? Or do I have to convert all my Appleworks files before installing Lion?

    Functionality of Pages and Numbers has little to do with whether it's runnong on Snow Leopard or Lion.  Either way, if they open an AppleWorks document in SL, they'll open it in Lion.  Of course, you have to understand that certain file types - particularly, AppleWorks databases - cannot be opened with anything other than AppleWorks, so you'll need to convert them with AppleWorks before upgrading to Lion.

  • Reconciling open GRPO documents with GL

    Has anyone reports or methods to reconcile the value of open GRPO documents with the value in the general ledger GRNI account?
    I've always found the lack of a report a big limitation. The obvious problem is that the open GRPO documents might be Service or have non-stock Items, neither of which affect the GL.
    I've asked similar questions before but not really got anywhere. I'm hoping that someone's got something new.
    Regards,
    Douglas

    I  am trying to tell users how they can reconcile open GRPOs with the GL balance for GRNI. This would be something that they would do routinely, say every month, so it's not just a one-time exercise. (I am using the word reconcile in this sense to mean compare to or check against. I don't mean Business One's Internal Reconciliation function.)
    This is very similar to what an accountant would do to reconcile (compare) the Debtors (Sales) to the GL. The accountant would run an Aged Debtors report to see the open balance on the debtors (customer) documents then compare that to the balance on the Debtors Control Account in the general ledger. For Debtors, you would expect that they would be exactly the same.
    The problem with GRPOs, as you know, is that not all the values on the GRPOs go onto the GL. So the question is, how can you reconcile the two, i.e check one against the other?
    For me, this is a big omission in the way that Business One works, and I keep hoping that someone has come up with a technique. We keep getting asked this question by users.
    Regards,
    Douglas

  • How do I open dual documents with windows8?

    How do I open dual documents with windows8? whenever I have one adobe doc open and i need to reference another, it will only open one at a time...I want to view with a split screen...HELP!
    Message was edited by: big_bubber

    Adobe Reader Touch for Windows 8 doesn't support more than one document opened at a time. Good feature request! Thanks.

  • How to open iCloud documents with ios8

    hi,
    i recently updated my iPad to ios8. and when it asked me to install iCloud drive i said yes.
    Now when i open pages on my iPad, there are no documents.
    when i go to iCloud.com on my mac i can see those documents, so they still exist.
    how can i open my 'iCloud'  documents on pages on my iPad?
    most forums say i need to install the beta version of os yosemite, whom installation is not working those days.
    the only thing i can do was to open a document on iCloud.com on my mac and send it to me via email. from my iPad i could read that email and open the document in pages. But this work only with small documents, a document bigger than 20 Mo, cannot be sent via email ( i'm using gmail)
    please help me, i really need those documents, i'm working with them.
    thank you

    beckstarr wrote:
    Does anyone know how to open pages document with windows vista? i saved it onto a usb stick but when i tried to open it on the computers in my university which support windows vista, it didnt reconise the file and opened with a page of question marks!!!! Im panicking now!!!!!
    You cannot open it on Windows Vista. The only application in the world that opens a Pages document is Pages, and it is Mac OS X only.
    Your options:
    1. Find a Mac with Pages installed, and save the document as doc or pdf, which you can open on Vista.
    or, if that is impossible,
    2. Open the files in a texteditor like Notepad.exe on Windows and try to piece text fragments together to get at least part of your original text back. The images should also be available somewhere, even though all formatting is gone.

  • How to open pages documents with windows vista

    Does anyone know how to open pages document with windows vista? i saved it onto a usb stick but when i tried to open it on the computers in my university which support windows vista, it didnt reconise the file and opened with a page of question marks!!!! Im panicking now!!!!!
    Id appreciate any help!!! thanks!!!!!

    beckstarr wrote:
    Does anyone know how to open pages document with windows vista? i saved it onto a usb stick but when i tried to open it on the computers in my university which support windows vista, it didnt reconise the file and opened with a page of question marks!!!! Im panicking now!!!!!
    You cannot open it on Windows Vista. The only application in the world that opens a Pages document is Pages, and it is Mac OS X only.
    Your options:
    1. Find a Mac with Pages installed, and save the document as doc or pdf, which you can open on Vista.
    or, if that is impossible,
    2. Open the files in a texteditor like Notepad.exe on Windows and try to piece text fragments together to get at least part of your original text back. The images should also be available somewhere, even though all formatting is gone.

  • I am unable to open scanned documents (with .jpg file extension) in my e-mail inbox, on the Mail app on my iPad. Please provide a clear answer. Thanks a lot.

    I am unable to open scanned documents (with .jpg file extension) in my e-mail inbox, on the Mail app on my iPad. Please provide a clear answer. Thanks a lot.

    Can you actually see that the attachment has a .jpg extension?  Some mail systems strip it off (I've seen AOL do that) which makes the attachment difficult to open.

  • Cannot open the document with 'Composition failed to load'.

    After confronting an error message during the publishing, I cannot re open the document with 'composition failed to load' message.
    I desperately need to save this document! is there any chance to save it?
    the screenshot is here.

    Thank you for your help and advice.
    It is great to be fixed in near future. good news!
    Kim Kyoung Hong
    Sent with Airmail
    켜짐 2014년 10월 14일 에서 오후 3:58:58, Bharadwaj ([email protected]) 작성됨:
    Cannot open the document with 'Composition failed to load'.
    created by Bharadwaj in Edge Animate CC - View the full discussion
    This is the error you are getting when you are opening the published content on web. This is a bug, but you can use the below fix.
    Open the publish/web/index_edge.js and remove the "use strict"; statement at the beginning.
    This will fix the problem. We will address this issue in the next release.
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at https://forums.adobe.com/message/6822974#6822974
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page:
    To unsubscribe from this thread, please visit the message page at . In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Edge Animate CC by email or at Adobe Community
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0.

  • I can't open my documents with the update.

    I can't open my documents with the update. It says to update pages in the app store but I've already done that, that how I got in this stupid mess. How do I fix it? When I go on the app store it doesnt say update, it says installed, but I still cant open my documments. I'm freaking out.

    Are you launching Pages from an icon in your Dock? Installing the update does not change the Dock icons & it does not remove the older versions. Go to your Applications folder & launch the new Pages from there.

Maybe you are looking for

  • Clear/Delete alert message in CCMS

    Hi, I have a red alert message in RZ20 (CCMS monitor) in the node called QRFC Queues - Exactly-Once Processing Queues - Int. Server Outbound Messages (XBTO*) - Blocked queues: Client 100 It's a message that failed a week ago, and the message is now c

  • How to Add more music tunes to slideshow?

    My slideshows are sometimes bigger and take longer than one tune.

  • Revenue Recognition in projects

    I have the following requirement: 1 Scenario is MTO. 2 Once the order is complete, the stock is shipped to the customer site. At this point no COGS should be recognised and it should remain a stock. 3 Once the stock is shipped to the customer site, c

  • Which later IMacs can run Snow Leopard?

    I am planning on getting a new (or refurbished) 27 inch IMac soon, to replace an older Mac. Problem is, I will need to dual boot between Snow Leopard, and Lion, because I must still use Quicken. I assume if I pick a 2010 IMac, it will still run Snow

  • Multi-column chart issues

    Hi, I'm trying to make a 2d column chart of quiz entry results with multiple series (one per possible answer) but it's not working as intended. I have 5 series all with code like: select null link, substr(question, 1, INSTR(question,' - ',1,1)), coun