Passing arguments in a .py script

I have a .py script which starts with a "connect()" statement. Whenever I run it, I need to give username, password & server URL manually.
But I want to make this script non-interactive. At the same time, I don't want to make any change to the original script. Is there any method
to pass those three arguments at the first place or read from any property file?
Thanks in Advance.

Instead of repeating all options, check the WLST Command Reference Guide : http://docs.oracle.com/cd/E23943_01/web.1111/e13813/reference.htm#i1005916
--olaf                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • Passing arguments to a remote script

    Hey, here is my problem. I want to call a script used in a (some other party) web site from my Java program. I do not know anything about the script - language, source code, etc. only know its location. For example I want to call a scrpit on Yahoo site that will show me the TV program of a given channel for a given zip code. First of all - is this ok, I mean legal?
    Next - assume the yahoo script takes its input from a form - i.e. 2 text fields called "channel" and "zipCode" (should I determine the names of the variables by "view"-ing the HTML source of the form, or should I use the names of the variables that are present in the URL of the resulting page?). When I call the script from my Java program, I need to send it these 2 parameters (in the Java program they are called "ch" and "zip"). I have tested my program - if I only provide the value for the "channel" it works fine. So my question is how to send multiple arguments?
    At the moment I have sometng like this:
    public static void main(String[] args)
    String ch = URLEncoder.encode(args[0],"UTF-8");
    String zip = URLEncoder.encode(args[1],"UTF-8");
    //I am reading the channel name and zip as command line args
    URL url = new URL("www.........");
    URLConnection conn = url.openConnection();
    conn.doSetOutput(true);
    PrintWriter out = new PrintWriter(conn.getOutputStream);
    out.println("channel = " + ch); //this works fine
    //here I got the reply
    //here is my question
    //when I try something like this
    out.println("channel = " + ch + "&zipCode = "+zip);
    //it does not work
    I guess there is something wrong in separating the 2 arguments - should it be ; instead of &, or what? Should the separator be encoded too? (And in general, what is the role of the encoding - just to convert the not alphanumeric characheters and the blank space, or there is sometning deeper?).
    Also does the order in which you provide the arguments matter?
    Should I send values for all arguments when the script is called?
    Is a "hidden" type (in the form) different from a textfield (for example) in terms of sending values for it?
    For example, the zipCode (the variable in the script) may be implemented as a String or as an integer. Is there any other way to determine the type except the trial-end-error mechanism?
    I really will appreciate both the short and the long answers (some links will be nice) to my questions :)
    Thanks,
    Mike

    first, if you're going to write to the URLConnection's output stream, you need to set the request method to be POST. The correct syntax for name=value pairs in HTML is:
    name1=value1&name2=value2&...
    so no, you don't want to use a ; instead (a ; can be used, but it's generally a special case to append extra data, I think). You should only encode the variables, as far as I know. (you can also send multiple values with the same name:
    name1=value1A&name1=value1B&...
    but the server has to know to expect it).
    But really, all that is an HTTP issue.
    Also does the order in which you provide the arguments matter?no, it doesn't matter.
    Should I send values for all arguments when the script is called?You need to send everything you want to send at the same time. Sending another set of data would be another separate request, and the first values wouldn't be stored on the server (in most cases). It would take special considerations for a server to handle multiple request as one, and if you don't know for sure that this is the case, then you shouldn't assume it would work.
    Is a "hidden" type (in the form) different from a textfield
    (for example) in terms of sending values for it?yes and no. The user can't set hidden values, so in that regard yes. Scripts can set them in a browser, but from the server's point of view, it doesn't really know that a value came from a text field, hidden field, select list or other field. All it gets is name=value pairs.
    For example, the zipCode (the variable in the script) may be
    implemented as a String or as an integer. Is there any other
    way to determine the type except the trial-end-error mechanism?no, it's just name=value pairs. The browser has no such field as a number field vs. string fields, so the server can't know. Typically you validate the field data with Javascript or on the server and complain to the user if you want numbers only in fields.

  • 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 argument to shell script from java program

    str="/bin/sh -c /root/PWAppSh/StartSH.sh";
    p = rt.getRuntime().exec(str);
    above is the code snippet of java program for calling the shellscript
    when i pass a argument to the shell script from my java program it wont get accepted in shell script as an input
    when i do following changes in above code it wont work :---
    str="/bin/sh -c /root/PWAppSh/StartSH.sh para1 para2 para3 ";
    p = rt.getRuntime().exec(str);
    para1,para2 and para3 wont get as argument for the shell script
    how this can be done
    thanks
    reply "ARGENT"

    Argent.
    Read this:
    Navigate yourself around pitfalls related to the Runtime.exec() method

  • 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.

  • Passing arguments to main method from a shell script

    The main method of my class accept more than 10 arguments so my shell script execute this class like this :
    java -cp xxxx mypackage.MyClass $*
    The problem is that some of those arguments allows spaces. When i execute this script like this :
    myscript.sh firstparam secondparam ...... tenthparm "eleventh param"
    or
    myscript.sh firstparam secondparam ...... tenthparm 'eleventh param'
    the java class consider that my eleventh param is 'eleven' and not 'eleventh param'
    The same class works well with an equivalent dos script.

    I had this problem once also, and I found there are several ways to fix it. One way is to replace all of the spaces in the arguments with _ characters, or you can concantate all of the arguments into one String at runtime (with spaces in between) and use code to separate the arguments out. With the quotation marks, this code would be simple. If the spaces in one argument are used to divide different parts of the argument, just make them spearate arguments.

  • Passing values to a JSP script from an Applet

    I am having problems to passing arguments to a JSP scipt.
    In the applet the following code is executed:
    URL scoreTrackerURL = new URL(applet.getCodeBase(), "newscore.jsp?name=foo&score=10000");
    URLConnection scoreTrackerConn = scoreTrackerURL.openConnection();
    scoreTrackerConn.connect();
    The JSP-script in the newscore.jsp looks like this:
    <%@ page language="java" %>
    <%@ page import="java.util.*" %>
    <%@ page import="java.net.*" %>
    <%@ page import="java.io.*" %>
    <%
    String name = request.getParameter("name");
    String score = request.getParameter("score");
    BufferedWriter writer = new BufferedWriter(new FileWriter("highscore.txt"));
    writer.write(name + ", " + score);
    writer.close();
    %>
    What am I doing wrong since this doesn�t work!!! I have very little experience of JSP and accessing these scipts from Applets...
    Dukecredits are waiting for You! :) Thank you!

    I tried your code and it works fine.
    public class AppletParam extends Applet {
        public void paint(Graphics g) {
         g.setColor(Color.red);
         g.fillRect(0,0, getSize().width, getSize().height);
         try {
             URL scoreTrackerURL = new URL(getCodeBase(), "newscore.jsp?name=foo&score=10000");
             System.out.println(scoreTrackerURL);
             URLConnection scoreTrackerConn = scoreTrackerURL.openConnection();
             scoreTrackerConn.connect();
         } catch(IOException ioe) {
             ioe.printStackTrace();
    }The call to System.out.println writes the URL that's to be called to the java console in the webbrowser, so you can verify that the method has been called.Any Exceptions that might occour within the method will show up in the same place
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <title>New Score</title>
      </head>
      <body>
        <h1>New Score</h1>
    <%@ page language="java" %>
    <%@ page import="java.util.*" %>
    <%@ page import="java.net.*" %>
    <%@ page import="java.io.*" %>
    <%
    String name = request.getParameter("name");
    String score = request.getParameter("score");
    System.out.println("name=" + name + " score=" + score);
    BufferedWriter writer = new BufferedWriter(new FileWriter("highscore.txt"));
    writer.write(name + ", " + score);
    writer.close();
    %>
      </body>
    </html>Again a call to System.out.println . This time it results in the two parameters being written to the application server log file, so you can see if the jsp was called and what the parameters were.
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <title>test af AppletParam</title>
      </head>
      <body>
        <h1>test af AppletParam</h1>
        <applet codebase="." code="kres_test.AppletParam" width=200 height=200>
        </applet>
      </body>
    </html>The html file with the applet. Remember to place the class file in the correct place. If not you will get an error message in the java console of the webbrowser.
    My tests was performed on a WebLogic 6.1 application server, but there's nothing special about your code, it ought to run on any decent J2EE application server.

  • 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!

  • Can we pass paramters in the partition script

    Can we pass parameters in the partition script in Essbase. Where the parameters are read by a windows batch file which is executed in windows environment.
    Our Business requirement, the business will key in the parameters ie(Month and Year) in a partition script dynamically.
    We are scheduling the partition script through Windows Batch file.
    So is it possible to create a parameter file in windows and pass these parameters to windows batch file.It should be dynamically mapped with partition Script.If possible,can anyone provide sample script to show how it works.

    Thank You Wills. The requirement is the users want to change the mappings in the partition script, but users are not having any access to the EAS. They want the mappings to be dynamically changed in the partition script on adhoc basis.
    Admin can change the values to the substituion variables, but the requirement is users wants to change the mappings.
    So they asked for the parameter file.

  • 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.

Maybe you are looking for