SQL query automation and output to text file

The bcp utility should handle this task pretty easily for you. The documentation is available here.

I know enough SQL to get me by with the few things I currently do in it (but would always like to know and do more).  Anyway, I was just recently asked if I could come up with a way to automate the execution of a SQL query we currently manually run, and then have the results of that query output (instead of to the screen in SSMS) to a text file with the ".dat" extension.  I've never automated a SQL query before nor have I had the results output to a file.  Can anyone give me some pointers on how to tackle this?
The query currently calls to a stored procedure (which does all the work) and just executes it with some given dates from the query so I'm thinking the output will need to come from the stored procedure (and the code for output to a file added there?)
This topic first appeared in the Spiceworks Community

Similar Messages

  • How to list the contents of an OSX directory, and output to text file?

    hello there any hints with any known program that does following
    I have recorded my music directory to DVD and now i would like to make an .txt file what the dvd contains...cos its way of hand to write all 100xx files by hand...
    How to list the contents of an OSX directory, and output to text file?
    any prog that does that? any hints?
    best regards

    This script makes a hierarchical file listing all files in a folder and subfolder:
    Click here to launch Script Editor.
    choose folder with prompt "Choose a folder to process..." returning theFolder
    set theName to name of (info for theFolder)
    set thepath to quoted form of POSIX path of theFolder
    set currentIndex to theFolder as string
    do shell script "ls -R " & thepath returning theDir
    set theDirList to every paragraph of theDir
    set newList to {"Contents of folder \"" & theName & "\"" & return & thepath & return & return}
    set theFilePrefix to ""
    repeat with i from 1 to count of theDirList
    set theLine to item i of theDirList
    set my text item delimiters to "/"
    set theMarker to count of text items of thepath
    set theCount to count of text items of theLine
    set currentFolder to text item -1 of theLine
    set theFolderPrefix to ""
    if theCount is greater than theMarker then
    set theNestIndex to theCount - theMarker
    set theTally to -1
    set theFilePrefix to ""
    set theSuffix to ""
    repeat theNestIndex times
    set theFolderPrefix to theFolderPrefix & tab
    set theFilePrefix to theFilePrefix & tab
    if theTally is -1 then
    set theSuffix to text item theTally of theLine & theSuffix
    else
    set theSuffix to text item theTally of theLine & ":" & theSuffix
    end if
    set currentIndex to "" & theFolder & theSuffix
    set theTally to theTally - 1
    end repeat
    end if
    set my text item delimiters to ""
    if theLine is not "" then
    if word 1 of theLine is "Volumes" then
    set end of newList to theFolderPrefix & "Folder: > " & currentFolder & return
    else
    try
    if not folder of (info for alias (currentIndex & theLine & ":")) then
    set end of newList to theFilePrefix & tab & tab & tab & "> " & theLine & return
    end if
    end try
    end if
    end if
    end repeat
    open for access file ((path to desktop as string) & "Contents of folder- " & theName & ".txt") ¬
    with write permission returning theFile
    write (newList as string) to theFile
    close access theFile

  • Query SQL and output to text file then loop through list to execute

    It seems there's no obvious way to do what I want to below as everyone has their own take on querying SQL server with Powershell!
    I need to use PowerShell to connect to ServerA and query a test database and select Name from it.  The Name results of that query need to output to C:\names.txt and then I need a ForEach loop to go through that file line by line and execute some text
    against each Name from the list.
    Any ideas how I can achieve this?
    Thanks!

    I can't even output SQl to a table at the moment, the text file has a column header and about 50 empty rows in the file.
    $dataSource = "DEMO"
    $database = "TESTDB"
    $connectionString = "Server=$dataSource;uid=$user; pwd=$pwd;Database=$database;Integrated Security=True;"
    $query = "SELECT name FROM dbo.names"
    $connection = New-Object System.Data.SqlClient.SqlConnection
    $connection.ConnectionString = $connectionString
    $connection.Open()
    $command = $connection.CreateCommand()
    $command.CommandText  = $query
    $result = $command.ExecuteReader()
    $table = new-object "System.Data.DataTable"
    $table.Load($result)
    $format = @{Expression={$_.Id};Label="Name";width=25}
    $table | format-table $format | Out-File C:\export\servers.txt
    $connection.Close()

  • How to get sql query data and write into csv file?

    I am writing to seek help, in how can I create bat. script which can execute the following logic:
    connection to the database
    run sql query
    create CSV file
    output query data, into CSV file
    save the CSV file
    osql
    -S 84.18.111.111
    -U adw
    -P rem
    -i "c:\query.sql"
    send ""
    sed -e 's/,\s\+/,/g' MCI_04Dec2014.csv > localNoSpaces.csv
    -o "c:\MCI_04Dec2014.csv"
    This what i have so far, and I am little struggling with the logic after creating CSV file. I am unable to get the above script to work, please advice further, where I may be going wrong. 
    Can you create if statement logic within window's script, to check for null parameters or data feeds?
    Any hints would be most appreciated. 

    Thank you for your reply. 
    Apology for posting the code irrelevant to the forum, as I am still novice scripting user.  
    My goal is to create window's script which can compute the above logic and send the final output file (csv), to FTP folder. 
    Can this logic be implemented via bat. script, if so, is there a example or tutorial i could follow, in order to achieve my task. 
    Any help would be much appreciated. 

  • How to generate complete file list of hard drive and output to text file

    I need to start backing things up to drives, which over time will be put in storage.
    I would like to be able to create a complete file index and folder tree of every drive and have it output to a text file so that in the event I ever need to go back to a drive, I can search the text file to know what drive to pull from storage (rather than using spotlight to search through 25 drives).
    Is there any way to do this with either OS X or with a third party software? Ideally, text file and not PDF.
    Thanks!

    You can use the terminal.app with the following command:
    rsync -rlptn --stats --progress +Source.. Destination..+
    example with actual output:
    rsync -rlptn --stats --progress /Volumes/Mac\ Data/websites /Volumes/EXT\ SATA2building file list ...
    146 files to consider
    websites/
    websites/.DS_Store
    websites/bestelectricbill.com/
    websites/bestelectricbill.com/.DS_Store
    websites/bestelectricbill.com/211299c1
    websites/bestelectricbill.com/awards.php
    websites/bestelectricbill.com/careers.php
    websites/bestelectricbill.com/category1.php
    websites/bestelectricbill.com/category2.php
    websites/bestelectricbill.com/category3.php
    websites/bestelectricbill.com/checkout.php
    websites/bestelectricbill.com/company.php
    websites/bestelectricbill.com/contactus.php
    websites/bestelectricbill.com/email.js
    websites/bestelectricbill.com/faqs.php
    websites/bestelectricbill.com/fsp.js
    websites/bestelectricbill.com/history.php
    websites/bestelectricbill.com/index.php
    websites/bestelectricbill.com/index_copy.php
    websites/bestelectricbill.com/investors.php
    websites/bestelectricbill.com/job1.php
    websites/bestelectricbill.com/job2.php
    websites/bestelectricbill.com/job3.php
    websites/bestelectricbill.com/job4.php
    websites/bestelectricbill.com/job5.php
    websites/bestelectricbill.com/managementteam.php
    websites/bestelectricbill.com/news1.php
    websites/bestelectricbill.com/news2.php
    websites/bestelectricbill.com/news3.php
    websites/bestelectricbill.com/news4.php
    websites/bestelectricbill.com/news5.php
    websites/bestelectricbill.com/newsandevents.php
    websites/bestelectricbill.com/partners.php
    websites/bestelectricbill.com/press.php
    websites/bestelectricbill.com/privacypolicy.php
    websites/bestelectricbill.com/product1a.php
    websites/bestelectricbill.com/product1a1.php
    websites/bestelectricbill.com/product1a2.php
    websites/bestelectricbill.com/product1b.php
    websites/bestelectricbill.com/product1b1.php
    websites/bestelectricbill.com/product1b2.php
    websites/bestelectricbill.com/product1c.php
    websites/bestelectricbill.com/product1c1.php
    websites/bestelectricbill.com/product1c2.php
    websites/bestelectricbill.com/product1d.php
    websites/bestelectricbill.com/product1d1.php
    websites/bestelectricbill.com/product1d2.php
    websites/bestelectricbill.com/product1e.php
    websites/bestelectricbill.com/product1e1.php
    websites/bestelectricbill.com/product1e2.php
    websites/bestelectricbill.com/products.php
    websites/bestelectricbill.com/productsearch.php
    websites/bestelectricbill.com/registration.php
    websites/bestelectricbill.com/search.php
    websites/bestelectricbill.com/searchresults.php
    websites/bestelectricbill.com/service1.php
    websites/bestelectricbill.com/service1a.php
    websites/bestelectricbill.com/service1a1.php
    websites/bestelectricbill.com/service1a2.php
    websites/bestelectricbill.com/service1b.php
    websites/bestelectricbill.com/service1b1.php
    websites/bestelectricbill.com/service1b2.php
    websites/bestelectricbill.com/service1c.php
    websites/bestelectricbill.com/service1c1.php
    websites/bestelectricbill.com/service1c2.php
    websites/bestelectricbill.com/service1d.php
    websites/bestelectricbill.com/service1d1.php
    websites/bestelectricbill.com/service1d2.php
    websites/bestelectricbill.com/service1e.php
    websites/bestelectricbill.com/service1e1.php
    websites/bestelectricbill.com/service1e2.php
    websites/bestelectricbill.com/service2.php
    websites/bestelectricbill.com/service3.php
    websites/bestelectricbill.com/services.php
    websites/bestelectricbill.com/shoppingcart.php
    websites/bestelectricbill.com/sitemap.php
    websites/bestelectricbill.com/story1.php
    websites/bestelectricbill.com/story2.php
    websites/bestelectricbill.com/story3.php
    websites/bestelectricbill.com/termsofuse.php
    websites/bestelectricbill.com/Templates/
    websites/bestelectricbill.com/Templates/siteassist_config.cfg
    websites/bestelectricbill.com/Templates/siteassist_template.dwt.php
    websites/bestelectricbill.com/Templates/_notes/
    websites/bestelectricbill.com/Templates/_notes/dwsync.xml
    websites/bestelectricbill.com/_notes/
    websites/bestelectricbill.com/_notes/dwsync.xml
    websites/bestelectricbill.com/images/
    websites/bestelectricbill.com/images/.DS_Store
    websites/bestelectricbill.com/images/app_img17.jpg
    websites/bestelectricbill.com/images/bestelectriclogo.jpg
    websites/bestelectricbill.com/images/bestelectriclogo.jpg.ori.jpg
    websites/bestelectricbill.com/images/btn_saveBusiness.jpg
    websites/bestelectricbill.com/images/btn_saveHome.jpg
    websites/bestelectricbill.com/images/imgAbout_OverviewTeam copy.jpg
    websites/bestelectricbill.com/images/imgCollage.jpg
    websites/bestelectricbill.com/images/imgComp1.jpg
    websites/bestelectricbill.com/images/imgComp3.jpg
    websites/bestelectricbill.com/images/imgComp4.jpg
    websites/bestelectricbill.com/images/imgComp5.jpg
    websites/bestelectricbill.com/images/imgComp6.jpg
    websites/bestelectricbill.com/images/imgComp7.jpg
    websites/bestelectricbill.com/images/imgComp8.jpg
    websites/bestelectricbill.com/images/phone number.jpg
    websites/bestelectricbill.com/images/phone number2.jpg
    websites/bestelectricbill.com/images/_notes/
    websites/bestelectricbill.com/images/_notes/dwsync.xml
    websites/bestelectricbill.com/siteassist_css/
    websites/bestelectricbill.com/siteassist_css/color.css
    websites/bestelectricbill.com/siteassistcss/mystyles.css
    websites/bestelectricbill.com/siteassist_css/navigation.css
    websites/bestelectricbill.com/siteassistcss/navigationcolor.css
    websites/bestelectricbill.com/siteassist_css/style.css
    websites/bestelectricbill.com/siteassist_css/template.css
    websites/bestelectricbill.com/siteassistcss/notes/
    websites/bestelectricbill.com/siteassistcss/notes/dwsync.xml
    websites/bestelectricbill.com/siteassist_images/
    websites/bestelectricbill.com/siteassistimages/above_topnavbackground.jpg
    websites/bestelectricbill.com/siteassistimages/below_topnavbackground.jpg
    websites/bestelectricbill.com/siteassist_images/border.gif
    websites/bestelectricbill.com/siteassistimages/bottombackground.jpg
    websites/bestelectricbill.com/siteassistimages/brcorner.jpg
    websites/bestelectricbill.com/siteassist_images/bubbles.jpg
    websites/bestelectricbill.com/siteassistimages/dottedhorizontal.jpg
    websites/bestelectricbill.com/siteassistimages/dottedvertical.jpg
    websites/bestelectricbill.com/siteassistimages/home_mainbackground.jpg
    websites/bestelectricbill.com/siteassistimages/img100x125.gif
    websites/bestelectricbill.com/siteassistimages/img160x110.gif
    websites/bestelectricbill.com/siteassistimages/img400x197.gif
    websites/bestelectricbill.com/siteassistimages/img463x170.gif
    websites/bestelectricbill.com/siteassistimages/loginbtn.gif
    websites/bestelectricbill.com/siteassistimages/logotraditional.jpg
    websites/bestelectricbill.com/siteassistimages/mainfeature.jpg
    websites/bestelectricbill.com/siteassistimages/side_navcell.gif
    websites/bestelectricbill.com/siteassistimages/side_nav_cellsel.gif
    websites/bestelectricbill.com/siteassistimages/side_nav_opengrad.gif
    websites/bestelectricbill.com/siteassistimages/side_nav_open_selgrad.gif
    websites/bestelectricbill.com/siteassistimages/sidenavbackground.jpg
    websites/bestelectricbill.com/siteassist_images/spacer.gif
    websites/bestelectricbill.com/siteassistimages/topbackground.jpg
    websites/bestelectricbill.com/siteassistimages/topnavbackground.jpg
    websites/bestelectricbill.com/siteassistimages/topnav_cellbg.gif
    websites/bestelectricbill.com/siteassistimages/topnav_cell_bghover.gif
    websites/bestelectricbill.com/siteassistimages/trcorner.jpg
    websites/bestelectricbill.com/siteassistimages/notes/
    websites/bestelectricbill.com/siteassistimages/notes/dwsync.xml
    Number of files: 146
    Number of files transferred: 135
    Total file size: 1150921 bytes
    Total transferred file size: 1150921 bytes
    Literal data: 0 bytes
    Matched data: 0 bytes
    File list size: 2825
    File list generation time: 0.001 seconds
    File list transfer time: 0.000 seconds
    Total bytes sent: 3717
    Total bytes received: 896
    sent 3717 bytes received 896 bytes 9226.00 bytes/sec
    total size is 1150921 speedup is 249.50
    Simply copy and and paste output text in terminal to a text file.
    What I actually did there was use the "dry run option" (-n) - no files were actually transferred.
    For more info on the rsync command type and run "man rsync" at the terminal command line.
    Also see this webpage:
    http://www.ss64.com/osx/rsync.html
    Kj

  • How to load date and time from text file to oracle table through sqlloader

    hi friends
    i need you to show me what i miss to load date and time from text file to oracle table through sqlloader
    this is my data in this path (c:\external\my_data.txt)
    7369,SMITH,17-NOV-81,09:14:04,CLERK,20
    7499,ALLEN,01-MAY-81,17:06:08,SALESMAN,30
    7521,WARD,09-JUN-81,17:06:30,SALESMAN,30
    7566,JONES,02-APR-81,09:24:10,MANAGER,20
    7654,MARTIN,28-SEP-81,17:24:10,SALESMAN,30my table in database emp2
    create table emp2 (empno number,
                      ename varchar2(20),
                      hiredate date,
                      etime date,
                      ejob varchar2(20),
                      deptno number);the control file code in this path (c:\external\ctrl.ctl)
    load data
    infile 'C:\external\my_data.txt'
    into table emp2
    fields terminated by ','
    (empno, ename, hiredate, etime, ejob, deptno)this is the error :
    C:\>sqlldr scott/tiger control=C:\external\ctrl.ctl
    SQL*Loader: Release 10.2.0.1.0 - Production on Mon May 31 09:45:10 2010
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Commit point reached - logical record count 5
    C:\>any help i greatly appreciated
    thanks
    Edited by: user10947262 on May 31, 2010 9:47 AM

    load data
    infile 'C:\external\my_data.txt'
    into table emp2
    fields terminated by ','
    (empno, ename, hiredate, etime, ejob, deptno)Try
    load data
    infile 'C:\external\my_data.txt'
    into table emp2
    fields terminated by ','
    (empno, ename, hiredate, etime "to_date(:etime,'hh24:mi:ss')", ejob, deptno)
    this is the error :
    C:\>sqlldr scott/tiger control=C:\external\ctrl.ctl
    SQL*Loader: Release 10.2.0.1.0 - Production on Mon May 31 09:45:10 2010
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Commit point reached - logical record count 5
    C:\>
    That's not an error, you can see errors within log and bad files.

  • Output in text file

    Hi
    I have two master & detailed table for eg emp,dept.
    I need my output in text file with delimiter ~ in the below format.
    10~accounting~newyork
    7782~CLARK~MANAGER~7839~6/9/1981~2450.00~10
    7839~KING~PRESIDENT~11/17/1981~5000.00~10
    7934~MILLER~CLERK~7782~1/23/1982~1300.00~10Rgds
    Vk

    well, go for it! Don't let us stop you ;)
    SQL> set colsep '~'
    SQL> select *
      2    from emp
      3  /
         EMPNO~ENAME     ~JOB      ~       MGR~HIREDATE ~       SAL~      COMM~    DEPTNO
    ----------~----------~---------~----------~---------~----------~----------~----------
          7369~SMITH     ~CLERK    ~      7902~17-DEC-80~       800~          ~        20
          7499~ALLEN     ~SALESMAN ~      7698~20-FEB-81~      1600~       300~        30
          7521~WARD      ~SALESMAN ~      7698~22-FEB-81~      1250~       500~        30
          7566~JONES     ~MANAGER  ~      7839~02-APR-81~      2975~          ~        20
          7654~MARTIN    ~SALESMAN ~      7698~28-SEP-81~      1250~      1400~        30
          7698~BLAKE     ~MANAGER  ~      7839~01-MAY-81~      2850~          ~        30
          7782~CLARK     ~MANAGER  ~      7934~09-JUN-81~      2450~          ~        10
          7788~SCOTT     ~ANALYST  ~      7566~19-APR-87~      3000~          ~        20
          7839~KING      ~PRESIDENT~          ~17-NOV-81~      5000~          ~        10
          7844~TURNER    ~SALESMAN ~      7698~08-SEP-81~      1500~         0~        30
          7876~ADAMS     ~CLERK    ~      7788~23-MAY-87~      1100~          ~        20
          7900~JAMES     ~CLERK    ~      7698~03-DEC-81~       950~          ~        30
          7902~FORD      ~ANALYST  ~      7566~03-DEC-81~      3000~          ~        20
          7934~MILLER    ~CLERK    ~      7782~23-JAN-82~      1300~          ~        10
    14 rows selected.

  • Converting Excel Output to Text File (Text(MS-DOS)) in oracle 6i

    I have been able to save Excel Output to Text File (.txt) using OLE. However, I need to save it as TEXT(MS-DOS) specifically due to certain formatting issues.
    Kindly suggest some solution.
    I need it very urgently.
    Thanks!

    Hello Sandy,
    does this mean that you created an Excel file using OLE and named it *.txt?
    And what do you mean by saving as TEXT(MS-DOS)? A csv file?
    Regards
    Marcus

  • How to add header and fooder in text file

    Hi,
    i have created simple application for generate report from database into text file.
    But i need to add header and fooder in text file. I dont know is there any API for adding these.
    Can anyone help me to create header and fooder in text file.
    the below text are needs to be print in the header
    name of the table :
    Recorder type :
    file creation time:
    the below text are needs to be print in the footer
    Recorder Number:
    Record Type;
    the actual code is
                           pst = con.prepareStatement("select REQUEST, DOMAIN_NAME, TRUNC(DATE_OF_CONFIGURATION) AS dateofConfig  FROM employee where id=300");
                               rs = pst.executeQuery();
                            while (rs.next()) {
                                 request = rs.getString("REQUEST");
                                    domain_name = rs.getString("DOMAIN_NAME");
                                    dateofconfig = rs.getString("dateofConfig");
                                    System.out.println(request + " " + domain_name + " " + dateofconfig);
                                   data.add(request + " " + domain_name + " " + dateofconfig);
                            System.out.println("before calling method");
                            writeToFile(data, "c:/Employee.txt");
                            System.out.println("file created successfull");
                            rs.close();
                            pst.close();
           private static void writeToFile(List list, String path) {
                    BufferedWriter out = null;
                    try {
                            File file = new File(path);
                            out = new BufferedWriter(new FileWriter(file, true));
                            for (Object obj : list) {
                                String s=  obj.toString(); 
                                 out.write(s);
                                    out.newLine();
                            out.close();
                    } catch (IOException e) {
    }Thanks
    Jasmin
    Edited by: user13836688 on Mar 21, 2011 4:06 AM
    Edited by: user13836688 on Mar 21, 2011 4:07 AM
    Edited by: user13836688 on Mar 21, 2011 4:08 AM

    user13836688 wrote:
    i have created simple application for generate report from database into text file.First off, when posting code, use &#91;code]...&#91;/code]. or '' tags, not '<code>'.
    But i need to add header and fooder in text file. I dont know is there any API for adding these.
    Can anyone help me to create header and fooder in text file.Well you plainly have the code to write the file contents; and furthermore your report seems to be contained in a List called 'data'. Why not just add the header and footer lines to it? I'd also suggest making 'data' a LinkedList. That way you can add the header afterwards with no performance hit, just in case the information it contains isn't available at the start of your report loop.
    Winston                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • End the result of an sql query by Email as an excel file attachement

    Hi,
    I would like to create a PL/SQL function that send the result of an sql query by Email as an excel file attachement.
    i'm newbie in pl/sql an d i dont know if it's possible to do such task.
    regards,

    i think a regular expression is he way to go in your case...
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com

  • ALE, IDOC - need to send IDOC and create a text file

    Hi,
    i need to send idoc to some other system and create a text file in that.
    I want sent data to Channel Cluster.
    what are the settings required for that in transactions
    BD54
    SCC4
    SM59 - which connection is required
    WE21 - which type of port
    WE20 - which partner
    BD64
    Is there any other function modules required.
    which function module is suitable like MASTER_IDOC_DISTRIBUTE.

    Hi,
    SM59 - Use TCP/IP Connection with connection type 'T'
    WE20 - Partner Name can be logical system name, if it is a vendor/customer you can configure it under the respective names.
    Thanks
    Krithika

  • "How Display and Output Acq'd File.VI works?"

    "My present project is somewhat similar to Display and Output Acq'd File.vi. But I don't clearly know how it works. My questions are:
    1. What will happen if the data-reading from file is faster than output-generation from buffered data?
    2. How does it match pace of reading and that of generation, and in which vi does the matching achieve?
    3. Is it possible to get these control information, like interrupt or DMA status in labview application?
    Thank you for your help
    Steven"

    I attached a bmp that illustrates how to read and write simultaneously from one file. The VI is using notifiers (under the advanced palette) to synchronize reader and writer loops.
    Note that the Wait function in the reader loop is irrelevant because the Wait on Notifier function blocks until data is available. This forces reader to be at least as slow as writer.
    Attachments:
    read_and_write.bmp ‏1014 KB

  • Automator - Loop through a text file and process data through a 3rd party software

    Just stumbled on Automator the other day (I am a mac n00b) and would like to automate the processing of a text file, line-by-line, using a third party tool.  I would like Automator to loop through the text file one line at a time, copy the string and keep as a variable.  Next, place the variable data (copied string) into the text field of the 3rd party software for processing.  Once the processing is complete, I would like Automator to fetch the next line/string for processing.  I see items like "copy from clipboard" and  "variables" within the menu but I am not finding much documentation on how to utilizle this tool.  Just hear how potentially powerful it is. 
    The 3rd party software is not a brand name, just something made for me to process text.  I may have to use mouse clicks or tabs + [return] to navigate with Automator.  A term I heard on Bn Walldie's itunes video series was "scriptable software" for which I don't think this 3rd party app would be. 
    Kind regards,
    jw

    Good news and bad news...
    The good news is that it should be entirely possible to automate your workflow.
    The bad news is that it will be a nightmare to implement via Automator, if it's even possible.
    Automator is, essentially a pretty interface on top of AppleScript/Apple Events, and with the pretty interface comes a certain stranglehold on features. Knowing how to boil rice might make you a cook, but understanding flavor profiles and ingredient combinations can make you a chef, and it's the same with AppleScript and Automator. Automator's good at getting you from points A to B but if there are any bumps in the road (e.g. the application you're using isn't scriptable) then it falls apart.
    What I'm getting at is that your requirements are pretty simple to implement in AppleScript because you can get 'under the hood' and do exactly what you want, as opposed to Automator's restricted interface.
    The tricky part is that if no one else can see this app it's going to be hard to tell you what to do.
    I can give you the basics on reading a file and iterating through the lines of text in it, and I can show you how to 'type' text in any given application, but it may be up to you to put the pieces together.
    Here's one way of reading a file and working through each line of text:
    -- ask the user for a file:
    set theFile to (choose file)
    -- read the file contents:
    set theFileContents to (read file theFile)
    -- break out the lines/paragraphs of text:
    set theLines to paragraphs of theFileContents
    -- now iterate through those lines, one by one:
    repeat with eachLine in theLines
      -- code to perform for eachLine goes here
    end repeat
    Once you have a line of text (eachLine in the above example) you can 'type' that into another application via something like:
    tell application "AppName" to activate
    tell application "System Events"
              tell process "AppName"
      keystroke eachLine
              end tell
    end tell
    Here the AppleScript is activating the application and using System Events to emulate typing the contents of the eachLine variable into the process. Put this inside your repeat loop and you're almost there.

  • Create and write form output to text file

    HI am pretty new to this and have a prob.
    I have 10 fields in my form submitting which i need to create and write the form field values into an xml fil..this file is further used for other read write transactions.
    Can somebody help creating and writing data into the text file with code (if u have it handy).
    Thanks for the help in anticipation

    File f = new File("/path/to/output.txt");
    BufferedWriter bw = new BufferedWriter(new FileWriter(f));
    String inputData = null;
    while(true){
      inputData = //whatever data you need
      bw.write(inputData);
    bw.flush();
    bw.close();
    f.close;
    // All this should be in a try{}catch(IOException ioe){}

  • Spooling queries output to text file

    Hi All,
    I need help to spool the output to a text file for a sequence of queries that I need to execute.
    Lets say, the queries would in a sql file as follows:
    Select * from emp where empId = 1
    Select * from emp where empId = 2
    Select * from emp where empId = 3
    The output in txt file should have the details as
    Employee Id Employee Name Employee Designation
    1 Alex Manager
    2 Conrad Sr Manager
    3 Herman Technical architect.
    I am trying to execute this from sql developer.
    Any pointers in this regard would be highly helpful.

    Hi,
    Welcome to the forum!
    Why not use just one query
    SELECT       *
    FROM       enp
    WHERE       empid     IN (1, 2, 3)
    ORDER BY  empid
    You can use "SPOOL filename APPEND" to re-open and add to an existing spool file after it has been closed, but there's no need to in this case.

Maybe you are looking for

  • Itunes won't open...error 2206..tried many time to uninstall and to install...any help?

    Itunes won't open...error 2206 I have tried to uninstall and to reinstall...still won't open. Any suggestions so i can use my itunes library again?

  • I need a description of the guides in INdesign

    I have my A5 document open, and have specified a 3mm bleed for printing.  I have worked out that this bleed line is the reddish one on the extreme outside of the sheet, but the next one in confuses me. It is the one that seems to be a purple/pink col

  • How to get back all lost photos after updating the iOS8?

    When I updated my IOS8 I thought I lost my photos, so I have restored my iPhone but after restoring I have discovered that I lost all my photos, please advise how can get/ retrieve all the lost photos specially since I didn't do backup?

  • Mouse pad Freezes

    I bought the HP probook G1 450 less than a year ago, and i have a problem with the mouse pad , as it sometimes freeze (only moving really slowly but in one line , doesn't go up or down). i read online some ppl have had the same issue with windows 8.1

  • About trim() for String

    I am doing assignment to deal with the xml code,for every line I read by BufferedReader I have to trim() it,I mean to take away all the white space in this line before I do something with the xml code.but I cannot make it right.the "trim()" seems doe