ScriptUI run script from dialog button

Here is what I have right now.  It is a little clunky in the way it works, and I would just like to make it a bit slicker.
I have a script on startup that creates a Menu item with a dropdown submenu item. when you click on the submenu item, it starts a script. 
The first thing the script does is pop up a message box that tells them that two dialog boxes are going to popup. The first one asking them to choose the location of an xml file and the second dialog box that ask them to choose the location of their image folder.  After they finish choosing their folder in the second dialog, the script takes those two values, makes them variables, and continues to run the rest of the script. 
Here is what I would like it to do..
1. open a dialog window with two input fields, two "browse" buttons, and OK and CANCEL buttons
2. when you click the first browse button next to the first input field, it will open a file dialog window.  You select your file and the file string will populate the input field
3. when you click the second button next to the second input field, it opens a folder dialog window.  You select the folder and the string populates the second input field.
4. when you click OK, it feeds the values in the input fields to a script.
I already have scripts to that open the file and folder dialogs, but what I can't figure out  how to do is to start and run a script from a button press, in this case, when the OK button is pressed.  It is probably an onClick, but I haven't been able to find any examples of what the syntax would be. 
The closest I have found is in the Beginning ScriptUI document that was on Jongware's site, in the section on Communication between windows.  But that opens each of the windows with a different script and not using a button press to call a script.
As always, any point in the right direction is very much appreciated. thanks.

Thanks Gotterman, but the issue I was having was that the dialogs I was opening were not being created by me.  They were more like OS generated windows.  So I am not able to give the window a name, or the input field a name in order to reference it.
Peters response was actually correct, although I did have to open the folder dialog a bit differently to get it to work.  I had to use a style that I got from Jongware in a previous thread, but the concept that Peter showed in the last post pointed me in the right direction. 
I just have one more piece to figure out, how I am going to pass the variables to another script, but I think that is something i will have to work out on my own.
For anyone who is curious, here is the code I came up, modifying and combining some of Peters examples from the book plus the help he gave me in this thread.  The alert after closing the dialog is just for testing to show that the values are being held by the variables so I can use them else where.
function mySnippet(){    
//<fragment>   
#target indesign;
#targetengine "session";
var w2 = new Window("palette", "Window 2", undefined, {resizeable: true});
var e2 = w2.add ("edittext"); e2.characters = 30;
var e3 = w2.add ("edittext"); e3.characters = 30;
var f2 = w2.add ("button", undefined,"Browse XML");              
var f3 = w2.add ("button", undefined,"Browse Folder");              
var f4 = w2.add ("button",undefined,"SAVE AND RUN");              
var tf              
var tfo                
f2.onClick = function()                {               
tf = File.openDialog("Select your XML File","*.xml");                    
if (tf != null)                    
e2.text = tf;                    
f3.onClick = function()                {              
var tfol = new Folder("~/My Documents")               
tfo = tfol.selectDlg("Get Folder");                    
if (tfo != null)                    
e3.text = tfo;                    
f4.onClick = function()               
w2.close();                   
alert ("xml value: " + tf  + "\nfolder value: " + tfo);                
w2.show();    
//</fragment>

Similar Messages

  • An error occurred while running scripts from the package "mzm,stuhjljp.pkg".

    I hope someone can help, I have now tried downloading Lion OSx 4 times and I keep getting this message: An error occurred while running scripts from the package "mzm,stuhjljp.pkg".
    I go back to the app store and it kindly tells me it's installed. It's not quite simply it is nowhere to be found.
    Nice one Apple for moving away from those reliable discs and causing pain, wasted productivity and a **** of a lot of frustration. $29.99 to annnoy the **** out of me, thanks.
    Anyone have a solution that may be of assistance.

    Mj, I can't offer much help but you may be able to use this method to "find" Lion OS X in the App Store again.
    Hold down the "option" key while clicking on the App Store icon.  Keep holding down the option key, then click on the "Purchased" tab at the top of the page. 
    With any luck the button to the right of Lion OS X will now say "install."
    I'm having a similar problem reinstalling Lion, so don't be surprised if you try to reinstall and get the same error.
    Good luck,
    Contender

  • HT1222 hi i have a apple imac 27 2009 and i have purchased mountain lion but near the end it says An error occurred while running scripts from the package "mzps6175750011235388779.pkg"

    hi i have a apple imac 27 2009 and i have purchased mountain lion but near the end it says An error occurred while running scripts from the package “mzps6175750011235388779.pkg”
    can you please advise me what should i do to fix this

    Some ideas.
    https://discussions.apple.com/message/20034600#20034600

  • Script Alert "You should only run scripts from a trusted source."

    I created a small javascript which opens Photoshop and resizes some images.
    I want to be able to double-click the .JSX file from Windows Explorer, and have Photoshop execute the script. Likewise, I want to be able to run the .JSX file from the command line.
    The script runs perfectly. However, the problem is that I don't want any user interaction. I want to be able to run the script from the command line without the user having to click anything. What happens now when I try to run the file from Windows Explorer of the command line is, I get a Script Alert with the following text:
    You are about to run a script in Adobe Photoshop CS3. You should only run scripts from a trusted source. Do you want to run the script? Yes/No
    Is there any possible way to bypass this message or to answer in the affirmative?
    Thanks,
    Jamie L.

    Hi... Sorry to revive such an old thread,
        Does anyone know the "trusted source" folder for MAC CS4.
    EDIT!
    My bad.  "The /users/<user_name>/documents/Adobe Scripts" folder is working for this purpose for me.  I needed a path to it and forgot that the ~ resolves to the current user.  Sweet.
    -Bill

  • Problems downloading and installing OS X Yosemite An error occurred while running scripts from the package

    Hi! I have problems downloading and installing OS X Yosemite.
    While downloading this message pops up:
    An error occurred while running scripts from the package \U201cwct8079783343594854923.pkg\U201d.
    and in /var/log/install.log i can see:
    MacBook-Pro installd[1086]: PackageKit: Install Failed: PKG: pre-install scripts for "com.apple.pkg.InstallMacOSX"\nError Domain=PKInstallErrorDomain Code=112 UserInfo=0x100193c00 "An error occurred while running scripts from the package “wct8079783343594854923.pkg”." {\n    NSFilePath = preinstall;\n    NSLocalizedDescription = "An error occurred while running scripts from the package \U201cwct8079783343594854923.pkg\U201d.";\n    NSURL = "#InstallMacOSX.pkg -- file://localhost/Users/username/Library/Application%20Support/AppStore/91504108 2/wct8079783343594854923.pkg#Distribution";\n    PKInstallPackageIdentifier = "com.apple.pkg.InstallMacOSX";\n}
    does anyone have an idea about this?
    thank you very much

    Mucked up installation. If the installer app is still in /Applications, delete it and start over.
    27" i7 iMac (Mid 2011) refurb, OS X Yo (10.10.2), Mavs, ML & SL, G4 450 MP w/10.5 & 9.2.2

  • Cannot prevent ExtendScript debugging while running scripts from After Effects

    Hi,
    I am facing this issue while running scripts from within After Effects. Whenever I am trying to run a script in After Effects, the script opens up in ESTK in the debug mode. The execution waits at the starting point of the script as if there is breakpoint even though there is none. I am not sure whether what I am missing, whether some debug flag needs to be reset etc. I am using After Effects CC on Windows 7 OS. Any help would be highly appreciated.
    Thanks.

    I tried running the script after removing all $.writeln() statements, but unfortunately that does not resolve the problem. For testing the issue, I am trying with the simple script given below :
    var window = new Window ("palette", "My Window", undefined);
    var panel = window.add("panel", undefined, "Panel");
    var text = panel.add("statictext", undefined, "Testing AE");
    window.show();
    But executing even this one from AE opens up ESTK. I am absolutely stuck with this odd behaviour .

  • An error occurred while running scripts from the package "ztb343812063996219254.pkg

    i tried to upgrade my os lion 10.7.5 to os x yosemite on my macbook pro and in the middele of downloading I'm getting this notice: an error occurred while running scripts from the package "ztb343812063996219254.pkg
    help me please…..
    i think i have problem with the app store cause sometimes I'm getting more errors like error no 13 or 100
    what should i do?

  • Error when running script from OTM

    Hi team,
    Customer is trying to run script from OTM but is getting a "JWG file does not exist" error. I found the following metalink note and the customer has verified that the repositories are defined with exactly the same names & paths in OTM & Openscript.
    Scripts Failing To Play Back From OATS Test Manager (OTM) (Doc ID 1587941.1)
    I've also checked the following post in the forums but this doesn't apply to the customer because both the OTM & agent are on Windows:
    https://forums.oracle.com/message/10707963
    Appreciate any pointers
    Thanks,
    Krishna

    Hi Krishna
    Is the agent running as a windows service or started from an interactive batch?
    What kind of script is that? Web, Forms, Siebel, other?
    Are they different repositories or the same? If different, how do you copy scripts from one to the other one?
    Cheers
    JB

  • Calling ASP script from APEX button passing Bind variable

    I am looking for some examples or best form for calling asp script from apex button that will pass apex bind variable to asp script to process.
    Thanks,s
    Bob

    I am surprised by the degree of no replies. I have solved this by using asp redirects such as:
    Response.Redirect("test.aspx?UserName="&user)
    My formulated solution contains a page with a manually built interactive report. I have a number of bind variables at the top of the reoprt where users can query the information they want based on desginated database columns for this particular report. Once they have the "manual" interactive report displaying what they want, they click a button where a asp script is called with parameters passed that calls a Java based Crystal Reports plugin with the called correspnding report displayed with passed parameters.
    Works like a charm!
    This solves our reporting needs without having to resort to Bi Publisher (much too expensive) and other third party applications that kinda indicate it can work with apex but provide limited help or best form for doing so.
    Bob

  • Running report from a button in forms 6 with parameter

    im new to reports 6 please give me the code for running report from a button in forms 6 with parameter
    regards

    Hi ,
    Use this SRW.RUN_REPORT..
    Go thru the help in Reports by typying
    Running a report from Form Builder or Graphics Builder
    go thru the instuctions and examples.
    --Basava.S                                                                                                                                                                                                                                                                                                                                                                           

  • "An error occurred while running scripts from the package "DeveloperTools.pkg"

    I'm trying install my xcode 4.2 and check log and this where there is problem
    "An error occurred while running scripts from the package “DeveloperTools.pkg”

    II found the answer elsewhere. I logged in from a diffent admin acount and the install went fine.

  • Running scripts from Finder, and printing without a dialog

    Two questions:
    1. I need to launch an InDesign script from outside of InDesign -- such as launching the script from the finder (Mac) and having it run in InDesign. How can I do this?
    2. How can I script printing a document so that it automatically prints, bypassing the Print dialog box that a user would need to click on (I want it to print automatically in the background without the user doing anything)?

    1. Just save your script as an application and wrap your stuff in an "on run" statement.
    on run
    tell application "Adobe InDesign"
    --do stuff
    end
    end
    See the Applescript Language Reference at developer.apple.com/applescript for more info.
    2. Yup. The "do stuff" in your case will probably look something like this:
    tell active document
    --Set up options, assumes you have created a printer preset
    -- with the output options you want
    set active printer preset of print preferences to "my printer preset"
    set page range of print preferences to all pages
    --And then print
    print without print dialog
    end

  • #Include or run script from HTML panel button?

    I'v been trying to make a panel with the HTML widget and I keep running into issues. The buttons I made wont run the scripts. Is there a way to include js for PS inside the html to run when the button is pressed? <script></script> doesn't seem to work for things inside of PS. Or is there a way to run a script in PS from a button?
    I guess I have multiple questions really. Do you always have to use _AdobeInvokeScript inside the button? I have seen some examples without it and I'm not sure what works and what doesn't.

    Thank you Paul!
    %20 is just how space characters are encoded and doesn't matter
    Ye, I know this,.. it`s was my just suggestion...
    So. The solution in this string:
    var scriptFile = File(File($.fileName).parent.parent.absoluteURI + "/Change Render Locations.jsx")
    Everything else is identical, in my script and in your. Of course except alerts. I remove them, and now i have just my button which works fine....
    And may be you can suggest, why does not work "my" method of running the script?
    Thanks again!

  • FRM-92101 error while running report from a button or menu

    Hi All,
    I am getting the error FRM-92101 while running report without parameter from a button or menu. I am using Developer Suit 10g. I get the error as it shows there has some configuration problem in my form. Will you please help me anyone how can i solve the problem. My previous forms running very well both with parameter and without parameter.
    Arif

    Hello Sir,
    Thanks for your cooperation. I have solved my problem by myself. The fact was that, when i tried with the following code which made my report---
    SELECT br.bid, br.bname, br.branchtxnstatus, dif.difference
    FROM branch br,
    (SELECT gladbrid branchid,
    SUM
    (CASE
    WHEN ga.gl_acc_categry IN ('L', 'I')
    THEN gd.gladbalance
    ELSE -1 * gd.gladbalance
    END
    ) AS difference
    FROM glaccount ga, glaccountdetail gd
    WHERE ga.glid = gd.gladglid
    GROUP BY gladbrid) dif
    WHERE dif.branchid = br.bid AND br.branchtxnstatus = :Br_Status
    and dif.difference!=0
    ORDER BY br.bid;
    and the code against the button or menu item is---
    DECLARE
    repid REPORT_OBJECT;
    v_rep VARCHAR2(100);
    rep_status VARCHAR2(20);
    BEGIN
    repid := FIND_REPORT_OBJECT('ASSET');
    v_rep := RUN_REPORT_OBJECT(repid);
    rep_status := REPORT_OBJECT_STATUS(v_rep);
    WHILE rep_status in ('RUNNING','OPENING_REPORT','ENQUEUED')
    LOOP
    rep_status := report_object_status(v_rep);
    END LOOP;
    IF rep_status = 'FINISHED' THEN
    /*Display report in the browser*/
    WEB.SHOW_DOCUMENT('http://192.168.0.21:8889/reports/rwservlet/getjobid'||
    substr(v_rep,instr(v_rep,'_',-1)+1)||'?'||'server=repserver90','_blank');
    ELSE
    message('Error when running report');
    END IF;
    Clear_message;
    END;
    Clear_message;
    which has shown the error FRM-92101 and didn't run the report.
    In that case I have changed the query to run the report. first of all i create a view following the query and build the report using a simple select query. that's etc. my report running fine now.
    It is mentioned that there had no error on my codes.
    Arif

  • Issues in running scripts from OTM

    Hi ,
    I have created an endtoend scenario where the script starts from creating requistion, approval, PO creation approval , receipt creation then Invoice and payment.
    My script failing with different reason for different runs. Mailnly its failing whenever the steps are referrred to Standard Oracle Forms.(Eg: Invoice Batch, Receipt Form etc).
    I am running this from machine where Openscript and OTM is installed.
    I tried the command line arugment like " -delayPercentage -1 -delayMin 1 -delayMax 20 " while running the script from OTM. Still issue is same. If I am not using this commad the script steps deviates and failing. I mean in script the step is to choose some responsibility A it is choosing B. To override think times recorded I have used thread.sleep(2000) after every thinktime entry to run it from openscript.
    and to run it from OTM I am using above command.
    Now can anyone suggest me is anyother way that we can overcome these timeout errors. Am I using command line argument in correct way ? Please help

    Hi,
    First try your playback from OpenScript.
    Before play back go to View -> OpenScript Preferences -> PlayBack -> Oracle EBS/Forms Functional
    Increase timeouts in Event Timeout. Also Increase timeout in Web Functional (Object timeout)
    Then Apply and OK    
    Now try play back from OpenScript
    Regards,
    Deepu M
    [email protected]

Maybe you are looking for