AppleScript: Saving text output to a file

Hi all,
I am trying to save some output to a text file from AppleScript. Based on some postings I've found, I've been trying variations on this where theSubjects has some formatted text in it.:
     tell application "TextEdit"
          activate
          make new document
          set text of document 1 to theSubjects
          save document 1 in file (("/Users/karl/Desktop/") & "ListSubjects.rtf")
     end tell
The text makes it into TextEdit as I intended, but when the script tries to save the file, I'm getting "The document "Untitled" could not be saved as "/Users/karl/Desktop/ListSubjects.rtf". You don't have permission."
This error is consistent across all output directories that I have tried. I cannot find any sign that there are actual permissions issues.
Any suggestions would be appreciated.
Thank you.

Yes, use the scheduler and schedule the report,
do the bursting into FTP or
schedule the report to run and run it into FTP as a single FILE.
First option, you need to provide the query , with FTP server name, username, password etcccc.

Similar Messages

  • Saving report output to a file on the server.

    Hi,
    We are using BI Publisher Standalone version 10.1.3.3.1.
    Is it possible to schedule a report to output to a file on the server?
    I want the whole report to be saved as a file on the server.
    This is somewhat similar to bursting to a file system, but, I don't want to split the output.
    Any help is appreciated.
    Thanks,
    Nanda

    Yes, use the scheduler and schedule the report,
    do the bursting into FTP or
    schedule the report to run and run it into FTP as a single FILE.
    First option, you need to provide the query , with FTP server name, username, password etcccc.

  • Saving RMAN output to os file..

    Dear Rman Gurus!
    I'd like to save an RMAN output to os file.. for example this would be terrific:
    RMAN> list backup; > /home/oralce/os_user/list.txt ???
    is this possible? how do you have this solved in your env? I cannot find the right solution..
    I am using version 8 and 9.. so spool log is not quite good as it doesn't work with v. 9..
    Many thanks for your suggestions!
    agat81

    RMAN v. 8Are you talking about 8i or 8.0?
    The LOG option is available in 8i, but I don't believe the SPOOL LOG option is available. I have no idea about 8.0.

  • Saving List Output to a file

    Hi all,
    I have developed one classical report in that user is saving the report output to a text file from menu list->Save/Send>File> Unconverted
    there every time user has to enter path and file name and he replace the existing file by replace option.
    Is there any way to pass this info. (path,file name) dynamically?
    I want that when user finish with parameter form then automatically the out put is stored in the file with predifine name.
    Thanks in advance.
    Deval Bhatt
    Message was edited by:
            Deval Bhatt

    Hi,
    Use fm
    Create Application Button using your PF status as "Download List" and use the following function module to download
      sy-lsind = sy-lsind - 1.
      call function 'LIST_DOWNLOAD'
           exporting
                list_index = sy-lsind
                method     = 'RTF'
           exceptions
                others     = 1.
    aRs

  • Problem while saving list output as local file.

    Hi Gurus!
    i want to save the list output of classical report into excel but complete data is not coming into excel file.
    [SYSTEM - > LIST ->SAVE ->  LOCAL ->SPREADSHEET ]
    when same output is transfer to unconverted file [notepad ] then completed data is coming.
    please help me ,
    points sure!
    Rahul
    Message was edited by:
            rahul deshmukh

    Yes Rahul, I know that and you have to do the formating. This is how you can do.
    Open the unconverted file in Excel format.
    Select the first column and then goto Data - Text to Columns , a pop up will come.
    Select Delimited, then press next.
    Then selct the delimeter that is used in the unconverted file to seperate two columns. Say for example if ' | ' is used then in others write ' | ' and press next.
    IN the data preview section select all the columns and then select text radio button on top and press finish finally.
    Now u will get the proper format of the file. Delete all the empty rows and columns that u don't want.
    Reward if you find it useful.
    Regards.
    Akhil.

  • Saving an output in a file

    Hi all, i am having problems with an assignment that i have. I have to prompt the user for a dna sequence and a description of that sequence and then save it to a file., but when i go to look at the file that i created, it give me the memory address of that sequence and then the description always returns null like i never set it. Can anyone help.
    Sequence.java(you shouldn't need this but in case you do)
    public class Sequence
        // instance variables - replace the example below with your own
        public String sequence;
        public String description;
        public double energy;
        public int number;
        public int temp;
        public double boltzman;
        public final double gasConstant = 1.9872;
         * Constructor for objects of class sequence
        public Sequence()
            // initialise instance variables
            sequence = " not set";
            description = "  not set";
            energy = 0;
            number = 0;
            temp = 0;
            boltzman = 0;
         /**initialize variables
         public Sequence(String aSequence, String aDescription)
             sequence = aSequence;
             description = aDescription;
         /** Sets the sequence
         public void setSequence(String aSequence){
             sequence = aSequence;
         /** Returns the sequence
         public String getSequence(){
             return this.sequence;
         /** Sets the description
         public void setDescription(String aDescription){
             description = aDescription;
         /** Returns the description
         public String getDescription(){
             return this.description;
         /** sets the energy
         public void setEnergy(double aEnergy){
             energy = aEnergy;
         /** returns the energy
         public double getEnergy(){
             return this.energy;
         /** sets number
         public void setNumber(int aNumber){
             number = aNumber;
         /** returns that number
         public double getNumber(){
             return this.number;
         /** sets temp
         public void setTemp(int aTemp){
             temp = aTemp;
         /** returns temp
         public int getTemp(){
             return this.temp;
          /** calculates the number of A's and T's
        public int countATs(){
            int count = 0;
            String at = "AT";
            for (int i=0; i < sequence.length(); i++)
                char ch = Character.toUpperCase(sequence.charAt(i));
                if(at.indexOf(ch) >= 0)
                count++;
            return count;
      /** calculates the number of C's and G's
        public int countCGs(){
            sequence = this.sequence;
            int count = 0;
            String cg = "CG";
            for (int i= 0; i < sequence.length(); i++)
                char ch = Character.toUpperCase(sequence.charAt(i));
                if(cg.indexOf(ch) >= 0)
                count++;
            return count;
         /** calculates boltzmann factor
         public double calculateBoltzman(){
            boltzman = Math.exp(-(energy)/(gasConstant*temp));
            return boltzman;
        /** calculates number-- number overflows when the integer exceeds 32-bits...(i.e. 4^200000000000)
        public int calculateNumber(){
            number = (int)Math.pow(sequence.length(),4);
            return number;
         * ToString method that returns the sequence.
         public String toString(){
             return super.toString()+" The Sequence is  "+ "\n"+this.sequence+"\n"+" The Description is "+"\n"+ this.description+"\n";
    }SequenceTest.java <---where my problem is
    import java.io.FileWriter;
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.io.*;
    * A Class to Sequence.
    * @author (Corbin Blake)
    * @version (10/20/04)
    public class SequenceTest
    public static String desc;  
    public static String[] b;   
         public static void main(String[] args) throws IOException
          while (true)
              System.out.println("Welcome to my program!");
              try
                  System.out.println();
                  System.out.println("Enter d to enter a new DNA sequence, s to save the entered sequence to a file, and x to exit:  ");
                  BufferedReader console = new BufferedReader(new InputStreamReader(System.in));
                  String input = console.readLine();
                  Sequence aSequence = new Sequence();
                  String[] sequenceArray = new String[10];
                  if (input.equalsIgnoreCase("d"))
                    //keeps track of exactly how many elements are being used in the array
                    int sequenceSize = 0;
                    // asks the user for an input
                    System.out.println("Enter a DNA Sequence: ");
                    // gets the input string from the user
                    String input0 = console.readLine();
                    //stores that input as an array
                    sequenceArray = new String[input0.length()];
                    String[] b = sequenceArray;
                    //checks to see if arraysize needs to be doubled and doubles it if necessary
                    if(sequenceSize >= sequenceArray.length)
                        MyUtilities.myarraycopy(sequenceArray);
                    //enters a description
                    System.out.println("Enter a Description of the Sequence: ");
                    //gets input from the user
                    String input1 = console.readLine();
                    String desc = input1;
                  else if (input.equalsIgnoreCase("s"))
                       //asks to save information
                       System.out.println("Enter the name of the file( as a .txt file):");
                       String input2 = console.readLine();
                       //saves the information to the filename of the users chosing.
                       FileOutputStream out;//declares a fileoutput object
                       //declares a printstream object
                       PrintStream p;
                       String [] x = sequenceArray;
                       try
                           //creates a new file output stream connected to the user input
                           out = new FileOutputStream(input2);
                           //connect the printstream to the output stream
                           p = new PrintStream(out);
                           p.println("The saved DNA sequence is: " + b +"/n"+ "The Description is: "+ desc);
                           // exit
                           p.close();
                        catch (Exception e)
                            System.err.println ("Error writing to file");
                  else if (input.equalsIgnoreCase("x"))
                      break;
                  else
                      System.out.println("You have entered an invalid letter, please try again");
                      continue;
        catch (IOException e)
                      break;
              System.out.println("Thank you for using the application");
    }

    I guess we are discussing this line:
    p.println("The saved DNA sequence is: " + b +"/n"+ "The Description is: "+ desc);b is a String[] and arrays don't have overridden toString(). You can use Arrays.asList(b) to get a better String representation or make your own method that lists array to String.
    As far as the null desctiption is concerned - is is possible that there is no more input and readLine returns null?
    HTH
    Mike

  • Adding numbers in a file a and saving the output in another file.!

    can any one pls tell me how to add numbers from a textfile and save the output in another textfile. i'm new with java so pls help out..

    Hi Friend,
    your statement is not clear, it's bit confuse
    this is my unserstanding,
    you want to open a file and read the values then add numbers,
    latter save the sum in a new file.let me know if this is the thing, I can help u
    with Cheers
    Prasanna

  • Saving JSP output to a file

    I need to be able to save what a user sees on his browser, to a local file (where the web app runs).
    The content is dynamic. It is being created using a JSP.
    One way to write it to a local file would be to move the content creation from a JSP to a servlet and write to the HTTP response as well as to a file in the servlet.
    That's going to make it look messy.
    Any thoughts on how I could make this happen while continuing to use a JSP?

    OK, so now I've tried it, it's essentially what is described in the J2EE tutorial:
    /* File 1 */
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    * passes on a subclass of HttpServletResponseWrapper
    * in order to replace the output writer.
    public class OutReplacementFilter implements Filter {
      public void init(FilterConfig filterConfig) throws ServletException {  }
      public void destroy() {  }
      public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
                  throws IOException, ServletException {
        //wrap the original response
        HttpServletResponse newResponse = new ReplacementHttpServletResponse((HttpServletResponse) response);
        //pass it to the resource
        chain.doFilter(request, newResponse);
        //get what the resource wrote
        String output = newResponse.toString();
        //put it to the output stream
        PrintWriter out = response.getWriter();
        out.write(output);
        out.close();
        //and then put it where ever else you like
        System.out.println(output);
    /* File 2 */
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    * returns specialized writer to capture jsp output
    public class ReplacementHttpServletResponse extends HttpServletResponseWrapper {
      private CharArrayWriter replacementWriter;
      public ReplacementHttpServletResponse (HttpServletResponse response) {
        super(response);
        replacementWriter = new CharArrayWriter();
      public PrintWriter getWriter() throws IOException {
        return new PrintWriter(replacementWriter);
      public String toString() {
        return replacementWriter.toString();
    }This way is easy and few keystrokes, but buffers all the output until the filter chain returns.

  • Saving ALV Grid to Local File issue - Missing half of the report

    Hi Experts, Good Day.
    I have developed an ALV Grid report using class CL_SALV_TABLE which displays 200 Columns and 100+ rows/records. It is displaying well, but when I am saving the output into local file (any type) there only 98 columns are downloading and remaining all the columns are missing.
    I would like to know whether there is any restriction for number of columns or what might the problem for it. How can I download all the columns into local file.
    Thanks in Adv.
    Vijay

    Hi,
    Thanks for your response. Even though there are multiple ways to send data to local file I believe all three are same. And even I am facing same issue all the ways. Only 98 Columns data is getting downloaded into Files (it might be .txt, .xls, etc.).
    After downloading first 98 Columns, I am hiding the downloaded columns and again I am downloading remaining columns. Then I am merging in the Excel file. This is very complicated for the End-User. So, please help me out.
    I have used only following methods for displaying ALV.
    For initial object/instance:
    CL_SALV_TABLE=>FACTORY,
    For ALV functions:
    CL_SAVL_TABLE->GET_FUNCTIONS,
    CL_SALV_FUNCTIONS_LIST->SET_ALL,
    For Column heading and Optimized width:
    CL_SALV_TABLE->GET_COLUMNS,
    CL_SALV_COLUMNS_TABLE->SET_OPTIMIZE,
    CL_SALV_COLUMNS_TABLE->GET_COLUMN,
    CL_SALV_COLUMN->SET_SHORT_TEXT,
    To display grid:
    CL_SALV_TABLE->DISPALY.
    - Thanks
    Vijay

  • AppleScript Split text file into multiple files

    I have large text files that I would like to break up into individual files. They are compilations of articles; I want to create a new file for each article, which begins with:
         Document # of #
    I don't think any other lines start with "Document" so that might be fine as a delimiter.
    Also, it would be great if the new files could be named "LAT_1", "LAT_2", etc.
    I found this thread:
    AppleScript separating one text file into many at Paragraph break
    I tried the second script by twtwtw and changed
    set parsingText to "Document"
    but got the following error:
    error "Can’t get item 2 of {\"LAT 1985-1990 local food copy.txt\"}." number -1728 from item 2 of {"LAT 1985-1990 local food copy.txt"}
    I also found this thread but it was too complicated for me to understand. Re: Split a large text file with many entries into separate files
    Can anyone help me modify the script? I've been looking at this as well as Unix commands to use in Terminal, but I'm just too much of a beginner.
    Any assistance is much appreciated!
    Trisha

    Hello
    Here's a modified version of the script in
    Split a large text file with many entries into separate files
    https://discussions.apple.com/thread/5641125?tstart=0
    This will split the given text by delimiter line in the form of "Document # of #" and save each chunk of text from one delimiter to the preceding line of the next delimiter in separate file named after LAT_0000.txt, where 0000 is sequential number starting at 0001.
    Note that any text before the first delimiter is ignored and not saved in output file. You may select multiple input files. Existing file in the destination folder is overwritten. Input text is assumed to be in UTF-8 and each line is termitated by U+000A LINE FEED.
    set ff to choose file with prompt "Choose input file(s)." with multiple selections allowed
    set d to choose folder with prompt "Choose destination folder."
    set args to ""
    repeat with a in {d} & ff
        set args to args & " " & a's POSIX path's quoted form
    end repeat
    do shell script "/usr/bin/perl -CSDA -w <<'EOF' - " & args & "
    use strict;
    sub usage () {
        printf STDERR \"Usage: %s output_directory file [file ...]\\n\", $0;
        exit 1;
    &usage() unless @ARGV > 1;
    my $outdir = shift @ARGV;
    unless ( -d $outdir ) {
        printf STDERR \"Not a directory: %s\\n\", $outdir;
        &usage();
    my $i = 0;
    my ($n, $n0, $t);
    while (<ARGV>) {
        if ( /^ \\s* Document \\s+ [0-9]+ \\s+ of \\s+ [0-9]+ .* $/ox ) {
            $n = sprintf('LAT_%04d.txt', ++$i);             # e.g., LAT_0001.txt
            if ( $n0 ) {
                open(OUT, '>', \"$outdir/$n0\") or die $!;  # overwrite
                print OUT $t;
                close OUT;
            ($n0, $t) = ($n, $_);
        else {
            $t .= $_;
    if ( $n0 ) {
        open(OUT, '>', \"$outdir/$n0\") or die $!;          # overwrite
        print OUT $t;
        close OUT;
    EOF"
    Hope this may help,
    H

  • Why are equally layouted embedded texts in an eps-file saved differently?

    Hi everyone!
    I have a problem with the LaTex package "PSfrag" which is supposed to filter out any specific embedded text of an eps-file in order to re-layout it. Obviously the programm only recognises text-tags in the output eps-file that are formatted like:
    (text-tag1)sh
    whereas the other text-tags are followed by further strange information like
    (text-tag2)
    [3.74512 3.74463 0 ]xsh
    I've created the eps-files via Adobe Illustrator and I've set all texts the same way only to find that Illustrator has saved some texts in the first and others in the latter way. I would be most happy to know  why that is so and how I could accomplish the )sh-ending throughout the whole eps-file for every text event so that "PSfrag" can work out well. I'd appreciate it if anyone can give help...
    Christian Klaessen
    here's an excerpt from the eps-file. The (100) is recognised, the (10) not.
    .85547 .84766 .78516 1 cmyk
    ITHHBA+ArialMT*1 [5.61461 0 0 -5.61461 0 0 ]msf
    1.85693 132.332 mo
    (10)
    [3.12256 0 ]xsh
    10.9219 23.1924 mo
    19.8354 23.1924 li
    .855469 .847656 .785156 1 cmyk
    .85547 .84766 .78516 1 cmyk
    ITHHBA+ArialMT*1 [5.61461 0 0 -5.61461 0 0 ]msf
    .29541 23.1924 mo
    (100)sh

    I guess it's the old gag of "appearance over structure" which also makes AI's SVG files so unworkable at times... What might be causing those differences is impossible to say without seeing the files, but it would appear you have a custom line height in your non-working example, causing it to be required to be written differently. I'm sure Gernot Hoffman can answer this more specifically...
    Mylenium

  • Compare two text files in Powershell and if a name is found in both files output content from file 2 to a 3rd text file

    Is it possible using PowerShell to compare the contents of two text files line by line and if a line is found output that line to a third text file?
    Lets say hypothetically someone asks us to search a text file named names1.txt and when a name is found in names1.txt we then pair that with the same name in the second text file called names2.txt
    lets say the names shown below are in names1.txt
    Bob
    Mike
    George
    Lets say the names and contents shown below are in names2.txt
    Lisa
    Jordan
    Mike 1112222
    Bob 8675309
    Don
    Joe
    Lets say we want names3.txt to contain the data shown below
    Mike 1112222
    Bob 8675309
    In vbscript I used search and replace commands to get part of the way there like this
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.OpenTextFile("testing.txt", ForReading)
    strText = objFile.ReadAll
    objFile.Close
    strNewText = Replace(strText, "Mike ", "Mike 1112222")
    Set objFile = objFSO.OpenTextFile("testing.txt", ForWriting)
    objFile.WriteLine strNewText
    objFile.Close
    That script works great when you know the name you are looking for and the correct values. Lets say someone gives you a list of 1000 employees and says import these names into a list in the correct format and one sheet has the correct names only and
    the other sheet has lots of extra names say 200000 and you only need the 1000 you are looking for in the format from names2.txt.

    Sure,
    Here's a simple one:
    $names1 = "C:\names1.txt"
    $names2 = "C:\names2.txt"
    $names3 = "C:\names3.txt"
    Get-Content $names1 | ForEach-Object {
    $names1_Line = $_
    Get-Content $names2 | Where-Object {$_.Contains($names1_Line)} | Out-File -FilePath $names3 -Append
    This basically just reads $names1 file, line by line, and then read $names2 file line by line as well.
    If the line being evaluated from $names2 file contains the line being evaluated from $names1 file, then the line from $names2 file gets output to $names3 file, appending to what's already there.
    This might need a few more tinkering to get it to perform faster etc depending on your requirements. For example:
    - If either $names1 or $names2 contain a lot of entries (in the region of hundreds) then it will be faster to load the whole content of $names2 into memory rather than opening the file, reading line by line, closing and then doing the same for every single
    line in $names1 (which is how it is currently works)
    - Make sure that your comparison is behaving as expected. The .Contains method always does a case sensitive comparison, this might not be what you are after.
    - You might want to put a condition to ignore blank lines or lines with spaces, else they'll also be brought over to $names3
    Hopefully this will get you started though and ask if you have further questions.
    Fausto

  • Saving the output of a .sql file in .csv format

    Hi,
    I am saving the output of a .sql file in .csv format. But the problem is , the record of few columns have "new line" character in it, so when it is getting saved in .csv format, those records are coming in multiple rows, but they should come in one single row in single block. Please advise how to overcome this problem.
    Regards,
    Niraj

    Hi Guys,
    I guess, there is a misunderstanding.
    He is talking about the issue caused as a result of the data containing a "CRLF" ( Carriage return Line feed ) .
    That is mainly a data issue.
    The query i presume, must be right.
    I guess you should be able to fix it using some string functions.
    Some thing similar to this
    CREATE TABLE ASH (NAME VARCHAR2(10))
    SELECT REPLACE(NAME, CHR(13)||CHR(10), 'ISH') FROM ASH;
    SELECT REPLACE(NAME, CHR(10), 'ISH') FROM ASH;
    SELECT REPLACE(NAME, CHR(13), 'ISH') FROM ASH;
    depending on the type of new line whether it is CR or LF. or CRLF.
    Regards
    Ashish/-

  • How to take Text Output in File as It shows error of Printer definition file

    I want to take Output of a report in text file or rtf format so that i could be able to print on a DMP, it is very difficult to take printing on Inkjets with wide information. How can i take fast printing on Dot Matrix Printer.
    Looking forward for a quick & positive response.

    Hi ,
    Text outut dump can be got by running the report with desformat as delimited. Alternatively You can run the Report in character mode and set the desformat=dflt and destype=file. This will give you a simple text output of the report which can then be printed.
    Thanks
    Oracle Reports Team.

  • Saving JSP report output as a file on the application server

    I am trying to determine if it is possible to save a web based JSP report to the file system in the same way you can with a report generated via the rwservlet command. I am specifying DESTYPE=HTML and DESNAME=/home/mydirectory/abc.htm on the command line, but it seems to be ignored. The directory has 777 permissions on it.
    1. Is it possible to save the JSP output onto the file system just like paper based reports?
    2. Where, if any, is documentation addressing this issue? The reports deployment guide appendix lists all the URL parameters that are available to the various rw commands, but nowhere is discussed what params are relavent to JSP reports.
    3. If it is not possible to do this via the URL, does anyone know if I can somehow fetch out the inner HTML from the generated page at the bottom pf the JSP and then write it to the file system using JAVA? I know how to do it via JavaScript, but the reports are run on UNIX. Is there someway I can access the DOM inside the JSP?
    4. Why hasn't Oracle explained this better?
    Thanks,
    matt

    Thanks for getting back to me. But the documentation link below takes me to running rwservlet requests. This was not what I needed. The good news is my most excellent DBA, Manoj Gandhi, found an old TAR in Metalink that emphatically states that what I am trying to do is not possible. See Note:272401.1
    Well, sort of not possible...
    As it turns out it is possible, but you must schedule the report for immediate execution using the rwservlet's scheduling facility. Again, this came to me via my DBA. The TAR for this piece is Note:295420.1. Ignore the rwservlet urlparameter= part as best I can tell it's gibberish. Below is what I did. Substitute your info for the stuff in UPPER CASE and put it all on one contiguous line of course:
    http://SERVER:PORT/PATH/rwservlet
    ?server=REPORT_SERVER_NAME
    &destype=file
    &desname=A_PATH_AND_FILE_FILE_NAME_WITH_EXTENSION
    &jobtype=rwurl
    &schedule=
    &urlparameter=http://SERVER:PORT/PATH/JSP_NAME?userid=USERID&OTHER_PARAMETERS...
    I am not sure why cmdkey= fails when passed in the urlparameter= but I am working on a solution!

Maybe you are looking for