Saving parameters entered in a gui dialog to be used in the main panel

Hi,
I'm having a nightmare at the moment.
I've finished creating a program for my final year project, that is all comand line at the moment.
i'm required to design a GUI for this. i've started already and have a main panel that has a few buttons one of which is a setParameters button. which opens up a file dialog that allows the user to enter parameters that will be used by the main panel later on.
I'm having trouble imagining how these parameters will be accessed by the main Panel once they are saved.
At the moment, without the GUI i have get and set methods in my main program which works fine. Is this the kind of thing i'll be using for this?
my code for the parameters dialog
public class Parameters  extends JDialog
     private GridLayout grid1, grid2, grid3;
     JButton ok, cancel;
        public Parameters()
                setTitle( "Parameters" );
                setSize( 400,500 );
                setDefaultCloseOperation( DISPOSE_ON_CLOSE );
          grid1 = new GridLayout(7,2);
          grid2 = new GridLayout(1,2);
                JPanel topPanel = new JPanel();
                topPanel.setLayout(grid1);
          JPanel buttonPanel = new JPanel();
                buttonPanel.setLayout(grid2);
          ok = new JButton("OK");
              ok.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent e) {
              //when pressed i want to save the parameters that the user has entered
          //and be able to access these in the RunPanel class
          cancel = new JButton("Cancel");
             cancel.addActionListener(new ActionListener() {
                      public void actionPerformed(ActionEvent e) {
                    //when pressed just want the Jdialog  to close
          buttonPanel.add(ok);
          buttonPanel.add(cancel);
          JTextArea affinityThresholdScalar = new JTextArea();
          JTextArea clonalRate = new JTextArea();
          JTextArea stimulationValue = new JTextArea();
          JTextArea totalResources = new JTextArea();
          JLabel aTSLabel = new JLabel("affinityThresholdScalar");
          JLabel cRLabel = new JLabel("clonalRate");
          topPanel.add(aTSLabel);
          topPanel.add(affinityThresholdScalar);
          topPanel.add(cRLabel);
          topPanel.add(clonalRate);
                Container container = getContentPane();//.add( topPanel );
          container.add( topPanel, BorderLayout.CENTER );
          container.add( buttonPanel, BorderLayout.SOUTH );
     }the main panel class is:
public class RunPanel extends JPanel implements ActionListener
     JButton openButton, setParametersButton, saveButton;
     static private final String newline = "\n";
     JTextArea log;
         JFileChooser fc;
     Data d = new Data();
     Normalise rf = new Normalise();
     Parameters param = new Parameters();
    public RunPanel()
        super(new BorderLayout());
        log = new JTextArea(5,20);
        log.setMargin(new Insets(5,5,5,5));
        log.setEditable(false);
        JScrollPane logScrollPane = new JScrollPane(log);
        fc = new JFileChooser();
        openButton = new JButton("Open a File...")
        openButton.addActionListener(this);
     setParametersButton = new JButton("Set User Parameters");
        setParametersButton.addActionListener(this);
     saveButton = new JButton("save");
        saveButton.addActionListener(this);
        JPanel buttonPanel = new JPanel(); //use FlowLayout
        buttonPanel.add(openButton);
     buttonPanel.add(setParametersButton);
     JPanel savePanel = new JPanel();
     savePanel.add(saveButton);
        add(buttonPanel, BorderLayout.PAGE_START);
        add(logScrollPane, BorderLayout.CENTER);
     add(savePanel, BorderLayout.SOUTH);
    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == openButton) {
            int returnVal = fc.showOpenDialog(RunPanel.this);
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                File file = fc.getSelectedFile();
                log.append("Opening: " + file.getName() + "." + newline);
          Vector data = d.readFile(file);
          log.append("Reading file into Vector " +data+ "." + newline);
          Vector dataNormalised = rf.normalise(data);
         else {
                log.append("Open command cancelled by user." + newline);
            log.setCaretPosition(log.getDocument().getLength());
     else if (e.getSource() == saveButton) {
            int returnVal = fc.showSaveDialog(RunPanel.this);
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                File file = fc.getSelectedFile();
                log.append("Saving: " + file.getName() + "." + newline);
            } else {
                log.append("Save command cancelled by user." + newline);
            log.setCaretPosition(log.getDocument().getLength());
     else
          if (e.getSource() == setParametersButton)
                log.append("loser." + newline);
                      param.show();
    private static void createAndShowGUI() {
        JFrame.setDefaultLookAndFeelDecorated(true);
        JDialog.setDefaultLookAndFeelDecorated(true);
        JFrame frame = new JFrame("AIRS");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JComponent newContentPane = new RunPanel();
        newContentPane.setOpaque(true);
        frame.setContentPane(newContentPane);
        frame.pack();
        frame.setVisible(true);
    public static void main(String[] args) {
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
}Can anybody offer any suggestions?
Cheers

What you need is my ParamDialog. I think it could be perfect for this sort of thing. There are a few references in it to some of my other classes namely
StandardDialog. Which you can find by searching for other posts on this forum. But if you'd rather not find that you could just use JDialog instead
WindowUtils.visualize() this is just a helper method for getting things visualized on the screen. You can just use setBounds and setVisible and you'll be fine.
You are welcome to use and modify this code but please don't change the package or take credit for it as your own work.
If you need to bring up a filedialog or a color chooser you will need to make some modifications. If you do this, would you mind posting that when you are done so that myself and others can use it? :)
StandardDialog.java
================
package tjacobs.ui;
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.GraphicsConfiguration;
import java.awt.HeadlessException;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import java.awt.*;
import java.util.HashMap;
import java.util.Properties;
/** Usage:
* *      ParamDialog pd = new ParamDialog(new String[] {"A", "B", "C"});
* pd.pack();
* pd.setVisible(true);
* Properties p = pd.getProperties();
public class ParamDialog extends StandardDialog {
     public static final String SECRET = "(SECRET)";
     String[] fields;
     HashMap<String, JTextField> mValues = new HashMap<String, JTextField>();
     public ParamDialog(String[] fields) throws HeadlessException {
          this(null, fields);
     public ParamDialog(JFrame owner, String[] fields) {
          super(owner);
          setModal(true);
          this.fields = fields;
          JPanel main = new JPanel();
          main.setLayout(new GridLayout(fields.length, 1));
          for (int i = 0; i < fields.length; i++) {
               JPanel con = new JPanel(new FlowLayout());
               main.add(con);
               JTextField tf;
               if (fields.endsWith(SECRET)) {
                    con.add(new JLabel(fields[i].substring(0, fields[i].length() - SECRET.length())));
                    tf = new JPasswordField();
               else {
                    con.add(new JLabel(fields[i]));
                    tf = new JTextField();
               tf.setColumns(12);
               con.add(tf);
               mValues.put(fields[i], tf);
          this.setMainContent(main);
     public boolean showApplyButton() {
          return false;
     public void apply() {
     private boolean mCancel = false;
     public void cancel() {
          mCancel = true;
          super.cancel();
     public Properties getProperties() {
          if (mCancel) return null;
          Properties p = new Properties();
          for (int i = 0; i < fields.length; i++) {
               p.put(fields[i], mValues.get(fields[i]).getText());
          return p;
     public static void main (String[] args) {
          ParamDialog pd = new ParamDialog(new String[] {"A", "B", "C"});
          WindowUtilities.visualize(pd);     
     public static Properties getProperties(String[] fields) {
          ParamDialog pd = new ParamDialog(fields);
          WindowUtilities.visualize(pd);
          return pd.getProperties();          

Similar Messages

  • Dialog updates database... refresh Main panel?

    ref: JDev 3.1
    Given an application that has a Master/Detail Form with details in a gridcontrol, and a button that kicks up a dialog panel that allows the user to edit extensively a row that appears in the said gridcontrol...
    How does one force a refresh of the underlaying rowset in the original panel ( and force a redisplay into the grid control to reflect the updated data )?
    I'm trying to avoid instantiating the rowset as a passed parameter to the dialog and then manually pushing everything back on the main panel...
    Or am I ( again ) conceptually missing some significant approach to solving this task?
    TIA

    OK... here's some (working) sample code for an application based on Brian's help to Ali's session question, that also answers my question. Probably obvious to many, it may be helpful to newbies like me who are very confused reading the postings and trying to figure this stuff out.
    It shares a rowset between a frame and a dialog box. The data is kept in synch (automagically) as things change in the dialog box.
    Steps:
    1. Build a database connection class
    2. Put it in the application before opening the base frame.
    3. Build the frame/dialog. DO NOT specify a sessioninfo/rowsetinfo using the infoproducer drag/drops.
    4. Manually hardcode the sessioninfo/rowset stuff manually as noted.
    Note also that session info is not passed nor published except once.
    This seems to work. Please advise if you know of any glaring flaws. I wouldn't be surprised. Obviously, this is easier to actually do when you see the sample code than what it sounds like reading the postings! TIA.
    public class Application1
    public Application1()
    /** call the generic database connections **/
    /** Note that this is a simple class that used the IDE **/
    /** to define a sessioninfo and rowset using drag and drop **/
    /** in the DESIGN mode to the Structure pane... then edit the attributes **/
    dbConnections x = new dbConnections();
    /** THEN open the frame **/
    Frame1 frame = new Frame1();
    frame.show();
    public static void main(String[] args)
    new Application1();
    package package2;
    import oracle.dacf.dataset.*;
    import oracle.dacf.dataset.connections.*;
    public class dbConnections extends Object
    SessionInfo sessionInfo3 = new SessionInfo();
    RowSetInfo rowSetInfo3 = new RowSetInfo();
    AttributeInfo ACTION_CODErowSetInfo3 = new AttributeInfo(java.sql.Types.VARCHAR);
    AttributeInfo ACTION_TEXTrowSetInfo3 = new AttributeInfo(java.sql.Types.VARCHAR);
    public dbConnections()
    try
    jbInit();
    sessionInfo3.publishSession();
    catch (Exception e)
    e.printStackTrace();
    private void jbInit() throws Exception
    ACTION_TEXTrowSetInfo3.setName("ACTION_TEXT");
    ACTION_CODErowSetInfo3.setName("ACTION_CODE");
    rowSetInfo3.setAttributeInfo( new AttributeInfo[] {
    ACTION_CODErowSetInfo3,
    ACTION_TEXTrowSetInfo3} );
    sessionInfo3.setAppModuleInfo(new PackageInfo("", "MyProject3"));
    sessionInfo3.setConnectionInfo(new LocalConnection("qms"));
    sessionInfo3.setName("sessionInfo3");
    rowSetInfo3.setQueryInfo(new QueryInfo(
    "rowSetInfo3ViewUsage",
    "package2.ActionCodes",
    "action_code, action_text",
    "action_codes",
    null,
    null
    rowSetInfo3.setSession(sessionInfo3);
    rowSetInfo3.setName("rowSetInfo3");
    package package2;
    import javax.swing.*;
    import java.awt.*;
    import oracle.dacf.control.swing.*;
    import oracle.jdeveloper.layout.*;
    import oracle.dacf.dataset.*;
    import java.awt.event.*;
    public class Frame1 extends JFrame
    JPanel jPanel1 = new JPanel();
    GridControl gridControl1 = new GridControl();
    XYLayout xYLayout1 = new XYLayout();
    XYLayout xYLayout2 = new XYLayout();
    JButton jButton1 = new JButton();
    public Frame1()
    super();
    try
    jbInit();
    catch (Exception e)
    e.printStackTrace();
    private void jbInit() throws Exception
    this.getContentPane().setLayout(xYLayout2);
    this.setSize(new Dimension(517, 549));
    jButton1.setText("Detail");
    jButton1.addActionListener(new java.awt.event.ActionListener()
    public void actionPerformed(ActionEvent e)
    jButton1_actionPerformed(e);
    gridControl1.setLayout(xYLayout1);
    this.getContentPane().add(jPanel1, new XYConstraints(0, 0, 508, 284));
    jPanel1.add(gridControl1, null);
    this.getContentPane().add(jButton1, new XYConstraints(219, 268, -1, -1));
    /** manually typed this in **/
    gridControl1.setDataItemName("infobus:/oracle/sessionInfo3/rowSetInfo3");
    void jButton1_actionPerformed(ActionEvent e)
    Dialog1 myDialog = new Dialog1();
    myDialog.show();
    package package2;
    import javax.swing.*;
    import java.awt.Frame;
    import java.awt.BorderLayout;
    import oracle.jdeveloper.layout.*;
    import oracle.dacf.control.swing.*;
    import oracle.dacf.dataset.*;
    public class Dialog1 extends JDialog
    JPanel jPanel1 = new JPanel();
    XYLayout xYLayout1 = new XYLayout();
    TextFieldControl textFieldControl1 = new TextFieldControl();
    NavigationBar navigationBar1 = new NavigationBar();
    TextFieldControl textFieldControl2 = new TextFieldControl();
    public Dialog1(Frame parent, String title, boolean modal)
    super(parent, title, modal);
    try
    jbInit();
    pack();
    catch (Exception e)
    e.printStackTrace();
    public Dialog1()
    this(null, "", false);
    private void jbInit() throws Exception
    jPanel1.setLayout(xYLayout1);
    getContentPane().add(jPanel1);
    jPanel1.add(textFieldControl1, new XYConstraints(89, 125, 234, -1));
    jPanel1.add(navigationBar1, new XYConstraints(99, 314, -1, -1));
    jPanel1.add(textFieldControl2, new XYConstraints(89, 158, 236, -1));
    /** Manually typed the following in **/
    textFieldControl1.setDataItemName("infobus:/oracle/sessionInfo3/rowSetInfo3/ACTION_CODE");
    textFieldControl2.setDataItemName("infobus:/oracle/sessionInfo3/rowSetInfo3/ACTION_TEXT");
    navigationBar1.setDataItemName("infobus:/oracle/sessionInfo3/rowSetInfo3");
    null

  • Inline dialog title icon used when the dialog is running a bound taskflow

    Hy,
    if a bounded/unbounded taskflow runs inside a dialog, in the upper left corner of the dialog a 'task_flow_definition.png/unbounded_task_flow.png' appears.
    Is there a way to replace these icons with a custom icon ?
    In oracle.adfinternal.view.faces.renderkit.rich.RichDialogService these icon url's are hardcoded. I've tried to put an 'afr' and an adf/oracle/skin/images directory under html_root or META-INF with two custom 'task_flow_definition.png/unbounded_task_flow.png': this doesn't work (the original icons from the adf-libs are displayed, but not custom icons).
    Thanks in advance for any help !

    Thanks for your response.
    I tried that and I could not get it to work. Even though I can set pageFlowScope.pageTitle dynamically, the browser window title does not refresh (I tried to refresh via PPR and full post back).
    here is my code:
    public void setPageTitle(ActionEvent actionEvent)
    RequestContext requestContext = RequestContext.getCurrentInstance();
    Map pfs = requestContext.getPageFlowScope();
    pfs.put("pageTitle","TEST 2");
    RequestContext.getCurrentInstance().addPartialTarget(this.document);
    public void setPageTitle(ActionEvent actionEvent)
    RequestContext requestContext = RequestContext.getCurrentInstance();
    Map pfs = requestContext.getPageFlowScope();
    pfs.put("pageTitle","TEST 2");
    FacesContext context = FacesContext.getCurrentInstance();
    String currentView = context.getViewRoot().getViewId();
    ViewHandler vh = context.getApplication().getViewHandler();
    UIViewRoot x = vh.createView(context, currentView);
    x.setViewId(currentView);
    context.setViewRoot(x);
    }

  • Sales order should not get saved without entering the material

    Sales order is getting saved without entering the material. How to make material entry mandatory in sales order.. so that if i try to save the sales order without entering the material the system should create an error.
    Please give a clue, if there is any way other than incompletion log.

    Dear DV,
    T. Code: SHD0
    Create a Screen Variant for Transaction VA01
    and maintain Field: Material as "Mandatory".
    Best Reagrds,
    Amit
    Note: Following is the explaination with Incompletion-Procedure -
    T. Code: OVA2 - Incompletion Log
    Select Group: B - Sales Order Item; and Double Click "Procedures" (left-hand Dialog-Structure)
    Select InCompletion Procedure: 20 - Standard; and double click "Fields" (left-hand Dialog-Structure)
    Here, Maintain entry:
    Table: VBAP
    Field: MATNR
    Screen: PKAU
    Status: 4
    Imp.: Create Z-Incompletion Procedure and make necessary changes, instead of changing a Standard one.
    Alternatively, check with Arijeet's post in following thread:
    How to restrict saving of a sales order without a material.

  • Problem with finishing install of Flash Player on a Mac. When finishing by entering the requested password, the dialog box jiggles as if the p/w is invalid. But it works in the Adobe site.

    I am trying to install Flash player on my Mac. All the steps are working as they should, until the point where I am asked to enter my password. I do this, and the dialog box jiggles as through  the p/w were invalid. However, it works to sign in to the Adobe site. I just changed it to be sure and checked again.

    There is no password required to download or install the Flash Player.  Chances are your Mac is requiring you to enter its password to allow the installation to occur.

  • Trigger&Ga​te Express VI. Is it possible to control Dialog Box parameters on the frontal panel?

    When you use a Trigger&Gate Express VI the Dialog Box Options permits you to configure the VI. I am asking if it is possible to control Dialog Box parameters with controls on the Frontal Panel. I am especially interested on Start Level Threshold.

    open the VI that the trigger and gate is in. Right click on the express VI and select open front panel. Then find the control that you want and edit the connector pane to be able to input the parameter that you want. Attached is a modified version that I came up with for you.
    Hope this helps you.
    Joe
    Joe.
    "NOTHING IS EVER EASY"
    Attachments:
    example_trigger_and_gate.llb ‏92 KB

  • Using date parameters entered by user within Chart

    I would like to allow the end user to populate a start date and end date which will be used to generate a Pie Chart. I have been following posting How to Create a Chart from a user's date range input ? and I'm having problems.
    I have created two Page Items to allow the user to enter a date range. Both Page Items are set to Date Picker ('DD-MON-RR') The start date has a default value set to the first day of the year by using round(SYSDATE, 'YYYY') The end date defaults to SYSDATE.
    The flash chart series is defined as the following:
    select null link, trunc((months_between(sysdate, c.DATE_OF_BIRTH))/12) label, count(*) value1
    from FAMILY_INTAKE f
    , CLIENT c
    where f.client_id = c.client_id
    AND f.intake_date between nvl(:P19_START_DATE, f.intake_date) AND nvl(:P19_END_DATE, f.intake_date)
    group by trunc((months_between(sysdate, c.DATE_OF_BIRTH))/12)
    When I run the page, the pie chart works; however, it does not seem to use the values used in the date parameters. It seems to be using the null value of f.intake_date. No matter what I set the date parameters to, the results are always the same.
    Any help would be appreciated... Thanks!
    Pam

    How does one operate the page? Select one or two date values and press Go, or something? Then the page branches back to itself? If so, are the date items showing the selected values or getting reset?
    Scott

  • How to call GUI/Dialog in Acrobat sdk Plugin

    How to call GUI/Dialog in Acrobat sdk Plugin using VC++ here is my code
    ACCB1 void ACCB2 MyPluginCommand(void *clientData)
      HMODULE hAppInst = GetModuleHandle(NULL);
      DialogBox(hAppInst, MAKEINTRESOURCE(IDD_DIALOG1), NULL, NULL);
      HWND hWnd = ::CreateDialog(hAppInst, MAKEINTRESOURCE(IDD_DIALOG1), NULL, DlgProc);
      ::ShowWindow(hWnd, SW_SHOW);

    You can, with care, use Windows API calls in a plug-in. But you have to understand the process of loading resources. In particular, the calls you use try to load resources that belong to the main executable, which is Acrobat.exe. Plug-ins have their own instance handle, which is conveniently stored in gHINSTANCE. 
    In certain cases, especially modeless dialogs, there may be extra calls to make things work properly.
    You do need to know how to use the Windows API, and your sample lines seem confused, unless you intended to first display a modal dialog then open the same dialog as modeless. That's something for another forum,

  • Saved Searches in Open and Save Dialogs?

    Has anyone else notices that saved searches fail in Open/Save Dialogs?
    I've got a date-based saved search that I've placed in the "Places" section of the sidebar — why? Because I felt like it.
    However, when I access this saved search, I get incorrect results — or results from day or two ago.
    I swear at one point that this functioned correctly.
    Am I missing something?
    d

    thanks for the suggestions i did abit more digging to find it was a corruption in windows. the fix was:-
    run command prompt as administrtor and run sfc /scannow
    after a reboot everything works fine

  • How to stop a report from runing before parameters entered

    I want to create a report that needs parameters entered first before the report is displayed. I always get the no data before parameters are entered and the actual results wanted are displayed. Do I have to split it into two pages?

    Say your query contains 'where deptno = :P1_DEPT'. The user sets this value in a field or LOV and presses the Run Report button. When the page is submitted, P1_DEPT is set in session state to the selected value and the page branches back to itself. Your report region has an 'Item is not null' condition on P1_DEPT. When P1_DEPT has a value the report will run. If the value of P1_DEPT is 10 and there are no matching rows, the report's 'No Data Found' message will show. When you want to link to this report page and have a clean slate, you would clear the page cache in the URL.
    Scott

  • Is it possible to generate a motion control vi from parameters entered into MAX?

    In the process of familiarizing myself with LV, It was brought to my attention that it might be possible to generate a VI from parameters entered into MAX. Is this possible?
    Right now, I am getting familiar with motion control and LV by using MAX's 1D and 2D motion controller interactive environment. I was wondering if there was a way for LV to take the parameters and selections I have made in the various fields and make a VI from it?
    I have tried searching MAX's help, Google searching, etc. but have not found anything.......
    Thanks

    In LabVIEW you can use "Initialize Controller.flx" to load the configuration settings from MAX to the motion control board. There is no way to create vis from the Interactive window, but if you are looking for such a feature, you may want to look into the NI Motion Assistant.
    NI Motion Assistant is an interactive environment for prototyping your motion control application without programming. Later you can export your motion sequence to LabVIEW.
    If you want to test Motion Assistant, you can download an evaluation version here.
    Kind regards,
    Jochen Klier
    National Instruments
    Message Edited by Jochen on 02-12-2010 02:48 PM

  • How to limit the max dialog no that one user can use at the same time?

    Hi,
    I meet one performance problem that one user can open 6 sessions in the GUI and he/she can run 6 reports at the same time witch could occupy 6 dialogs in the sap R/3 instance. It makes poor performance for other users.
    Would you pls tell me how to limit the no. of sessions one user can create at the same time or how to limit the no. of dialogs one user can occupy at the same time?
    Thanks a lot!
    I used this parameters in the default profile as blew:
    rdisp/rfc_check 1
    rdisp/rfc_use_quotas 1
    rdisp/rfc_max_own_used_wp 20 (means: 20%)
    It still didn't work.
    Sean

    Hello,
    We can reserve DIA W.P by giving value to the parameter :- rdisp/rfc_min_wait_dia_wp=1(default)
    that have to necessarily remain free for other users.
    This parameter is used to reserve a number of dialog work processes for Dailog mode.
    For eg. If 10 dialog w.p. are configured for the instance(rdsip/wp_no_dia=10) and the parameter rdisp/rfc_min_wait_dia_wp=3 is set,parallel RFC's can occupy a maximum of 7 DIA W.P.3 DAI W.P. always remain free for dialog mode.
    But now the question is how we assign/restrict this free dialog w.p. to the specific user.
    Reply...
    Regards,
    JUNAID

  • Saving an image as PNG to a specific location, and appending the document's existing name.

    Hello
      I'm building a very complex action that references several scripts. One of the scripts needs to save the existing canvas as a .png file to a specific directory, and rename the .png with the document's existing name and adding "-SCREEN" to the end. So the name sould be "originalname-SCREEN.png"
      I found a script below that almost kinda works. It can find the directory, but it is cropping the image for some unknown reason. It also does not append the name (I have not looked into how to do that at all yet).
      Is anyone able to figure out how to fix this script, or perhaps lend some insight to how I might go about generating a new script?
      I'm not familiar with JS, but I'm learning. Slowly...
    Thank you.
    #target photoshop
    app.bringToFront();
    $.level = 0;
    // Globals
    Settings = {
      storedPaths: {},
      storedSelections: {},
      scriptName: "Save PR JPG LANDING",
      units: "pixels"
    // Main entry point
    main();
    function main() {
      var formatOptions;
      // Create JPEG save options
      formatOptions = formatJPEG(FormatOptions.OPTIMIZEDBASELINE, "10", "3", MatteType.NONE, true);
      // Save copy of document as
      docSaveAs(formatOptions, "Add After", "-LANDING", "No Change", "Path", "~/Desktop/PR/Landing Page (RGB | 105px W x 108px H | 72ppi)/", "");
    // Functions
    function docSaveAs(formatOptions, nameChange, nameText, newCase, destType, destRef, storeName) {
      var hasPath, f, name, nameArray, n, ext;
      if (!documents.length) { logErr(arguments, "noOpenDocs"); return; }
      if (!formatOptions) { logErr(arguments, "noFormatOptions"); return; }
      if (nameChange=="Replace" && !nameText) { logErr(arguments, "badNameValue"); return; }
      f = fileGetFolder(destType, destRef);
      if (!f) { logErr(arguments, "noDestFolder"); return; }
      try { activeDocument.path; hasPath=true; } catch(e){ hasPath=false; }
      name = activeDocument.name;
      if (hasPath) {
      nameArray = name.split(".");
      n = nameArray.length-1;
      ext = nameArray[n];
      switch (nameChange) {
      case "Add Before": nameArray[0] = nameText + nameArray[0]; break;
      case "Add After": nameArray[n-1] = nameArray[n-1] + nameText; break;
      case "Replace": nameArray = [nameText, ext]; break;
      name = nameArray.join(".");
      else {
      ext = {"[BMPSaveOptions]":".bmp", "[DCS1_SaveOptions]":".eps", "[DCS2_SaveOptions":".eps",
      "[EPSSaveOptions]":".eps", "[GIFSaveOptions]":".gif", "[JPEGSaveOptions]":".jpg",
      "[PhotoshopSaveOptions]":".psd", "[PICTFileSaveOptions]":".pct", "[PICTResourceSaveOptions":".pct",
      "[PixarSaveOptions]":".pxr", "[PNGSaveOptions]":".png", "[RawSaveOptions]":".raw",
      "[TargaSaveOptions]":".tga", "[TiffSaveOptions]":".tif"}[formatOptions.constructor.toString()]||"";
      switch (nameChange) {
      case "Add Before": name = nameText + name; break;
      case "Add After": name = name + nameText; break;
      case "Replace": name = nameText; break;
      if (!name) { name = "Untitled"; }
      name += ext;
      switch (newCase) {
      case "Lowercase": name = name.toLowerCase(); break;
      case "Uppercase": name = name.toUpperCase(); break;
      try {
      f = new File(f.fullName+"/"+name);
      activeDocument.saveAs(f, formatOptions, true);
      Settings.storedPaths.lastCreated = f.fullName;
      if (storeName) { Settings.storedPaths[storeName] = f.fullName; }
      catch(e) { log(arguments.callee, e); }
    function fileAppend(path, data, encoding) {
      var file;
      file = new File(path);
      file.open("a");
      if (typeof(encoding) == "string") {file.encoding = encoding;}
      file.write(data);
      file.close();
    function fileGetFolder(srcType, srcRef) {
      var path, f, msg;
      switch (srcType) {
      case "Last Created": path = Settings.storedPaths.lastCreated; break;
      case "Path": path = srcRef; break;
      case "Named Path": path = Settings.storedPaths[srcRef.toLowerCase()]; break;
      if (!path) {
      msg = "Select a folder:";
      if (Settings.lastFolderPath) { f = new Folder(Settings.lastFolderPath).selectDlg(msg); }
      else { f = Folder.selectDialog(msg); }
      if (f&&f.exists) { Settings.lastFolderPath = f.fsName.split("\\").join("/")+"/"; }
      else { f = new Folder(path); }
      if (!f||!f.exists) { logErr(arguments, "noFileSystemPath"); return; }
      return f;
    function fileWrite(path, data, encoding) {
      var file;
      file = new File(path);
      if (file.exists) {file.remove();}
      file.open("e");
      if (typeof(encoding) == "string") {file.encoding = encoding;}
      file.write(data);
      file.close();
    function formatJPEG(format, quality, scans, matte, embed) {
      var result = new JPEGSaveOptions();
      try {
      result.formatOptions = format;
      result.quality = parseInt(quality);
      result.scans = parseInt(scans);
      result.matte = matte;
      result.embedColorProfile = embed;
      catch(e) { log(arguments.callee, e); }
      return result;
    function log(v, err, msg) {
      // Initialization
      if (!Settings.debug) {
      var pathArray, date, str;
      Settings.debug = {
      delim:String.fromCharCode(13, 10),
      path: Folder.userData+ "/Script Builder Files/" +Settings.scriptName+ " - Log.txt",
      text:""
      date = new Date();
      str = "Begin debug log: " + date.toLocaleString() +Settings.debug.delim;
      str += "------------------------------------------------------------" +Settings.debug.delim;
      fileWrite(Settings.debug.path, str);
      // Error logging
      if (typeof v == "function") {
      v = "Error in " +v.name+ "(): ";
      if (err && msg) { v += msg + " " + err.message; }
      else if (err) { v += err.message; }
      else if (msg) { v += msg; }
      else { v = v.substring(0, v.length-2) + "."; }
      // Normal message logging
      else {
      if (typeof v != "string") {
      if (v == undefined) {v = "undefined";}
      else {v = v.toString();}
      if (Settings.debug.path) { fileAppend(Settings.debug.path, v + Settings.debug.delim); }
    function logErr(src, id) {
      var err = {
      badChannelValue: "Invalid channel number entered.",
      badColorValue: "Invalid color value entered.",
      badDocDimsValue: "Invalid document dimensions entered.",
      badExportValues: "Invalid file path or file name value supplied for export.",
      badNameValue: "Invalid name value supplied.",
      badNumberValue: "Invalid number value supplied.",
      badPathName: "Path name supplied is not unique.",
      badRefEdgeOuput: "Output method cannot be used when decontaminating colors.",
      badSubdivValue: "Subdivisions value must be an integer between 1 and 100.",
      badTestValue: "Invalid comparison value supplied.",
      fileError: "Could not read file.",
      fileExists: "A file of the same name already exists in the chosen location.",
      flatImagesOnly: "This function only works on flattened images.",
      layerDataError: "An error occurred while reading the layer settings.",
      logNotEnabled: "Log must be enabled in order to assign file path.",
      multiLayerOnly: "More than one layer must be selected.",
      noClipImageData: "No image data on clipboard.",
      noDocFile: "Document has never been saved.",
      noActionName: "No action name specified.",
      noActionSetName: "No action set name specified.",
      noBkgdLayer: "There is no background layer.",
      noDestFolder: "Destination folder not defined.",
      noFile: "File does not exist at the specified location.",
      noFileSystemPath: "No file or folder path was chosen.",
      noFilterImg: "Image file does not exist, or none was selected.",
      noFilterMask: "Layer has no filter mask.",
      noFolder: "Folder does not exist at the specified location.",
      noFormatOptions: "The \"formatOptions\" parameter is not defined.",
      noHTMLExporter: "The \"htmlExporter\" object does not exist or is not valid.",
      noLayerArtwork: "Layer has no image data.",
      noLayerComps: "Document has no layer comps.",
      noLayerFX: "Layer has no effects.",
      noLayerMask: "Layer has no layer mask.",
      noLogTextFile: "Log file path should point to a text file.",
      noLogFile: "Log file path does not point to a file.",
      noNameValue: "No new name entered.",
      noOpenDocs: "There are no documents open.",
      noQuicktime: "File format requires QuickTime.",
      noSelectedPath: "There is no path selected.",
      noSelection: "There is no selection.",
      noSelectionMod: "There is no selection to modify.",
      noTextExporter: "The \"textExporter\" object does not exist or is not valid.",
      noVectorMask: "Layer has no vector mask.",
      noWorkPath: "Document has no work path.",
      singleLayerOnly: "Only one layer should be selected.",
      wrongLayerKind: "Selected layer is the wrong kind for the requested action."
      }[id];
      if (err) { log(src.callee, null, err); }

    Go to  http://russellbrown.com/scripts.html
    download http://russellbrown.com/images/tips_downloads/Services_Installer_2.3.1.zip
    extract the "Services_Installer_2.3.1.zip"  do not install the extracted files instead find "Services_Installer_2.3.1.zxp" in the extracted files. This is also a zip file extract the files in it. You may need the reneme it to "Services_Installer_2.3.1.zip" first.  In the extracted files find:
    "Image Processor Pro.jsx" and "Image Processor Pro.xml" copy these to Photoshop's Presets\Scripts folder. The "Image Processor Pro: script written by Ross Huitt, [email protected] X use to contribute here but is feed up with Adobe has left. For Adobe does not fix the bugs that have been reported  in Photoshop scripting support. 
    However he will continue to support the "Image Processor Pro" script for some time.  Once installed you will find it in  Photoshop's menu File>Automate>Image Processor Pro... . This script is very powerful and configurable and is a Photoshop Plug-in that Action support so not only can use use your actions in its processing you can record its used in actions to bypass its dialog. When the action's Image Processor Pro step is played the recorded dialog setting will be used and  the script will bypass displaying its dialog.
    The Script has all the options you need to save PNG files with the original document name with custom text added.  You may be able to do what you want by just recording some simple actions and have the Image Processor Pro script include your actions as part of its processing.

  • MDM console GUI on Windows is not mounting the MDM server on Solaris

    Hello MDM experts,
    This is kind of administrative problem. I am basis person, installing SAP MDM 5.5 SP04 for the first time.
    I have configured the MDM server (mds) on solaris 10 system. I have also configured MDM import server(mdis) and Syndication serever (mdss) on the same machine. I have installed the database software and configured the empty repository on the same host machine.
    So, Database and all the 3 MDM services (mds,mdis,mdss) are running on Solaris machine.
    After that, I installed "MDM console fat client GUI" component on my desktop and trying to "mount the server" by specifying the "hostname" of the solaris machine where MDM services are running.
    But I am not able to mount it...it says invalid server and does not mount.
    Any idea what might be the problem ????
    I referred following link :
    http://help.sap.com/saphelp_mdmgds55/helpdata/EN/8e/9f9c427055c66ae10000000a155106/frameset.htm
    which says, you should have administrative right on Solaris machine where MDM server is running....but how do I have that being a Windows user ???
    Please advise.

    Hello Mark,
    1. When I right click on the "SAP MDM servers" node in "Console Hierarchy" pane on the left hand side of the Console GUI, and select "Mount MDM Server..." option in context menu, I get a dialog box for entering my MDM server name.
    I typed in the fully qualified host name of my solaris server where "mds-r" is running.
    When I click "OK" button, it adds an entry in "Console Hierarchy" on left hand side, but the entry comes with "Yellow exclamation Mark" sign. Also it says Status "Invalid" when I see the "MDM servers" section on right hand side top.
    When I right click on my newly created entry of MDM server, all the options on context menu like "Mount Repository, Create Repository, Connect to MDM server" look greyed out. Only the option of "Unmount MDM server" seems to be enabled
    2. I tried to do the same thing on 2 different Windows machines and got the same output.
    Regards,
    Bharat

  • HT2589 when I try and log in my i-tunes account or my app store account on my i-phone it says "this apple I.D has not yet been used on the i-tunes store" it gives me 2 optins "cancel" or "review" I press review, enter my bank details but they decline..why

    Hi can anybody help or advise me? I've recently bought the i-phone 4s, I've set up my apple I.D and password but everytime I try and log in it says "this apple I.D has not yet been used on the i-tunes store" I click "review" follow the instructions and agree to the terms and condition's, enter my bank details but it declines every time? I've tried both my accounts and its declined both, this stops me from logging in so I can't download anything for free or buy anything, my sister had the option of skipping the bank details part when she created her apple I.D and just enters her's when buying something, why do I not have that option?? And why is it declining my bank details...please HELP!!!!!

    The details I'm entering are correct, I choose visa as my card type, enter my card number, enter my expiry date and my last 3 digts on the reverse of the card, enter my address and zip code plus my home telephone number, click continue and it says "the payment method you have selected has been declined, please enter another payment method". I've lost count how many times I've tried, I've typed my details in slowly making sure I put them in properlly and it still declines it, I've even tried makeing a new apple I.D and when I get to the bank details part it declines it again so I am forced to press cancel and all details are not saved so its just like I'm hitting a brick wall, its ******* me off!!! I can't even download any of the free app's because to do so you must log in but when I do it says "this apple I.D has not yet been used in the i-tunes store" review my details and can't get past the bank details part. So doesn't log me in, I'm honestly out of ideas

Maybe you are looking for