Passing arguments to script

Hi,
I created a dialog which load folder files and when i click the button i run another script by StartScript(...) command
How could i pass my arguments to the script (the files paths)?
Thanks
Solved!
Go to Solution.

Hi Winfried,
That not what i meant.
For example:
 **My dialog contains one button and event click
the dialog code: 
Dim obj
Sub Button1_EventClick(ByRef This)
     obj= "Hello World"
     Call ScriptStart("C:\Users\Oz\Desktop\test.vbs")
End Sub
**the script code(test.vbs):
Call MsgBox(obj)
I want to pass the- obj parameter to the test.vbs script .
How i do it?
Thanks

Similar Messages

  • How to pass arguments to script from plugin

    Hello there....
    I want to run a script from my plugin. To do this, I want to pass some arguments to the script. How can I do this? I also want to know how those arguments can be read in script?
    Thanks in advance..

    Here is a simple example of how to run some script code from a plug-in.
    InterfacePtr scriptManager(Utils()->QueryScriptManager(kJavaScriptMgrBoss));              
    if (!scriptManager)
         return;
    InterfacePtr scriptEngine(scriptManager->QueryDefaultEngine());
    if (!scriptEngine)
         return;
    InterfacePtr scriptRunner(scriptEngine, UseDefaultIID());
    if (!scriptRunner)
         return;
    RunScriptParams params(scriptRunner);
    scriptRunner->RunScript("alert('hello from planet script!');", params);
    Replace "alert(...);" with your own script.

  • Passing arguments from Air to Photoshop jsx script

    I would like to invoke JavaScript file in Photoshop from my Adobe Air application. I managed to call my script with the following code:
    // Create native startup info
    nativeProcessStartupInfo = new NativeProcessStartupInfo();
    nativeProcessStartupInfo.executable = filePhotoshop; // File referencing Photoshop exe
    // Create Vector array to pass arguments
    procarg = new Vector.<String>();
    procarg.push("start");
    procarg.push(jsFileToCall);// String with path to my jsx file
    procarg.push(scriptData); // String with argument to pass to jsx file
    nativeProcessStartupInfo.arguments = procarg;
    // Create native process object for calling  executable file
    process = new NativeProcess();
    // SET ERROR HANDLERS
    process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA ,onError,false,0,true);
    process.addEventListener(IOErrorEvent.STANDARD_ERROR_IO_ERROR ,onError,false,0,true);
    process.addEventListener(IOErrorEvent.STANDARD_INPUT_IO_ERROR ,onError,false,0,true);
    process.addEventListener(IOErrorEvent.STANDARD_OUTPUT_IO_ERROR ,onError,false,0,true);
    process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA ,onError,false,0,true);
    // CALL NATIVE PROCESS
    process.start(nativeProcessStartupInfo);
    The Photoshop app is started, my JavaScript is invoked, but the argument is not passed into jsx.
    Is there any method how to pass arguments to script in Photoshop? (I know that I can use the file to pass the parameters, but I do not like that solution.)
    Thanks in advance for any hint.
    Zdenek M

    The only documented way I know of is programming the script as a Photoshop Plug-in that has a dialog. Then record using the script in an action.  The script will record the arguments used in its dialog into the Photoshop Actions step.  Then when the action is used played the action recorded arguments are retrived and the script bypasses displaying its dialog. 
    However In CS3 I looked at Adobe Photoshop  Image Processor JavaScript it internaly used the Fit Image Plug-in Script and passed the width and hight to it. So it is posible to pass arguments from one JSX to an JSX Plug-in Script.
    From CS5 "Image Processor.jsx"
    // use the fit image automation plug-in to do this work for me
    function FitImage( inWidth, inHeight ) {
              if ( inWidth == undefined || inHeight == undefined ) {
                        alert( strWidthAndHeight );
                        return;
              var desc = new ActionDescriptor();
              var unitPixels = charIDToTypeID( '#Pxl' );
              desc.putUnitDouble( charIDToTypeID( 'Wdth' ), unitPixels, inWidth );
              desc.putUnitDouble( charIDToTypeID( 'Hght' ), unitPixels, inHeight );
              var runtimeEventID = stringIDToTypeID( "3caa3434-cb67-11d1-bc43-0060b0a13dc4" );
              executeAction( runtimeEventID, desc, DialogModes.NO );
    If You can write a file from Adobe Air you could also write the jsx file to pass the args you want to pass a to plug-in script via the ActionManager.

  • How to run a java class from a shell script with passing arguments

    hi,
    I have a jar with all the required classes. I was using ant to run the classes i needed.
    But now i want to use a shell script to run the class, also the class accepts some arguments so when script is run it should accept arguments.
    So can any one tell me how to set class paths, jar location and call the required class from shell script or batch file with passing arguments to it.
    Thanks in advance.

    Let's say that the order of arguments is as below
    1. Jar file name
    2. Classpath
    Your shell script would look like this
    java -cp $CLASSPATH:$2 -jar $1 I am assuming that your jar file has the required main-class entry in its manifest. Note that $1...$9 represent the arguments to this shell script.
    The same goes for a batch file
    java -cp %CLASSPATH%;%2 -jar %1

  • Passing arguments to VBScript Program Object - Without WScript.Arguments?

    I am trying to create a program object with a VBScript that will change the name of a PDF created by a scheduled report. I need to be able to tack on the string "OH_2010_Qtr_1" (or whatever state - OH is used as an example) before the file extension - the VBScript creates that string based on the date the report is run. I want to be able to pass parameters to this script but when I try to do so I get the error "Variable is undefined 'WScript'" when trying to run the program object. I tried creating a batch file that would pass in the parameters and I get a generic error.
    How can I pass arguments to my VBScript? The arguments are necessary because this is for multiple instances of the same report, run for different states.

    For VBScript Program Objects, some injected objects:
    For Each arg in Script.Args
        ' Do something interesting with String arg here
        Script.Writeln(arg) ' Output to stdout
    Next
    and
    ' Get InfoStore
    Set infoStore = Session.Service("", "InfoStore")
    Sincerely,
    Ted Ueda

  • Can we pass arguments to JNLP?

    I am new to JNLP and want to know can we pass arguments to JNLP?
    If yes where I can find the info abt it?

    Dolda2000 wrote:
    Will that really work well, though? As far as I can tell, the JNLP client will try to refetch the JNLP file when launching the Java program (reasonable enough). If I were to include
    information from that is only available via the user's web brower's session, I would not be able to recreate that data when the JNLP client tried to refetch the JNLP file.If you're worried about that why not use a user specific cookie?
    Your CGI script can check for/generate/pass one along with the XML stub.
    As far as I know the JNLP is stateless. It loads once,
    the information is cached, your application gets run....
    I already do this with <applet> tags (not currently JNLP) to identify returning users
    and pass dynamic parameters to applets. I will be updating to JNLP after a rewrite
    of some code.
    P

  • How to pass arguments to .sql file.......

    Hello,
    I want to pass arguments to .sql file which is being called from within a shell (.sh).
    suppose this is the line in shell -
    ${ORACLE_HOME}/bin/sqlplus -s abcuser/abcuser@abc < ${ABCDB_DIR}/A.sql $val >>${LOG}
    - now I want to pass '123456' to A.sql
    Please suggest how to do that.
    Thanks and regards,

    You can pass parameters to a shell script executing sql commands just like you would any other shell script.
    I have a script called test_os_variables.sh:
    sqlplus -s "/ as sysdba" << EOF
    select '$1' from dual;
    EOF
    Now I execute my script passing SHAWN as a parameter.
    ./test_os_variables.sh SHAWN
    SQL*Plus: Release 10.2.0.2.0 - Production on Tue Jan 9 08:09:46 2007
    Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    SQL>
    'SHAW
    SHAWN

  • Pass arguments to javascript from plug in...

    Hi,
    I m using InDesign CS3 on MAC OS...
    I have a plugin calling a javascript. I need to pass a string value from the plug in to the script...
    I found that there is a parameter in the method RunFile in IScriptRunner.h for this purpose... But i don kno how to use this...
    virtual ErrorCode    RunFile(const IDFile& idFile, IScriptEventData* data,  bool16 showErrorAlert = kTrue, bool16 invokeDebugger = kFalse) = 0;
    where,
    @param data is used to pass arguments and return the result IN/OUT
    What does this  IScriptEventData* data carry???
    How to pass a string value as argument to javascript from plugin code and how to retrieve and use it there...
    Is there any sample code for this?
    Someone pls guide me...
    Thank you.

    Are there other command line options with extendscript, like compile to jsxbin etc.. Where is this documented?
    UDevp wrote:
    I used the below command to run script from command prompt, I'm able to run the script but not able to pass arguments to the script.
       "C:\Program Files\Adobe\Adobe Utilities\ExtendScript Toolkit CS4\ExtendScript Toolkit.exe" -run "C:\Program Files\Adobe\Adobe InDesign CS4\Scripts\test.jsx"
    Any suggestion would be helpful..
    It may be possible to edit prefs file with command line and to check file in script.

  • How to pass arguments from command line to the .jsx

    Hi, I have a .jsx file that does some scripting with photoshop. I would like to be able to call that script from the command line and pass some arguments. I have been going off of the forum at http://support.muse.adobe.com/thread/290023, mainly the last post. Here it is ...
    command line example : runjavascript.vbs c:\mydirectory\test.jsx arg0 arg1 arg2 arg3
    =====start runjavascript.vbs ===============
    Set vbsArguments = WScript.Arguments
    If vbsArguments.Length = 0 Then
    WScript.Echo "Argument(0) is `your script to execute"
    WScript.Echo "Arguments(0+n) are passed to your script as argument(0) to argument(n-1)"
    Else
    ReDim jsxArguments(vbsArguments.length-2)
    for i = 1 to vbsArguments.length - 1
    jsxArguments(i-1) = vbsArguments(i)
    Next
    Set photoshop = CreateObject( "Photoshop.Application" )
    photoshop.BringToFront
    'DoJavaScript has 3 parameters
    ' syntax DoJavaScript(arg[0], arg[1], arg[2]]
    'arg[0] == javascript file to execute, full pathname
    'arg[1] == an array of arguments to past to the javascript
    'arg[2] == AiJavaScriptExecutionMode: aiNeverShowDebugger = 1,, aiDebuggerOnError = 2 aiBeforeRunning = 3
    ' only use 1
    Call photoshop.DoJavaScriptFile( vbsArguments(0), jsxArguments, 1)
    End IF
    =====end runjavascript.vbs ===============
    =======start test.jsx ====================
    #target photoshop
    for( n = 0 ; n < arguments.length; n++ ){
    alert("argument("+ n+")= " + arguments[n]);
    =======end test.jsx ====================
    In summary, it calls a VBScript from the command line and passing args to the VBScript where it will run the .jsx and pass along the args to the .jsx. This is all seems to work, except that the args never make it from the command line into the .jsx and I'm having trouble narrowing down why.
    I know the args are getting into the VBScript from the command line because I can successfully print them out using WScript.Echo. The VBScript then takes the args and makes a new array called jsxArguments which just holds the arguments that are to be passed on to the .jsx as the second argument in the DoJavaScriptFile().
    I cannot tell if the jsxArguments is correct or not. I added an isobject(jsxArguments) check in the VBScript which fails, but if I do a WScript.Echo jsxArguments(0) it will correctly print out the contents of the array at that position.
    I know that the args are not getting into the .jsx because I added a line alert(arguments.length) which prints out 0.
    Any help would be greatly appreciated. Thanks.

    I don't use VBS so this is just a guess based on what I have read in this forum. I think when you are passing an 'array' to javascript it needs to be a variant data type. My guess your arguments are not making it to the javascript because it it the wrong data type.

  • Passing arguments to the jsx file from command line

    Thanks for taking my question.
    I am using the following to be able to run my script from the command line.In case you were wondering on why i would be doing this- i would need to invoke the javascript from a server side code(like java,php etc. in my case it is java)
    "c:\Program Files\Adobe\Adobe Utilities\ExtendScript Toolkit\ExtendScript Toolkit.exe" "c:\path to script\myscript.jsx"
    Anyways, i have been successful in running the myscript.jsx from the command line but i am not able to figure out how i could pass arguments to "myscript.jsx" from the command line, and be able to refer to these arguments within the script.
    I have tried the following
    "c:\Program Files\Adobe\Adobe Utilities\ExtendScript Toolkit\ExtendScript Toolkit.exe" "c:\path to script\myscript.jsx" "argument1" "argument2"
    and tried to refer these arguments within the script using arguments[0] and arguments[1] . But looks like this does not work.
    Any thoughts?????

    To run JavaScript from the prompt using ExtendScript Toolkit 1.0.3 or 2.0.2 you need to do the following:
    Add the line #target indesign to the top of your script otherwise ESTK will open without executing the script. Example:
    #target indesign
    //MakeDocumentWithParameters.jsx
    //An InDesign CS2 JavaScript
    //Shows how to use the parameters of the document.open method.
    //The first parameter (showingWindow) controls the visibility of the
    //document. Hidden documents are not minimized, and will not appear until
    //you add a new window to the document. The second parameter (documentPreset)
    //specifies the document preset to use. The following line assumes that
    //you have a document preset named "Flyer" on your system.
    var myDocument = app.documents.add(true, app.documentPresets.item("Flyer"));
    //SaveDocumentAs.jsx
    //An InDesign CS2 JavaScript
    //If the active document has not been saved (ever), save it.
    if(app.activeDocument.saved == false){
    //If you do not provide a file name, InDesign will display the Save dialog box.
    app.activeDocument.save(new File("/c/temp/myTestDocument.indd"));
    Ensure Indesign is open. Execute the following command:
    "C:\Program Files\Adobe\Adobe Utilities\ExtendScript Toolkit\ExtendScript Toolkit.exe" -run "[path to script]\script.jsx"
    For example:
    "C:\Program Files\Adobe\Adobe Utilities\ExtendScript Toolkit\ExtendScript Toolkit.exe" -run "C:\Program Files\Adobe\Adobe InDesign CS2\Presets\Scripts\test.jsx"
    This command can be easily called from Java or any other third party application of your choice.
    It took me a while to find this information, so I thought I'd share it with everyone.
    Good luck!

  • InDeSign Server - Flex - SOAP - Business cards tutorial - MISSING Arguments for Script

    Hello, <br /><br />I test even Adobe Flex with InDesign server. I am occupied with<br />the Business cards tutorial. The Problem is, which no arguments are<br />transferred to servers at InDesign. The Script is executed and the new document and the pdf are produced.<br />But without contents!? Is the error situated in it WSDL file? Here my<br />data:<br />InDesign Server Port = 8070<br />Mac Localhost = http://localhost:8888<br />The IDSP Root = http://localhost:8888/IDSP.wsdl<br /><br />IDSP.wsdl Content<br /><br /><?xml version="1.0" encoding="UTF-8"?><br /><definitions name="Service"<br /> targetNamespace="http://localhost:8888/IDSP.wsdl"<br /> xmlns:tns="http://localhost:8888/IDSP.wsdl"<br /> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"<br /> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"<br /> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"<br /> xmlns:xsd="http://www.w3.org/2001/XMLSchema"<br /> xmlns:IDSP="http://ns.adobe.com/InDesign/soap/"<br /> xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/"<br /> xmlns:MIME="http://schemas.xmlsoap.org/wsdl/mime/"<br /> xmlns:DIME="http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/"<br /> xmlns:WSDL="http://schemas.xmlsoap.org/wsdl/"<br /> xmlns="http://schemas.xmlsoap.org/wsdl/"><br /> .........<br />......<br /><service name="Service"><br /> <documentation>gSOAP 2.7.8c generated service definition</documentation><br /> <port name="Service" binding="tns:Service"><br />  <SOAP:address location="http://localhost:8070"/><br /> </port><br /></service><br /><br /></definitions><br />  <br />Flex MXML Content:<br /><br /><?xml version="1.0" encoding="utf-8"?><br /><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"><br />     <mx:WebService id="wsIDSP"<br />          wsdl="http://localhost:8888/IDSP.wsdl"<br />          endpointURI="http://localhost:8070"<br />          useProxy="false"><br />          <mx:operation name="RunScript" resultFormat="e4x"><br />               <mx:request><br />                   <runScriptParameters><br />                      <scriptLanguage>javascript</scriptLanguage><br />                      <!--Optional:--><br />                      <scriptFile>/Volumes/Macintosh HD/Applications/Adobe InDesign CS3 Server/Scripts/myScripts/businessCards.jsx</scriptFile><br />                      <scriptArgs><br />                     <scriptArg><br />                         <name>name</name><br />                         <value>{nameInput}</value><br />                    </scriptArg><br />                    <scriptArg><br />                         <name>company</name><br />                         <value>{companyInput}</value><br />                    </scriptArg><br />                    <scriptArg><br />                         <name>title</name><br />                         <value>{titleInput}</value><br />                    </scriptArg><br />                      </scriptArgs><br />                   </runScriptParameters><br />               </mx:request><br />               <br />          </mx:operation><br />     </mx:WebService><br />     <mx:Script><br />          <br />              [Bindable]<br />              public var nameInput:String="";<br />              [Bindable]<br />              public var companyInput:String="";<br />              [Bindable]<br />              public var titleInput:String="";<br />              <br />              private function makeCards(name:String, title:String, company:String):void<br />              {<br />                   nameInput = name;<br />                   companyInput = company;<br />                   titleInput = title;<br />                   <br />                   wsIDSP.RunScript.send();<br />              }<br />          <br />     </mx:Script><br />     <mx:Form width="410" height="277" x="46" y="34" horizontalScrollPolicy="off"><br />          <mx:FormHeading label="Business Card Information"/><br />          <mx:FormItem label="Name"><br />               <mx:TextInput id="textName" width="100%" /><br />          </mx:FormItem><br />          <mx:FormItem label="Title"><br />               <mx:TextInput id="textTitle" width="100%" /><br />          </mx:FormItem><br />          <mx:FormItem label="Company"><br />               <mx:TextInput id="textCompany" width="100%" /><br />          </mx:FormItem><br />          <mx:FormItem x="75"><br />               <mx:Button x="150" label="Print Cards" <br />                         click="makeCards(textName.text, textTitle.text, textCompany.text)"/><br />          </mx:FormItem><br />          <mx:Text x="47.5" y="194" text="{wsIDSP.RunScript.lastResult.errorNumber}" width="383" height="20"/><br />          <mx:Text x="47.5" y="224" text="{wsIDSP.RunScript.lastResult.errorString}" width="381" height="20"/><br />          <mx:Text x="47.5" y="254" text="{wsIDSP.RunScript.lastResult.scriptResult.data}" width="383" height="24"/><br />     </mx:Form><br /><br />     <br /></mx:Application>

    I am curious where you got the tutorial, and which version of InDesign Server you are using. Also, can you show the contents of the businesscards.jsx script?
    In the meantime, it seems like the connection from Flex to InDesign is working since your script is running and producing output. The next step is to check the arguments being passed to the script, and how the script is accessing and using the arguments.
    You can add this to your jsx script to test the values of the arguments:
    var myName = app.scriptArgs.IsDefined("name") ? app.scriptArgs.getValue("name") : "name undefined";
    app.consoleout("scriptArg name = " + myName);
    var myCompany = app.scriptArgs.IsDefined("company") ? app.scriptArgs.getValue("company") : "company undefined";
    app.consoleout("scriptArg company = " + myCompany);
    var myTitle = app.scriptArgs.IsDefined("title") ? app.scriptArgs.getValue("title") : "title undefined";
    app.consoleout("scriptArg title = " + myTitle);
    To see the values, watch the InDesign Server console window. If you are not getting the values you expect, check your mxml code to make sure the variable names are valid, etc. If you are getting the values you expect, examine your businesscards.jsx to make sure you are using the values as required to populate the InDesign document.
    Susan

  • How to pass argument to the Java Plugin JVM w/o using the Control Panel?

    I want to deploy an applet to be loaded by the Java Plug In
    and fix some settings of its Java Virtual Machine.
    The JPI Control Panel offers two ways to pass arguments to the JVM,
    none satisfactory.
    1. while interactive via the Control Panel Window.
    This cannot be a solution for a deployed applet.
    or
    2. by editing the system generated file that stores
    the settings of the Plugin Control Panel, using a property
    named javaplugin.jre.params.
    The problem with this method is that if forces to access
    and edit this property file which is stored at various locations
    depending the client platform. Then, it may collide with other
    settings for other applets.
    Is there a way to pass the arguments to the JVM
    from within the html file?
    Has anyone found a solution to this question?
    JPS

    I am interested in this issue as well.
    Did anyone find a reliable way to specify the runtime parameters that should be used by the Java Plug-in in order to execute a given Java applet?
    I believe a good place to specify these runtime parameters would be the applet's JAR manifest: only digitally signed applets should be able to set the desired runtime parameters...
    Any comments / suggestion would be greatly appreciated.
    Regards,
    Marco.

  • How to pass argument in manifest file

    Hi,
    I want to pass argument to main class in jar. Is there any option in manifest file.

    Hmm..
    Seems that my sentence above isn't so correct.
    It possible to add custom attribute: value pairs into manifest file and
    read it later from Java class.
    Here is code sample:
    public class ManifestTest {
        public static void main(String[] args) {
            try {
                java.util.jar.JarFile jar = new java.util.jar.JarFile(System.getProperty("java.class.path"));
                for (java.util.Iterator it = jar.getManifest().getMainAttributes().keySet().iterator();it.hasNext();) {
                    Object curKey = it.next();
                    System.out.println("key: " + curKey + ", value: " + jar.getManifest().getMainAttributes().get(curKey));
            } catch (Throwable t) {
                System.out.println("exception occured: " + t);
    }

  • How can I pass arguments to a TestStand sequence with LabWindows 6 ?

    Hi
    I have created sequences in a TestStand file.
    I want to program a sequence with Labwindows 6 which would call all these existing sequences (containing parameters).
    I don't have any problems to create the steps "SequenceCall" but i don't know how to pass arguments to the sequences with the TS API.
    I have used the look-up strings "TS.SData.SFPath", "TS.SData.SeqName", "TS.SData.ThreadOpt" to program the sequence file / sequence and the multithread option. But now how to program the arguments passing ? I think there is something with the lookup string "ST.SData.ActualArgs"...
    Thank u very much for any help

    I'm not sure if you want to pass values from TestStand to LabWindows or if you want to pass values in TestStand from a sequence call step to a called sequence.
    To get TestStand variables from LabWIndows, use the following function:
    tsErrChk (TS_PropertyGetValNumber(testData->seqContextCVI, &errorInfo, "Locals.StartPoint", 0, &dStartPt));
    iStartPt = (int)dStartPt;
    The TS_PropertyGetValNumber gets the TestStand variable Locals.StartPoint and puts it into the LabWindows variable called dStartPoint. Numbers to and from Test Stand are always a double type. The next line converts it to an integer.
    To put a LabWindows value to TestStand, use TS_PropertyPutValNumber.
    To pass values from a sequence call step to a called sequence, create variables in the Parameters t
    ab on your main sequence. Create same variables on the Parameters tab of the called sequence. In main, specify module to be called in calling step. There is a paramters section on the Edit Sequence Call dialog box which appears. Check the Use Prototype of the Selected Sequence box. You can then list all the parameter variables in the parameters section.
    Hope this is what you want.
    - tbob
    Inventor of the WORM Global

  • Passing Arguments in a Multiple JFrame project

    I am trying to pass Arguments from MainApp.java to SubApp.java.
    Is there someone that have an example or fix the sample program included?
    tks a lot
    sage49
    I based my program on the following 2 programs that I got from this forum!!
    The following is the MainApp.java
    import javax.swing.*;
    import java.awt.event.*;
    class MainApp extends JFrame {
        MainApp() {
            super( "Main Application" );
            JButton button = new JButton( "Show Sub Application" );
            button.addActionListener( new ActionListener() {
                public void actionPerformed( ActionEvent e ) {
    //  need to pass a string to SubApp in the following line
                    JFrame app = new SubApp();
                    dispose(); 
            getContentPane().add( button );
            setDefaultCloseOperation( DISPOSE_ON_CLOSE );
            pack();
            show();
        public static void main( String[] args ) {
            MainApp app = new MainApp();
    }The following is the SubApp.java
    import javax.swing.*;
    import java.awt.event.*;
    class SubApp extends JFrame {
    // need to accept a String as Arguments
        SubApp() {
            super( "Another Application" );
            JButton button = new JButton( "Show Main Application" );
            button.addActionListener( new ActionListener() {
                public void actionPerformed( ActionEvent e ) {
                    JFrame app = new MainApp();
                    dispose();
            getContentPane().add( button );
            setDefaultCloseOperation( DISPOSE_ON_CLOSE );
            pack();
            show();
        public static void main( String[] args ) {
            SubApp app = new SubApp();
    }

    Hi,
    I have done what you suggested, Now I get an error on the subApp on the main.
    see What I tried in the code.
    MainApp.java
    import javax.swing.*;
    import java.awt.event.*;
    class MainApp extends JFrame {
        MainApp() {
            super( "Main Application" );
            final String a ="this is the string";
            JButton button = new JButton( "Show Sub Application" );
            button.addActionListener( new ActionListener() {
                public void actionPerformed( ActionEvent e ) {
                    JFrame app = new SubApp(a);
                    dispose(); 
            getContentPane().add( button );
            setDefaultCloseOperation( DISPOSE_ON_CLOSE );
            pack();
            show();
        public static void main( String[] args ) {
            MainApp app = new MainApp();
    }The SubApp.java
    import javax.swing.*;
    import java.awt.event.*;
    class SubApp extends JFrame {
            private String mystring;
            SubApp(String mystring) {   
            super( "Another Application" );
            this.mystring = mystring;
            JButton button = new JButton( "Show Main Application" );
            button.addActionListener( new ActionListener() {
                public void actionPerformed( ActionEvent e ) {
                    JFrame app = new MainApp();
                    dispose(); 
            getContentPane().add( button );
            setDefaultCloseOperation( DISPOSE_ON_CLOSE );
            pack();
            show();
        public static void main( String[] args ) {
           // tried    =    SubApp app = new SubApp(mystring);
           // tried    =    SubApp app = new SubApp(a);
           // tried    =    SubApp app = new SubApp(String a);  
           // tried    =    SubApp app = new SubApp(String);                 
            SubApp app = new SubApp();                // this is the line I get the error
    }I get the following error:
    Cannot find Symbol
    symbol  : constructor SubApp()
    location: class SubApp
            SubApp app = new SubApp();Tks a lot
    sage49

Maybe you are looking for

  • Issue in Alert Generation

    Hello Friends, Requirement: In my scenario we are making outgoing call activity to customers for customer satisfaction survey. So while doing call activity with customers if the customer asks to call at for example 4pm ,then say at 3:45pm call centre

  • How do I mark up parts of a PDF page?

    I write a weekly column for the local newspaper. After publication, I download a PDF of the printed page or pages. Frequently readers or clients ask me for copies of a particular column. My column does not occupy the entire page, though. I am looking

  • Creating data at multilevel collection

    Dear Experts, Objective: Want to store Table of Orderstatus_Type in a collection. Herewith i have explain the my objects Create or Replace Type Orderstatus_Type as Objects      Status Varchar2(50),      Statusdate Timestamp Create or Replace Type Mor

  • Cusomize the Leave Approve view when approve from UWL

    Hi, The user is approving the leave from the UWL. when they click on the work item then in the Pop Up window the java application starts. Now we want to hide the Duration field from the last confirmation field. I tried to hide these fields  from the

  • Resizable, draggable, snap-to-each-other panels

    Hello! I seem to remember a sample file available for Flex that consisted of a button to add panels to the stage. Once a panel was on the stage, you could resize it, drag it around, or snap it to the panels already on the stage. I thought I linked to