How to spool file to where start script file located

I'm writing a sqlplus script, eg. runMe.sql, which is going to run in customer env, will generate some data files eg. result.csv.
By specify location such as 'spool /certain/path/on/disk/result.csv', I can spool to any path I want. However, my concern is  below:
1. We gets many customers and the script might be run under different location.
2. I don't know where customer would save the script, furthermore, I don't want customer to input location manually every time.
3. Generally, customer would run the script something like "sqlplus username/password@sid @/certain/path/on/disk/runMe.sql". They don't want to pass any parameter at run time.
4. I wanna spool file to "/certain/path/on/disk" automatically, as a result, result.csv file would appear under same path with runMe.sql.
5. I tried "spool ./result.csv" but it navigate to where sqlplus session is running.
6. Also tried &0 etc, but make no sense.
Can anyone tell me how to obtain start running script file path in sqlplus script(runMe.sql) ? Just like access command parameters under Linux.
$0 is the name of the command
$1 first parameter
$2 second parameter
$3 third parameter etc. etc
$# total number of parameters
$@ all the parameters will be listed
Thanks in advance.

Are you looking for SQLPATH ?
A good and clear example by Paul @ https://forums.oracle.com/message/3727891
In this way your customer has to set one environment variable SQLPATH=/location/of/script/file/where/they/put/your/runMe.sql and just say :
spool %sqlpath%\result.csv
in your runMe.sql.  So, runMe.sql and result.csv will be on SQLPATH location.
Regards
Girish Sharma

Similar Messages

  • HT201744 How do you actually know where a Spotlight file is?  I mean all well and good Spotlight identifies it but I want to know which file has been identified and where it is......

    How do you actually know where a Spotlight file is?  I mean all well and good Spotlight identifies it but I want to know which file has been identified and where it is......

    To know where the Spotlight file is, highlight it in Spotlight and hold the Command key, so you will see its location at the bottom of the window

  • How can I find out where the Library files currently used by iTunes are located?

    I have had a bit of a nightmare sorting out my iTunes files so I have various versions of Library files all over the place. How can I tell where the Library file that iTunes is currently using is located? In Preferences I can see the Library "Name", but I don't think that is much help. Preferences also shows where my i-Tunes media folder is but not where the Library files are.
    Any help greatly appreciated.
    J

    Ah, I was assuming you would search in Finder and display some details. All alternative approach is to Option start iTunes and click the Choose option. It should show a file selection box targeted at the folder of the currently active library.
    tt2

  • How to create several procedures from several script files?

    Hello,
    I have several procedures for SAP HANA. Every procedure is stored in a script file. I can only use SAP HANA Studio.  How can I easily  run all script files to create all procedures on a schema? Can somebody help me?
    Best regards,
    Y.Hu

    Hi Fernando,
    Thank you very much for you explanation.
    My scripts contain native sql statements for creation stored procedures “CREATE PROCEDURE … AS BEGIN … END”. They are not objects for or from Content/package. The procedures should be created direct in a project schema.
    The option with hdbsql command line is not possible because I may not use hdbsql (unfortunately not allowed for me).
    The option all scripts into a big file is a possible option for me. The big file has only 1600 lines. But there is a  strange problem with the text “FOR” in script (please see the thread http://scn.sap.com/thread/3728741 ). Unfortunately SAP HANA Studio cannot run my big script. 
    I hope there is a solution or workaround for this problem.
    Best regards,
    Y.Hu

  • How can I do automatic backup of Firefox bookmarks? What is the name of the bookmarks file and where is it probably located in Windows?

    I want to back up Firefox bookmarks automatically. I know that Firefox has manual bookmark export and bookmark. Can it be automatic? If not I will use backup software to do it, but I need to know the name of the bookmark file and where it is located on my hard drive. .

    Firefox stores both bookmarks and browsing history in the file '''places.sqlite''' in the Firefox profile folder . On Windows 7, the Firefox profile folder location is something like:
    C:\Users\"your username"\AppData\Roaming\Mozilla\Firefox\Profiles\'''xxxxxxxx.default''' but this location is hidden by default. See [[Profiles]] for help finding the profile folder.
    Firefox bookmarks are already backed up automatically.
    The bookmark backups are stored as dated .json files in the Firefox profile folder, under the subfolder, '''bookmarkbackups'''. You can restore a bookmark backup file using the information here:
    *[[Backing up and restoring bookmarks]]
    For additional information, see:
    * http://kb.mozillazine.org/Backing_up_and_restoring_bookmarks_-_Firefox
    *[[Backing up your information]]

  • File Transfer (Missing start of file)

    Hi there, I'm undertaking part of a software project at University and struggling to fix a piece of code myself and a friend have wrote after exhausing most of the good java programmers in our department.
    We're simply trying to send files over a network via TCP, the main problem we're encountering is that if we send say a text file, a varying number of characters will appear missing. Normally we'll recieve between 300-400 of the 500 bytes we send for example, and these characters are always missing from the start of the file. Obviously this is the bit we need to fix, at the end we're aiming to be able to send media files (jpg, gif, txt, wav, avi) and hopefully objects aswell.
    The way its intended to work at present is that the server sends file information to the client (filename and filesize), and then the client listens, and writes the same number of bytes as the filesize to the new file it creates (though I'm sure you'll work that out in seconds). The file has been read in, and wrote back on the server side just to ensure the reading/sending section was working which it was.
    Server Side:
    FileServer.java: import java.io.*;
    import java.net.*;
    public class FileServer
       private ServerSocket serverSocket = null;
       private Socket socket = null;     
       public String fileDir = "H:/JAVA/";
       public String fileName = "text.txt";
       public String filePath = fileDir + fileName;
       public PrintWriter log;
       public BufferedReader in;
       public PrintStream out;
       public FileServer() throws IOException
          try {
                  serverSocket = new ServerSocket(1138);
                  System.out.println("Server initialised and listening on port : 1138.");
          catch (IOException e){
             System.out.println("Could not listen on port : 1138");
          try {
             socket = serverSocket.accept();
             System.out.println("Client" + serverSocket.getInetAddress() + "connected.");
             in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
             out = new PrintStream(socket.getOutputStream(), true);
          catch (IOException e){
             System.out.println("Could not accept client.");
             System.exit(1);
         boolean done = false;
         while (!done)
            try{
               String line = in.readLine();               
               if (line == null)
                  done = true;
              else
                   if (!line.trim().equals("CLOSE"))               
                       if (line.trim().equals("SEND FILE"))
                           sendFile(filePath, socket);
                   else
                       done = true;                         
                catch (IOException e) {
                   System.out.println("Cannot read data from client");
                   System.exit(1);
          socket.close();
    public void sendFile( String filename, Socket socket )
       File file;     
       try{
             file= new File(filePath);
             int c =0;
             FileInputStream fis = new FileInputStream(file);
             out.println(fileName+":"+file.length());
             OutputStream os = socket.getOutputStream();
             int i = 0;
             while((c = fis.read()) != -1)
                 i++;
                System.out.println(i +"  "+ c);
                os.write(c);
             System.out.println("File "+filePath+" sent:"+file.length());
             fis.close();
       catch( Exception e ) {
            System.out.println("sending file error");
            e.printStackTrace();
            System.exit(1);
    public static void main (String [] args) throws IOException
       FileServer myFileServer = new FileServer();
    Client Side:
    Client.java: import java.net.*;
    import java.io.*;
    import java.lang.*;
    import java.util.*;
    public class Client
      private Socket clientSocket = null;
      public String filePath = "H:/java/Temp";
      PrintWriter out = null;
      BufferedReader in = null;
      String host = "144.32.152.154";
      int port = 1138;
      Integer fileSize;
      String filename;
      public Client() throws IOException {
        InputStream inputStream;
        try {
          clientSocket = new Socket(host, port);
        catch (IOException e) {
          System.out.println("Could not create connection");
          System.exit(1);
        out = new PrintWriter(clientSocket.getOutputStream(), true);
        inputStream = clientSocket.getInputStream();
        in = new BufferedReader(new InputStreamReader(inputStream));
        out.println("SEND FILE");
       String details;
       while((details = in.readLine()) != null)     
          System.out.println(details);
          StringTokenizer sToken = new StringTokenizer(details, ":");
          filename = sToken.nextToken();
          fileSize = Integer.valueOf((sToken.nextToken()));
          System.out.println(filename);
          System.out.println(fileSize);
          FileOutputStream file = new FileOutputStream(new File(filePath,filename));
             for (long i=0; i<fileSize.longValue(); i++)
                int c = inputStream.read();
                file.write(c);
                System.out.println(i);
                System.out.println(fileSize);
            System.out.println("Exited Loop");
            file.flush();
            file.close();
            clientSocket.close();
            System.out.println("The End");
            System.exit(-1);
      public static void main(String[] args) throws IOException
        Client myClient = new Client();
    } I'd appreciate any help you can offer to fix the problem! Thanks
    Ian Wright

    OK. There were some mistakes in the code. Some made by me, some by you.
    First of all: The byte array which acts as a buffer for reading the file content from the socket cannot have the size of the whole file. Normally it is suggested to set to 8-32kB.
    Second thing: I was too fast in giving you the idea of reading the details only once to an array. Sometimes the Client program is faster than the FileServer and although the array has space for "nameLength" bytes it reads a lot less. That way the details aren't recieved properly. To solve this I've added a loop that waits for the inputStream to retrieve enought data.
    Last but not least: I've been told that it is not wise to close the socket at the server side. If you close the socket the OutputStream is cut off without a warning. Close the OutputStream instead.
    I remember that you asked me to reply via e-mail but I think that posting the solution here will be more usfull to others. Here's the code:
    Client3.java
    import java.net.*;
    import java.io.*;
    import java.util.*;
    public class Client3
      private Socket clientSocket = null;
      OutputStream out;
      public String filePath = "E:/";
      String host = "127.0.0.1";
      int port = 1138;
      Integer fileSize;
      String filename;
      static final byte SEND = 1;
      static final byte DONE = 2;
      static final byte ERROR = 0;
      public Client3()throws IOException{
        DataInputStream inputStream;
        System.out.println("Hello");
        try {
          clientSocket = new Socket(host, port);
        catch (IOException e) {
          System.out.println("Could not create connection");
          System.exit(1);
        out = clientSocket.getOutputStream();
        inputStream = new DataInputStream(clientSocket.getInputStream());
        out.write(SEND);
         byte nameLength = (byte)inputStream.read();
         byte[] nameArray = new byte[nameLength];
         while (inputStream.available()<nameLength) // we have to wait for the details to arrive :]
              try {
                   Thread.sleep(10);
              } catch (InterruptedException e) {
                   System.out.println("Client impatient ... couldn't wait");
              inputStream.read(nameArray);
         String details = new String(nameArray);
         StringTokenizer sToken = new StringTokenizer(details, ":");
        filename = sToken.nextToken();
        fileSize = Integer.valueOf((sToken.nextToken()));
         System.out.println(filename+":"+fileSize);
          FileOutputStream file = new FileOutputStream(new File(filePath,filename));
                   while (true) { // now read the file one piece after a nother :P
                        byte[] fileBuffer = new byte[8*1024];
                        int cnt = 0;
                        cnt = inputStream.read(fileBuffer);
                        if (cnt==-1) break;
                        file.write(fileBuffer,0,cnt);
          file.flush();
          file.close();
          out.close(); // T100 would say: Hasta la vista ... baby!
          System.out.println("The End");
          System.exit(-1);
      public static void main(String[] args) throws IOException{
           Client3 client = new Client3();
    FileServer3.java
    import java.io.*;
    import java.net.*;
    public class FileServer3 {
       private ServerSocket serverSocket = null;
       private Socket socket = null;     
       public String fileDir = "";
       public String fileName = "image.bmp";
       public String filePath = fileDir + fileName;
       public PrintWriter log;
       public InputStream in;
       public DataOutputStream out;
       static final byte SEND = 1;
       static final byte DONE = 2;
       static final byte ERROR = 0;
       public FileServer3() throws IOException
          try {
                  serverSocket = new ServerSocket(1138);
                  System.out.println("Server initialised and listening on port : 1138.");
          catch (IOException e){
             System.out.println("Could not listen on port : 1138");
        while(true){
          try {
             socket = serverSocket.accept();
             System.out.println("Client" + serverSocket.getInetAddress() + "connected.");
             in = socket.getInputStream();
             out = new DataOutputStream(socket.getOutputStream());
          catch (IOException e){
             System.out.println("Could not accept client.");
             System.exit(1);
          try{
               byte b =(byte)in.read();
              if (b == SEND)               
                           sendFile(filePath, out);
           catch (IOException e) {
                   System.out.println("Cannot read data from client");
                   System.exit(1);
    public void sendFile( String filePath, DataOutputStream out ) {
         File file;
       try{
         file = new File(filePath);
             FileInputStream fis = new FileInputStream(file);
         String details = fileName+":"+Long.toString(file.length());
         System.out.println((byte)details.length()+": "+details);
         out.write((byte)details.length());
         out.writeBytes(details);
         System.out.println("File details sent");
         while (true) { // Momma always said to bite before swallowing :D
              byte[] byteArray = new byte[8*1024];
              int cnt = fis.read(byteArray);
              if (cnt == -1) break;
              out.write(byteArray,0,cnt);
             System.out.println("File "+filePath+" sent:"+file.length());
             out.close(); // Say goodbye and the door will close by it self %)
       catch( Exception e ) {
            System.out.println("sending file error");
            e.printStackTrace();
            System.exit(1);
      public static void main (String [] args) throws IOException {
         FileServer3 myFileServer = new FileServer3();
    }I hope this will help you out. If there are any other errors that I've missed than point them out to me and I'll se what can be done later. I have a cake in the oven and don't have enough time right now :].
    ...:: byElwiZ ::...

  • How to spool out put of multiple scripts and get a single spool file output

    Hi,
    I have one master script that calls three other scripts. The three scripts each produce their own spool files. But I would like to have the master script also produce one single output (in addition to the three indiviual output I mean). How to do that? Can you please help.
    Following are the scripts:
    --m.sql (master script)
    spool c:\m.log
    @1.sql
    @2.sql
    @3.sql
    spool off
    --1.sql
    spool c:\1.log
    insert into test values(1);
    commit;
    spool off
    --2.sql
    spool c:\2.log
    insert into test values(2);
    commit;
    spool off
    spool c:\3.log
    insert into test values(3);
    commit;
    spool off
    --table used
    SQL> desc test
    Name                                      Null?    Type
    A                                                  NUMBERWhen I run the above script m.sql it does produce the other 3 log files (1.log,2.log etc) but m.log (which is master log file which should have output of each of the three calling script) is empty file with 0 byte!
    Thanks
    Edited by: orausern on May 1, 2011 3:17 AM

    I have one master script that calls three other scripts. The three scripts each produce their own spool files. But I would like to have the master script also produce one single output (in addition to the three indiviual output I mean). How to do that? Can you please help. Not sure if that's possible directly with sqlplus spool option
    When you spool to a different file in a single session, sqlplus stops writing to earlier spool file and redirects the output to the file specified in last spool command.
    at the end of the script, however, below may help
    host type c:\1.log >> c:\m.log
    host type c:\2.log >> c:\m.log
    host type c:\3.log >> c:\m.log

  • When I do a download, it is saved to a Binary File. Where are these files stored & how do you uninstall a program you don't want to keep ?

    I use firefox, when I download a file from another website, there is a pop-up that shows the name of the download, which shows it is saved to a binary file, (don't know what a binary file is) but my question is where are the binary files stored on my computer & if I can uninstall it if I don't want to keep it.

    read basic about svchost:
    [http://support.microsoft.com/kb/314056/en-us A description of Svchost.exe in Windows XP Professional Edition]
    find svchost services:
    [http://webcache.googleusercontent.com/search?q=cache:pa9PdGlHr0sJ:www.bleepingcomputer.com/tutorials/list-services-running-under-svchost.exe-process/+what+is+svchost.exe&cd=12&hl=el&ct=clnk&gl=gr a way how to determine what services are running under a SVCHOST.EXE process]
    One Temporary Solution is to disable the Windows Automatic Update service:
    http://ask-leo.com/how_do_i_fix_this_high_cpu_usage_svchost_virus_or_whatever_it_is.html
    (no '''it is not''' a virus)
    (works for me)
    thank you
    Please mark "Solved" the answer that really solve the problem, to help others with a similar problem.

  • How can I completely uninstall Simple Pass Data file? where is data file kept?

    Computer came with Simple Pass finger print reader.  Won't let me program Windows log on unless I enter Windows log on password.  I DO but it says "incorrect from what was originally password."
     I don't know what that would be, (tried all old passwords)  so I want to ERASE ALL RETAINED DATA and reinstall.  
    ADD/REMOVE program removes program but data retained.  Then deleted Validity Sensor under Biometric devices so all data should be gone but upon reinstall it still says i have wrong password!
    Where else is this data kept on computer and how can i remove so I can fix program?
    Anyone familiar with Simplepass or recommend another fingerprint program that would work with HP Envy?
    Thanks in advance.
    This question was solved.
    View Solution.

    Frank,
    Updating the OS to Windows 8.1 does destroy the Recovery Manager -- side "benefit" that seems to go unmentioned by some of the enthusiasts of Upgrades.  On the other hand, unless the system comes with 8.1 there is little you can do -- Windows 8 is rather sad.    You have the choice of a weird hybrid "almost" Windows 8.1 or running Windows 8.  Eeeew.  I chose the upgrade on the one Windows 8 system I have -- same level of frustration but at least the problems are different than running sad Windows 8.  Smiling.
    Because you know your system runs Windows 8.1 -- and there are apparently the Drivers at your system's HP Support pages for Windows 8.1 (very important), you might consider purchasing Windows 8.1 Pro and being done with the hybrid upgrade OS.  You still lose the Recovery Manager, of course, purchased 8.1 does not provide the HP Recovery Manager -- but at least the OS is stable.   You still install the HP drivers from the computer's Support site, of course.  I actually purchased 8.1 for my upgrade system and have only been too lazy to install it.  Sigh.
    You can use third party Image software to back up the system.  Certainly not the only one, and maybe not even the best according to whom you ask -- one such tool: 
    Redo software is free and is NOT Windows dependent. 
    The software can be used with Both Windows and Linux Operating Systems.
    Redo Backup – Recovery – Bare Metal Restore
    Please read the HELP / FAQ page.
    Reference:
    Windows 8 Features – A Quick Tour
    =======================================================================
    You might go ahead and create that extra local admin account -- there is nothing like the clarity of hindsight.  I dislike this error about mismatched passwords.
    Click the Kudos Thumbs-Up to say Thank You!
    And...Click Accept as Solution when my Answer provides a Fix or Workaround!
    I am pleased to provide assistance on behalf of HP. I do not work for HP. 
    Kind Regards,
    Dragon-Fur

  • How can i write a automatic start script in crontab

    Hi All,
    Can anyone please help me in writing a automatic startup script in crontab.... Please tell me the steps to do so... I am trying it unable to do so....
    Thanks and regards
    Amit Raghuvanshi

    Hi Dear,
    Actually i am just trying to startup the database on a specific time of the day for now. I have tried to acheive it but i am failing to start the database through the crontab entry.
    OS: RHEL 3
    DB Version: 9.2.0.3
    Infact i am trying to write a script for RMAN backup but i am failing on the very initial stage of just trying to connect and startup the database through my script.
    Thanks and regards
    Amit Raghuvanshi

  • Accessing a variable in mxml file from an action script file

    Hi,
        I think this is a very very dumb question but i am nto being able to gigure this out i am a total newbie to flex.
         i have a mxml file e.g. aaa.mxml which has the following declaration
         ........ //some lines of code
         <mx:XMLListCollection  
    id="listCollectionData" source="{srv_new.lastResult.data.result}" />
      Now if i have some external file e.g. myActionScript.as - how do i access the listCollectionData value defined in aaa.mxml file?
    Thank you so much ...
    Rohit

    Hi,
             me not clear wether it is an AS file or AS Class
             if you are using ActionScript File then include your ASFile in aaa.mxml
                    <mx:Script  source="myActionScript.as" />
             If you are using ActionScript Class then create and object for aaa.mxml then you can use all the Properties of aaa.mxml in myActionScript.as

  • SapScript output spool to a POST script file

    We generate  billing invoice output using custom
    program/Sap script. Subsequently we release the invoice print out from
    the print spool to create a post script file from the print spool by configuring command set "G" in
    transaction u201CSPADu201D. This processis  is working fine in R/3
    However, when we migrated the same functionality to ECC, we are finding
    that the file created containing only garbage data.
    Anyone has encountered this issue and have suggestions to resolve this.
    Thanks
    Palani

    Hi Gary
    How the issue is resolved, please let me know. Since i am also facing same issue.
    Thanks
    M G Shankar

  • How can I get currently running script file path in PS CS (8.x)

    Is it possible to retrieve full file name of my script file in Photoshop CS (8.x)?
    Constructions:
    b ScriptName = $.fileName
    and
    b try { some_error }
    b catch(e) { ScriptName = e.fileName; }
    are not works in Photoshop CS

    Hi Mike,
    Based on your description, we can enable the policy setting to see if it helps:
    Computer Configuration\Administrative Templates\System\Logon\Always wait for the network at computer startup and logon
    Besides, regarding how to assign log on scripts, the following article can be referred to for more information.
    Assign User Logon Scripts
    http://technet.microsoft.com/en-us/library/cc770908.aspx
    Moreover, as Carl suggested, instead of using scripts, we can utilize Group Policy Preferences Dive Maps extension to map drives for users.
    Regarding this point, the following article can also be referred to for more information.
    Drive Maps Extension
    http://technet.microsoft.com/en-us/library/cc731729.aspx
    Configure a Mapped Drive Item
    http://technet.microsoft.com/en-us/library/cc770902.aspx
    Best regards,
    Frank Shen

  • Help: how to download applet by script file (generate by SCRIPTGEN)

    hi all,
    My card have Javacard 2.1.1, GP 2.0.1. I built a CAP file and generate to SCRIPT file by SCRIPTGEN tool.
    This is my script:
    0x80 0xB0 0x00 0x00 0x00 0x7F;
    // javacard/Header.cap
    0x80 0xB2 0x01 0x00 0x00 0x7F;
    0x80 0xB4 0x01 0x00 0x13 0x01 0x00 0x10 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x04 0x00 0x01 0x06 0x11 0x22 0x33 0x44 0x55 0x66 0x7F;
    0x80 0xBC 0x01 0x00 0x00 0x7F;
    // javacard/Directory.cap
    0x80 0xB2 0x02 0x00 0x00 0x7F;
    0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x10 0x00 0x1F 0x00 0x0A 0x00 0x0B 0x00 0x1E 0x00 0x0C 0x00 0x3D 0x00 0x0A 0x00 0x0B 0x00 0x00 0x00 0x4D 0x00 0x00 0x00 0x00 0x00 0x00 0x01 0x7F;
    0x80 0xB4 0x02 0x00 0x02 0x01 0x00 0x7F;
    0x80 0xBC 0x02 0x00 0x00 0x7F;
    // javacard/Import.cap
    0x80 0xB2 0x04 0x00 0x00 0x7F;
    0x80 0xB4 0x04 0x00 0x0E 0x04 0x00 0x0B 0x01 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x7F;
    0x80 0xBC 0x04 0x00 0x00 0x7F;
    // javacard/Applet.cap
    0x80 0xB2 0x03 0x00 0x00 0x7F;
    0x80 0xB4 0x03 0x00 0x0D 0x03 0x00 0x0A 0x01 0x06 0x11 0x22 0x33 0x44 0x55 0x67 0x00 0x08 0x7F;
    0x80 0xBC 0x03 0x00 0x00 0x7F;
    // javacard/Class.cap
    0x80 0xB2 0x06 0x00 0x00 0x7F;
    0x80 0xB4 0x06 0x00 0x0F 0x06 0x00 0x0C 0x00 0x80 0x03 0x00 0xFF 0x00 0x07 0x01 0x00 0x00 0x00 0x1C 0x7F;
    0x80 0xBC 0x06 0x00 0x00 0x7F;
    // javacard/Method.cap
    0x80 0xB2 0x07 0x00 0x00 0x7F;
    0x80 0xB4 0x07 0x00 0x20 0x07 0x00 0x3D 0x00 0x01 0x10 0x18 0x8C 0x00 0x01 0x7A 0x05 0x30 0x8F 0x00 0x06 0x3D 0x8C 0x00 0x05 0x18 0x1D 0x04 0x41 0x18 0x1D 0x25 0x8B 0x00 0x02 0x7A 0x02 0x7F;
    0x80 0xB4 0x07 0x00 0x20 0x21 0x18 0x8B 0x00 0x03 0x60 0x03 0x7A 0x19 0x8B 0x00 0x04 0x2D 0x1A 0x04 0x25 0x73 0x00 0x09 0x00 0x00 0x00 0x00 0x00 0x0F 0x11 0x6D 0x00 0x8D 0x00 0x00 0x7A 0x7F;
    0x80 0xBC 0x07 0x00 0x00 0x7F;
    // javacard/StaticField.cap
    0x80 0xB2 0x08 0x00 0x00 0x7F;
    0x80 0xB4 0x08 0x00 0x0D 0x08 0x00 0x0A 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F;
    0x80 0xBC 0x08 0x00 0x00 0x7F;
    // javacard/ConstantPool.cap
    0x80 0xB2 0x05 0x00 0x00 0x7F;
    0x80 0xB4 0x05 0x00 0x20 0x05 0x00 0x1E 0x00 0x07 0x06 0x80 0x07 0x01 0x06 0x80 0x03 0x00 0x03 0x80 0x03 0x02 0x03 0x80 0x03 0x03 0x03 0x80 0x0A 0x01 0x06 0x00 0x00 0x01 0x01 0x00 0x00 0x7F;
    0x80 0xB4 0x05 0x00 0x01 0x00 0x7F;
    0x80 0xBC 0x05 0x00 0x00 0x7F;
    // javacard/RefLocation.cap
    0x80 0xB2 0x09 0x00 0x00 0x7F;
    0x80 0xB4 0x09 0x00 0x0E 0x09 0x00 0x0B 0x00 0x00 0x00 0x07 0x05 0x06 0x04 0x0A 0x07 0x07 0x13 0x7F;
    0x80 0xBC 0x09 0x00 0x00 0x7F;
    0x80 0xBA 0x00 0x00 0x00 0x7F;
    So, when download into card, what would we do?
    In my investigate, something must do in below:
    1) //select INSTALLER
    0x00 0xA4 0x04 0x00 0x08 0xA0 0x00 0x00 0x00 0x03 0x00 0x00 0x00 0x7F;
    2) //set key to open a secure channel
    set-key 255/1/DES-ECB/404142434445464748494a4b4c4d4e4f 255/2/DES-ECB/404142434445464748494a4b4c4d4e4f 255/3/DES-ECB/404142434445464748494a4b4c4d4e4f
    ==> real APDU of this command? plz suggest me!
    3) // init-update 255
    0x80 0x50 0x00 0x00 0x08 0x9A 0xE5 0x80 0x27 0x9D 0x71 0xE9 0x98 0x00
    // ext-auth plain
    0x84 0x82 0x00 0x00 0x10 0x81 0x49 0x27 0xBE 2E 54 AF 17 26 17 14 1C B0 77 E6 15
    4) // upload CAP file
    5) // install CAP file
    ** In step (2), that means data must be ecrypt before download, it's true?*
    So, when i check in SCRIPT file and CAP file, i saw that data didn't encrypt yet
    ==> what tool could I use to encrypt and these step were full?
    Edited by: hoaibaotre on Mar 2, 2011 9:23 AM

    safarmer wrote:
    As above, CAP files do not get encrypted. The LOAD and INSTALL commands are outlined in the GP card spec. You can also use GPShell to do this for you (including the INIT UPDATE and EXT AUTH steps).So, I understood we needn't ecrypt data. Thank so much. And some questions for you:
    When I use GPShell, my script likes that:
    enable_trace
    establish_context
    mode_201                    // add this line for JCOP 3.1
    enable_trace
    establish_context
    card_connect
    select -AID a000000003000000
    open_sc -security 1 -keyind 0 -keyver 0 -mac_key 404142434445464748494a4b4c4d4e4f -enc_key 404142434445464748494a4b4c4d4e4f // Open secure channel
    delete -AID D0D1D2D3D4D50101     // delete instance applet AID
    delete -AID D0D1D2D3D4D501          // delete instance package AID
    delete -AID D0D1D2D3D4D50101
    install -file path\to\helloworld.cap -sdAID a000000003000000 -priv 2          // create new instance
    card_disconnect
    release_context
    In open secure channel line:
    open_sc -security 1 -keyind 0 -keyver 0 -mac_key 404142434445464748494a4b4c4d4e4f -enc_key 404142434445464748494a4b4c4d4e4f // Open secure channel
    Format: open_sc -security  (channel number) -keyind (key index) -keyver (key set version) -mac_key (MAC key) -enc_key (Encrypt key)
    After that, I thought we must give a secure channel for transfer data.
    So, in my script file, need I add a command for that? If it's true, what APDU?
    Thanks,
    HoaND
    Edited by: hoaibaotre on Mar 2, 2011 11:01 AM

  • How do I import an InDesign tagged text file into multiple pages and export as .ps or .pdf using Jav

    I have an InDesign tagged text file I've translated from .xml. I need to automate the following steps:
    1 - access specific InDesign template (eg. ABC_template.ind)
    2 - import tagged text file into InDesign
    3 - autoflow text to END of document (normally around 3-5 pages)
    4 - save document as either .ps or .pdf file
    5 - where the input file stub name matches the output stub name (eg., OrigName.txt outputs as OrigName.pdf).
    I would like to completely automate this whole process using JavaScript (because I don't know anyone that knows AppleScript). I've automated the first part using a perl script. I've been trying to find sample snipits of JavaScript that would do one or more of the items listed above, but am having a hard time finding what I need.
    Please, I'm desperate!! Can any of you InDesign scripting guru's out there help me??
    Thanks in advance!!
    LindaD

    Hi Linda,
    I might be able to help you out. You can contact me by email (click on my user name for the address), or if you post your email here.

Maybe you are looking for