Writing OS Script to use at file CC.

Hi ,
I have a Requirement in which i have to write a script and use the script as OS command in sender file adapter.
Requirement --
When ever the communication channel read a file from directories at FTP server delete that file and paste that file in different folder at FTP server.
I have no knowledge with OS script . My server is running on Microsoft server 2008.
Please let me know how to write a script and where to place the file in XI server.
Regards,
Navneet

Hello,
Please find info about using OS command in File Adapter in links below:
/people/santhosh.kumarv/blog/2008/07/27/glimpse-at-os-command-yet-another-scenario
/people/michal.krawczyk2/blog/2007/02/08/xipi-command-line-sample-functions
http://wiki.sdn.sap.com/wiki/display/XI/SAPXIFileAdapterOSCommandLine+Feature
/people/sameer.shadab/blog/2005/09/21/executing-unix-shell-script-using-operating-system-command-in-xi
What concerns path for Script i usually use /usr/sap/bin/ but i think that you can choose any available path on your PI server.
BR,
Dzmitry

Similar Messages

  • Need help writing a script to traverse through files in a directory

    I want to go through a directory and sub directories and convert files into jpg ones
    I have this code I've been using: mkdir jpegs; sips -s format jpeg *.png --out jpegs
    This is great for one directory at a time
    But, what I want is to apply this to all sub directories, create a jpeg directory in each of the sub directories and then create jpg's and put them in there
    I'm not sure where to start
    Should I be looking for 'scripting in linux'?
    Thanks
    Omar

    Hello
    You may also try something like this. Set DIR to the root directory to start the search.
    #!/bin/bash
    #     convert png to jpeg and put jpeg in jpegs sub-directory
    DIR=~/Desktop/test
    while read -d $'\0' f
    do
        d=${f%/*}/jpegs
        [[ -d "$d" ]] || mkdir "$d"
        sips -s format jpeg "$f" --out "$d"
    done < <(find "$DIR" -type f -iname '*.png' -print0)
    In case, here's an AppleScript wrapper:
    set f to (choose folder with prompt "Choose root folder to process")'s POSIX path
    if f ends with "/" then set f to f's text 1 thru -2
    do shell script "/bin/bash -s <<'EOF' -- " & f's quoted form & "
    #     convert png to jpeg and put jpeg in jpegs sub-directory
    DIR=\"$1\"
    while read -d $'\\0' f
    do
        d=${f%/*}/jpegs
        [[ -d \"$d\" ]] || mkdir \"$d\"
        sips -s format jpeg \"$f\" --out \"$d\"
    done < <(find \"$DIR\" -type f -iname '*.png' -print0)
    EOF"
    Regards,
    H

  • Writing several / multiple columns in a *.lvm file using write file option

    Hello All,
    I am doing several measurements and till now writing all the measurement in individual files thereby I am forced to use an external program to merge the files into one file of several columns.
    Is there a possibility to write a *.lvm file (or some other possibility say a *.txt file but no excel) with multiple columns where each column stands for a particular data?
    I am attaching a simple example where I have 4 different measurements (simulated using a regulator(I dont know how I can say this vi in english)??) which I am converting into array and trying to write them in a file of *.lvm extension. But the output is still a single column where every measurement is taking a different row which I dont want.
    Thanks in advance.
    Jan
    Attachments:
    Unbenannt 1.vi ‏97 KB

    Instead of using the Build Array, just wire your scalars to the Merge Signals function. This will create 4 separate signals that will be written in 4 separate columns. With the existing 1D array, you could also use the Write to Spreadsheet File instead of Write to Measurement File.

  • Script to export Security file using maxl script

    can anyone provide me the Script to export Security file using maxl script.It should create a log file and a batch file should also be there to schedule the Maxl script.Please help me with this

    Hi,
    You can use something like
    [b]login admin password on localhost;
    [b]spool on to 'c:\temp\log.txt';
    [b]export security_file to data_file C:\temp\sec_file.txt;
    [b]spool off;
    [b]logout;
    Then you can have a batch file that just calls the maxl script
    essmsh name_of_maxl_script.mxl
    The batch script can then be scheduled.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Script Help - Working with Files - Reading/Writing

    Hey Folks,
    I need help build a script that will read a text string from a specific .INI file, and then write that string to a file along with the name of the computer where the string originated from.
    I plan on deploying this script to our targeted workstations with SCCM 12, so it does not need recursive abilities. We want each of the machines which run the script to write their data to a single file with a date stamp as part of the name. The data written
    needs to include the unique string which follows this format "devicename=DJ########", along with the computer's name. The device name which needs to be extracted starts with DJ and is followed by an 8 digit number. It would be better if we could
    use export-csv than out-file. 
    This is what my very inexperienced self came up with so far:
    get-content 'C:\users\Public\Something\myfile.ini' | Select-String devicename=dj | out-file
    \\server\folder\data.txt -append
    I
    found this bit of code which should allow me to set the file name to a date, but I am unsure exactly how to implement this:
    $enddate = (Get-Date).tostring("yyyyMMdd")
    $filename = 'C:\Documents and Settings\User\Desktop\' + $enddate + '_VMReport.doc'
    $filename
    The developer of a core piece of software requires all computers have a unique ID, but provides absolutely no tools or guidance for tracking this crucial information. Any input you can provide will be greatly appreciated!
    Please help us fix this nightmare! Thank you in advance!

    I am trying to add a step where the script grabs a list of all domain workstations and saves it to a file. This file is then used as the input for the rest of the script. There is a problem with the way the computers names are imported using this method.
    Here is the script:
    # Rename the existing DJNumbers.csv to yesterday's date
    $date = (Get-Date).AddDays(-1)
    Rename-Item -Path '\\Server\Library\DJs\DJnumbers.csv' -NewName ("DJNumbers_{0}.csv" -f (Get-Date $date -Format yyyy-MM-dd))
    #Save a list of all current AD computers
    Get-ADComputer -Filter * | select name | Out-File \\Server\C$\DJs\complist.csv
    #Extract the DJ number for every computer in complist.csv
    Get-Content '\\Server\C$\DJs\complist.csv' |
    ForEach-Object {
    $devicename=get-content "\\$_\C$\Users\Public\myfile.ini" | Select-String devicename=
    $djnumber=$devicename -replace "devicename=","`t"
    $prize=$_ += $djnumber
    $prize | Out-File \\Server\Library\DJs\DJnumbers.csv -Append
    The problem is that the computer names include a ton of blank spaces if I use Out-File in the line:
    #Save a list of all current AD computers
    Get-ADComputer -Filter * | select name | Out-File \\Server\C$\DJs\complist.csv
    Error looks like this:
    get-content : Cannot find path '\\CM112233
    \C$\Users\Public\Software\myfile.ini' because it does
    not exist.
    At line:11 char:13
    + $devicename=get-content "\\$_\C$\Users\Public\Software\...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (\\CM112233 ...ction\myfile.ini:String) [Get-Content], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand
    If I use Export-Csv, it puts ""'s around the computer names and that breaks it as well.
    #Save a list of all current AD computers
    Get-ADComputer -Filter * | select name | Export-Csv \\Server\C$\DJs\complist.csv
    This is the error:
    get-content : Illegal characters in path.
    At line:11 char:13
    + $devicename=get-content "\\$_\C$\Users\Public\Software\ ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (\\"CM112233"\C$\U...are\myfile.ini:String) [Get-Content], ArgumentException
    + FullyQualifiedErrorId : ItemExistsArgumentError,Microsoft.PowerShell.Commands.GetContentCommand

  • I am writing an interactive book and want to use media files and stuff.

    I am writing an interactive book and want to use media files and stuff. My question is: If I want to sell this book in the iBookstore,
    may I use photos I find on google images and media i find on youtube? Or must all be my own stuff?

    No !  well not just any photo image or "media". The person who created the photo images has a copyright protection IF  he/she wishes to impose it - ditto video and other  media.
    However if its out of copyright by  virtue of age and certain other factors - its considered in "The Public Domain" which is why you see paintings by the Impressionists all over chocolate boxes and posters to name but two!
    There are websites offering images donated by the creators and all for free.
    Taking and using a picture you do not own copyright and placing online where it can be downloaded is  first "publishing" and you  need permission and placing in a situation where it can be copied and re-distributed is a breach of copyright.
    Look at the  tail end credits on any DVD...  the above is always  included.
    Others rmay  correct me but Copyright in some countries is vaild from creation until 50 years after the death of the creator. However, that is not always the case.  Example, assume I am bequeathed a photo archive and on the  last day year 50,  I  publish a completely new version of the archive, wizzed through Photoshop, cleaned, cropped and modified in other ways.. then I can assert my claim for copyright of the renewed archive, but its a bit more complicated!!!
    You can search for "Free Photo Images (  media) , or royalty free images and if you land on a particular website you can ask permission. If you send me a request, my reply will be NO... and you get a warning of dire consequences if your infringe my copyright!  Other may be more lenient and in fact feel pretty good to be  asked.
    A way to get some guidance is to check out Wikipedia and the many  images included in its subject matter, check out the copyright status.
    Beware of using  photo images of paintings in  Galleries and Museums, they may have copyright conditions.. but one can always contact them to seek  permission.
    Search  for  Copyright and ownership and it should bring up some good information. Depending on your country.. it may have its own  Copyright website. USA are more detailed than most, The UK has the 1988 Copyright Act.
    Also remember that all photo images carry exif embedded data which  among other things carries the copyright information and shows up in a google search for the right  keyword!  Scanned images processed through Photoshop and other editors  can have the metatdata added also.

  • Writing agents o/p to external file and if i run the agent again it should

    Hi All,
    i want to run a agent and that result should be displayed in external file system.and i achieved this by using writing VB script and in agents i used actions in that we have invoke server script.And i got the perfect output but what 's my scenario is when i run the agnent again it should create another file with below requirements.
    The file name must contain a suffix containing the date in yyyymmdd format. In cases where the file stored more than once per day, a sequence number must also be provided within the filename.
    (i.e. v1_yyyymmdd, v2_yyyymmdd, v3_yyyymmdd, v4_yyyymmdd, v5_yyyymmdd…)
    And my VB script is like below
    '#####=========================================================================
    '## Title: Export Report
    '## Rev: 1.0
    '## Author: Paul McGarrick
    '## Company: Total Business Intelligence / http://total-bi.com
    '## Purpose:
    '## 1. This script takes a file from OBIEE and saves to the file system
    '## 2. Creates a reporting subdirectory if not already present
    '## 3. Creates a further subdirectory with name based on current date
    '## Inputs (specified in Actions tab of OBIEE Delivers Agent):
    '## 1. Parameter(0) - This actual file to be exported
    '## 2. Parameter(1) - The filename specified within OBIEE
    '## 3. Parameter(2) - Report sub directory name specified within OBIEE
    '#####=========================================================================
    Dim sBasePath
    sBasePath = "E:\reports\reports"
    Dim sMasterPath
    sMasterPath = sBasePath & "\" & Parameter(2)
    Dim objFSO
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    'check whether master directory exists, if not create
    Dim objMasterDir
    If Not objFSO.FolderExists(sMasterPath) Then
         Set objMasterDir = objFSO.CreateFolder(sMasterPath)
    End If
    Set objMasterDir = Nothing
    'build string to get date in yyyy-mm-dd format
    Dim sDate, sDateFull
    sDate = Now
    sDateFull = DatePart("yyyy", sDate) & "-"
    If Len(DatePart("m", sDate))=1 Then sDateFull = sDateFull & "0" End If
    sDateFull = sDateFull & DatePart("m", sDate) & "-"
    If Len(DatePart("d", sDate))=1 Then sDateFull = sDateFull & "0" End If
    sDateFull = sDateFull & DatePart("d", sDate)
    Dim sDir
    sDir = sMasterPath & "\" & sDateFull
    Dim objDir
    If Not objFSO.FolderExists(sDir) Then
         Set objDir = objFSO.CreateFolder(sDir)
    End If
    Set objDir = Nothing
    Dim sFileName
    sFileName = sDir & "\" & Parameter(1)
    Dim objFile
    objFSO.CopyFile Parameter(0), sFileName, True
    Set objFile = Nothing
    Set objFSO = Nothing
    could you please any body help me out from this....

    I assume you are using Windows. Try to write a batch file so that that would look for the ibot name when ever its finds rename the file name as required.
    This would be easiest way..
    http://lmgtfy.com/?q=rename+a+file+to+current+date+using+batch+file
    Edited by: Srini VEERAVALLI on Apr 8, 2013 7:23 AM
    Can you updates all your posts?
    Edited by: Srini VEERAVALLI on May 13, 2013 6:44 AM

  • Need a script to delete user files and run on logout.

    Hi folks!
    I'm a total Mac novice so forgive me if I'm vague on anything here. I work in a library and we have recently acquired an iMac running Mountain Lion. The unit is primarily for use by Visually Impaired users however sighted folks can use it as well.
    What I need is something that will delete any files created/downloaded by the sighted users but that will not delete anyone else's files. I tried just using the Guest Account however that also deletes all the system preferences for that account including the dock setup which I need to stay the same.
    If possible I would like this to run on logout.
    For additional points anyone who can also find me something that will run automatically when the users sign in and will sign them out after 30 minutes would super spectacularly awesome.
    Thanks people!

    That being said, if you you still really want to do this you can create a logout hook and write a shell script to remove the files.  See "About Daemons and Services", Appendix B on writing a logout hook.
    But a far easier way is to create Account's login item that will cause a shell script to be launched to delete the files.  You can encapsulate the shell script so it runs as an application that can be added to the Login Items.  One such encapsulator is Platypus.
    Note, rather than delete them, if you want to ensure all the specific plists have specific settings, then create a master set of them and copy the master set into the Preferences directory (being careful to observe ownership and permissions settings of course).

  • Problem with ArrayLists and writing and reading from a .dat file (I think)

    I'm brand new to this forum, but I'm sure hoping someone can help me with a problem I'm having with ArrayLists. This program was originally created with an array of objects that were displayed on a GUI with jtextFields, then cycling thru them via jButtons: First, Next, Previous, Last. Now I need to add the ability to modify, delete and add records. Both iterations of this program needed to write to and read from a .dat file.
    It worked just like it was suppose to when I used just the array, but now I need to use a "dynamic array" that will grow or shrink as needed: i.e. an ArrayList.
    When I aded the ArrayList I had the ArrayList use toArray() to fill my original array so I could continue to use all the methods I'd created for using with my array. Now I'm getting a nullPointerException every time I try to run my program, which means somewhere I'm NOT filling my array ???? But, I'm writing just fine to my .dat file, which is confusing me to no end!
    It's a long program, and I apologize for the length, but here it is. There are also 2 class files, a parent and 1 child below Inventory6. This was written in NetBeans IDE 5.5.1.
    Thank you in advance for any help anyone can give me!
    LabyBC
    package my.Inventory6;
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
    import java.awt.Insets;
    import java.awt.Toolkit;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.text.DecimalFormat;
    import javax.swing.JOptionPane;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JTextField;
    import java.io.*;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.lang.IllegalStateException;
    import java.util.NoSuchElementException;
    import java.util.ArrayList;
    import java.text.NumberFormat;
    // Class Inventory6
    public class Inventory6 extends javax.swing.JFrame {
    private static InventoryPlusColor[] inventory;
    private static ArrayList inList;
    // create a tool that insure the specified format for a double number, when displayed
    private DecimalFormat doubleFormat = new DecimalFormat( "0.00" );
    private DecimalFormat singleFormat = new DecimalFormat( "0");
    // the index within the array of products of the current displayed product
    private int currentProductIndex;
    /** Creates new form Inventory6 */
    public Inventory6() {
    initComponents();
    currentProductIndex = 0;
    } // end Inventory6()
    private static InventoryPlusColor[] getInventory() {
    ArrayList<InventoryPlusColor> inList = new ArrayList<InventoryPlusColor>();
    inList.add(new InventoryPlusColor(1, "Couch", 3, 1250.00, "Blue"));
    inList.add(new InventoryPlusColor(2, "Recliner", 10, 525.00, "Green"));
    inList.add(new InventoryPlusColor(3, "Chair", 6, 125.00, "Mahogany"));
    inList.add(new InventoryPlusColor(4, "Pedestal Table", 2, 4598.00, "Oak"));
    inList.add(new InventoryPlusColor(5, "Sleeper Sofa", 4, 850.00, "Yellow"));
    inList.add(new InventoryPlusColor(6, "Rocking Chair", 2, 459.00, "Tweed"));
    inList.add(new InventoryPlusColor(7, "Couch", 4, 990.00, "Red"));
    inList.add(new InventoryPlusColor(8, "Chair", 12, 54.00, "Pine"));
    inList.add(new InventoryPlusColor(9, "Ottoman", 3, 110.00, "Black"));
    inList.add(new InventoryPlusColor(10, "Chest of Drawers", 5, 598.00, "White"));
    for (int j = 0; j < inList.size(); j++)
    System.out.println(inList);
    InventoryPlusColor[] inventory = (InventoryPlusColor[]) inList.toArray
    (new InventoryPlusColor[inList.size()]);
    return inventory;
    } // end getInventory() method
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
    private void initComponents() {
    jPanel1 = new javax.swing.JPanel();
    IDNumberLbl = new javax.swing.JLabel();
    IDNumberField = new javax.swing.JTextField();
    prodNameLbl = new javax.swing.JLabel();
    prodNameField = new javax.swing.JTextField();
    colorLbl = new javax.swing.JLabel();
    colorField = new javax.swing.JTextField();
    unitsInStockLbl = new javax.swing.JLabel();
    unitsInStockField = new javax.swing.JTextField();
    unitPriceLbl = new javax.swing.JLabel();
    unitPriceField = new javax.swing.JTextField();
    invenValueLbl = new javax.swing.JLabel();
    invenValueField = new javax.swing.JTextField();
    restockingFeeLbl = new javax.swing.JLabel();
    restockingFeeField = new javax.swing.JTextField();
    jbtFirst = new javax.swing.JButton();
    jbtNext = new javax.swing.JButton();
    jbtPrevious = new javax.swing.JButton();
    jbtLast = new javax.swing.JButton();
    jbtAdd = new javax.swing.JButton();
    jbtDelete = new javax.swing.JButton();
    jbtModify = new javax.swing.JButton();
    jbtSave = new javax.swing.JButton();
    jPanel2 = new javax.swing.JPanel();
    searchIDNumLbl = new javax.swing.JLabel();
    searchIDNumbField = new javax.swing.JTextField();
    jbtSearch = new javax.swing.JButton();
    searchResults = new javax.swing.JLabel();
    jbtExit = new javax.swing.JButton();
    jbtExitwoSave = new javax.swing.JButton();
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Inventory Program"));
    IDNumberLbl.setText("ID Number");
    IDNumberField.setEditable(false);
    prodNameLbl.setText("Product Name");
    prodNameField.setEditable(false);
    colorLbl.setText("Product Color");
    colorField.setEditable(false);
    colorField.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    colorFieldActionPerformed(evt);
    unitsInStockLbl.setText("Units In Stock");
    unitsInStockField.setEditable(false);
    unitPriceLbl.setText("Unit Price $");
    unitPriceField.setEditable(false);
    invenValueLbl.setText("Inventory Value $");
    invenValueField.setEditable(false);
    restockingFeeLbl.setText("5% Restocking Fee $");
    restockingFeeField.setEditable(false);
    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
    jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel1Layout.createSequentialGroup()
    .addContainerGap()
    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
    .addComponent(unitPriceLbl)
    .addComponent(unitsInStockLbl)
    .addComponent(colorLbl)
    .addComponent(prodNameLbl)
    .addComponent(IDNumberLbl)
    .addComponent(restockingFeeLbl)
    .addComponent(invenValueLbl))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
    .addComponent(IDNumberField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE)
    .addComponent(prodNameField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE)
    .addComponent(colorField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE)
    .addComponent(unitsInStockField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE)
    .addComponent(unitPriceField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE)
    .addComponent(restockingFeeField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE)
    .addComponent(invenValueField, javax.swing.GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE))
    .addContainerGap())
    jPanel1Layout.setVerticalGroup(
    jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel1Layout.createSequentialGroup()
    .addContainerGap()
    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(IDNumberLbl)
    .addComponent(IDNumberField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(prodNameLbl)
    .addComponent(prodNameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(colorField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(colorLbl))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(unitsInStockField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(unitsInStockLbl))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(unitPriceField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(unitPriceLbl))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(restockingFeeField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(restockingFeeLbl))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 10, Short.MAX_VALUE)
    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(invenValueField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(invenValueLbl))
    .addContainerGap())
    jbtFirst.setText("First");
    jbtFirst.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jbtFirstActionPerformed(evt);
    jbtNext.setText("Next");
    jbtNext.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jbtNextActionPerformed(evt);
    jbtPrevious.setText("Previous");
    jbtPrevious.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jbtPreviousActionPerformed(evt);
    jbtLast.setText("Last");
    jbtLast.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jbtLastActionPerformed(evt);
    jbtAdd.setText("Add");
    jbtAdd.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jbtAddActionPerformed(evt);
    jbtDelete.setText("Delete");
    jbtModify.setText("Modify");
    jbtModify.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jbtModifyActionPerformed(evt);
    jbtSave.setText("Save");
    jbtSave.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jbtSaveActionPerformed(evt);
    jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Search by:"));
    searchIDNumLbl.setText("Item Number:");
    jbtSearch.setText("Search");
    searchResults.setFont(new java.awt.Font("Tahoma", 1, 12));
    javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
    jPanel2.setLayout(jPanel2Layout);
    jPanel2Layout.setHorizontalGroup(
    jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel2Layout.createSequentialGroup()
    .addContainerGap()
    .addComponent(searchIDNumLbl)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel2Layout.createSequentialGroup()
    .addGap(259, 259, 259)
    .addComponent(searchResults, javax.swing.GroupLayout.PREFERRED_SIZE, 213, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
    .addComponent(jbtSearch, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(searchIDNumbField, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)))
    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    jPanel2Layout.setVerticalGroup(
    jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel2Layout.createSequentialGroup()
    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(searchIDNumLbl)
    .addComponent(searchIDNumbField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel2Layout.createSequentialGroup()
    .addGap(32, 32, 32)
    .addComponent(searchResults, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addGroup(jPanel2Layout.createSequentialGroup()
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(jbtSearch)))
    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    jbtExit.setText("Save and Exit");
    jbtExit.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jbtExitActionPerformed(evt);
    jbtExitwoSave.setText("Exit");
    jbtExitwoSave.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jbtExitwoSaveActionPerformed(evt);
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addContainerGap()
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 44, Short.MAX_VALUE)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
    .addComponent(jbtExitwoSave, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .addComponent(jbtExit)))
    .addGroup(layout.createSequentialGroup()
    .addComponent(jbtFirst)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(jbtNext)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(jbtPrevious)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(jbtLast))
    .addGroup(layout.createSequentialGroup()
    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .addGap(12, 12, 12)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
    .addComponent(jbtAdd)
    .addComponent(jbtDelete)
    .addComponent(jbtModify)
    .addComponent(jbtSave))))
    .addContainerGap())
    layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jbtFirst, jbtLast, jbtNext, jbtPrevious});
    layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jbtAdd, jbtDelete, jbtModify, jbtSave});
    layout.setVerticalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGap(21, 21, 21)
    .addComponent(jbtAdd)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(jbtDelete)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(jbtModify)
    .addGap(39, 39, 39)
    .addComponent(jbtSave))
    .addGroup(layout.createSequentialGroup()
    .addContainerGap()
    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(jbtFirst)
    .addComponent(jbtNext)
    .addComponent(jbtPrevious)
    .addComponent(jbtLast))
    .addGap(15, 15, 15)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addGroup(layout.createSequentialGroup()
    .addComponent(jbtExit)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(jbtExitwoSave)))
    .addContainerGap())
    pack();
    }// </editor-fold>
    private void jbtExitwoSaveActionPerformed(java.awt.event.ActionEvent evt) {                                             
    System.exit(0);
    private void jbtSaveActionPerformed(java.awt.event.ActionEvent evt) {                                       
    String prodNameMod, colorMod;
    double unitsInStockMod, unitPriceMod;
    int idNumMod;
    idNumMod = Integer.parseInt(IDNumberField.getText());
    prodNameMod = prodNameField.getText();
    unitsInStockMod = Double.parseDouble(unitsInStockField.getText());
    unitPriceMod = Double.parseDouble(unitPriceField.getText());
    colorMod = colorField.getText();
    if(currentProductIndex == inventory.length) {
    inList.add(new InventoryPlusColor(idNumMod, prodNameMod,
    unitsInStockMod, unitPriceMod, colorMod));
    InventoryPlusColor[] inventory = (InventoryPlusColor[]) inList.toArray
    (new InventoryPlusColor[inList.size()]);
    } else {
    inventory[currentProductIndex].setIDNumber(idNumMod);
    inventory[currentProductIndex].setProdName(prodNameMod);
    inventory[currentProductIndex].setUnitsInStock(unitsInStockMod);
    inventory[currentProductIndex].setUnitPrice(unitPriceMod);
    inventory[currentProductIndex].setColor(colorMod);
    displayProduct(inventory[currentProductIndex]);
    private static void writeInventory(InventoryPlusColor i,
    DataOutputStream out) {
    try {
    out.writeInt(i.getIDNumber());
    out.writeUTF(i.getProdName());
    out.writeDouble(i.getUnitsInStock());
    out.writeDouble(i.getUnitPrice());
    out.writeUTF(i.getColor());
    } catch (IOException e) {
    JOptionPane.showMessageDialog(null, "I/O Exception writing data",
    "", JOptionPane.ERROR_MESSAGE);
    System.exit(0);
    } //end writeInventory()
    private static DataOutputStream openOutputStream(String name) {
    DataOutputStream out = null;
    try {
    File file = new File(name);
    out =
    new DataOutputStream(
    new BufferedOutputStream(
    new FileOutputStream(file)));
    } catch (IOException e) {
    JOptionPane.showMessageDialog(null, "I/O Error", "", JOptionPane.ERROR_MESSAGE);
    System.exit(0);
    return out;
    } // end openOutputStream()
    private static void closeFile(DataOutputStream out) {
    try {
    out.close();
    } catch (IOException e) {
    JOptionPane.showMessageDialog(null, "I/O Exception closing file",
    "", JOptionPane.ERROR_MESSAGE);
    System.exit(0);
    } // end closeFile()
    private static DataInputStream getStream(String name) {
    DataInputStream in = null;
    try {
    File file = new File(name);
    in = new DataInputStream(
    new BufferedInputStream(
    new FileInputStream(file)));
    } catch (FileNotFoundException e) {
    JOptionPane.showMessageDialog(null, "The file doesn't exist",
    "", JOptionPane.ERROR_MESSAGE);
    System.exit(0);
    } catch (IOException e) {
    JOptionPane.showMessageDialog(null, "I/O Error creating file",
    "", JOptionPane.ERROR_MESSAGE);
    System.exit(0);
    return in;
    private static void closeInputFile(DataInputStream in) {
    try {
    in.close();
    } catch (IOException e) {
    JOptionPane.showMessageDialog(null, "I/O Exception closing file",
    "", JOptionPane.ERROR_MESSAGE);
    System.exit(0);
    } // end closeInputFile()
    private double entireInventory() {
    // a temporary double variable that the method will return ...
    // after each product's inventory is added to it
    double entireInventory = 0;
    // loop to control number of products
    for (int index = 0; index < inventory.length; index++) {
    // add each inventory to the entire inventory
    entireInventory += inventory[index].setInventoryValue();
    } // end loop to control number of products
    return entireInventory;
    } // end method entireInventory
    private void jbtLastActionPerformed(java.awt.event.ActionEvent evt) {                                       
    currentProductIndex = inventory.length-1; // move to the last product
    // display the information for the last product
    displayProduct(inventory[currentProductIndex]);
    private void jbtPreviousActionPerformed(java.awt.event.ActionEvent evt) {                                           
    if (currentProductIndex != 0) // it's not the first product displayed
    currentProductIndex -- ; // move to the previous product (decrement the current index)
    } else // the first product is displayed
    currentProductIndex = inventory.length-1; // move to the last product
    // after the current product index is set, display the information for that product
    displayProduct(inventory[currentProductIndex]);
    private void jbtNextActionPerformed(java.awt.event.ActionEvent evt) {                                       
    if (currentProductIndex != inventory.length-1) // it's not the last product displayed
    currentProductIndex ++ ; // move to the next product (increment the current index)
    } else // the last product is displayed
    currentProductIndex = 0; // move to the first product
    // after the current product index is set, display the information for that product
    displayProduct(inventory[currentProductIndex]);
    private void jbtFirstActionPerformed(java.awt.event.ActionEvent evt) {                                        
    currentProductIndex = 0;
    // display the information for the first product
    displayProduct(inventory[currentProductIndex]);
    private void colorFieldActionPerformed(java.awt.event.ActionEvent evt) {                                          
    // TODO add your handling code here:
    private void jbtModifyActionPerformed(java.awt.event.ActionEvent evt) {                                         
    prodNameField.setEditable(true);
    prodNameField.setFocusable(true);
    unitsInStockField.setEditable(true);
    unitPriceField.setEditable(true);
    private void jbtAddActionPerformed(java.awt.event.ActionEvent evt) {                                      
    IDNumberField.setText("");
    IDNumberField.setEditable(true);
    prodNameField.setText("");
    prodNameField.setEditable(true);
    colorField.setText("");
    colorField.setEditable(true);
    unitsInStockField.setText("");
    unitsInStockField.setEditable(true);
    unitPriceField.setText("");
    unitPriceField.setEditable(true);
    restockingFeeField.setText("");
    invenValueField.setText("");
    currentProductIndex = inventory.length;
    private void jbtExitActionPerformed(java.awt.event.ActionEvent evt) {                                       
    DataOutputStream out = openOutputStream("inventory.dat");
    for (InventoryPlusColor i : inventory)
    writeInventory(i, out);
    closeFile(out);
    System.exit(0);
    private static InventoryPlusColor readProduct(DataInputStream in) {
    int idNum = 0;
    String prodName = "";
    double inStock = 0.0;
    double pric

    BalusC -- The line that gives me my NullPointerException is when I call the "DisplayProduct()" method. Its a dumb question, but with NetBeans how do I find out which reference could be null? I'm not very familiar with how NetBeans works with finding out how to debug. Any help you can give me would be greatly appreciated.The IDE is com-plete-ly irrelevant. It's all about the source code.
    Do you understand anyway when and why a NullPointerException is been thrown? It is a subclass of RuntimeException and those kind of exceptions are very trival and generally indicate an design/logic/thinking fault in your code.
    SomeObject someObject = null; // The someObject reference is null.
    someObject.doSomething(); // Invoking a reference which is null would throw NPE.

  • Report using Binary file

    Hi All , can anyone help me here ...
    I used “Write to Binary” to  write my report , at first stage this file is writing headers , including column  headings . at 2nd writing stage it is writing  data in columns.  This file can be viewed in .doc or .xls format. I have three issues
    1.         If I want to print this file from Front Panel  , what I should do?
    2.         other thing is if I stop logging and then start for another span , it starts writing from the first line instead of from last line  , because of this problem it is causing over-writing .
    3          another thing  , lets say if for 2nd or 3rd logging , I want to display sub-headings (test-1 , test-2) , how to insert , for example :
    MAIN HEADING (COMPANY NAME , REPORT TITLE )
    DATE , PRODUCT INFO , OPERATOR NAME
    COL1              COL2              COL3              COL4
    Subheading (test-1)
    Value1             Value2             Value3             Valye4
    Value1             Value2             Value3             Valye4
    Value1             Value2             Value3             Valye4
    Subheading (Test-2)
    Value1             Value2             Value3             Valye4
    Value1             Value2             Value3             Valye4
    Value1             Value2             Value3             Valye4
    Any help in this regard will be highly appreciated.
    Regards
    Faiyaz
    Attachments:
    report-writing-binaryfile.vi ‏68 KB
    02-display-subVI.vi ‏12 KB

    Hi Faiyaz,
    1. How Do I Print a File Programmatically From LabVIEW?
    2. Please the Programming >> File I/O >> Advanced File Functions >> Set File Position function on the block diagram after the Open/Create/Replace File function and set the from input to "end." This will append new data to the end of the file.
    3. You can simply add that information to the Format into String you are writing to the second Write to Binary file.
    Michael K.
    | Michael K | Project Manager | LabVIEW R&D | National Instruments |

  • Script to open INDD files, run script, and close

    Hello, I'm looking for a script that will open a folder of Indesign files, open each one, run a selected script, then close each file.
    RIght now I'm using the Batch convert script, to convert INDD to INDD and run the script in between (then I delete the extra INDD file). But I'm trying to eliminate the conversion element, just need the script part of it.
    Anyone have any help? Thanks.

    Here's my whole code if it helps. I'm wondering if the script is moving too fast. I think that the first files are still PDFing while the others are opening and closing. Could that be it? I'm not sure why else the for loop for the PDFing is only working on the first file.
    var myFolder = Folder.selectDialog("Select Input Folder");
    var myIndsnFiles = myFolder.getFiles("*.indd");
    var exportPath=Folder("/").selectDlg("Select PDF output folder:");
    var pdfPreset = "Press Quality";
    for(k=0; k<myIndsnFiles.length; k++)
        app.open(myIndsnFiles[k]);
        var jobNumber = "12345";
            for (aPage=0; aPage < app.activeDocument.pages.length; aPage++)
                app.pdfExportPreferences.pageRange = app.activeDocument.pages[aPage].name;
                app.activeDocument.exportFile (ExportFormat.PDF_TYPE, File(exportPath+"/"+jobNumber+"_"+pad(app.activeDocument.pages[aPage].name)+".pdf"), false, pdfPreset);
                function pad (n) {
                return ("00000"+n).slice(-3);
    app.activeDocument.close();

  • Script to search all files in specified folder for multiple string text values listed in a source file and output each match to one single results txt file

    I have been searching high and low for this one.  I have a vbscript that can successfully perform the function if one file is listed.  It does a Wscript.echo on the results and if I run this via command using cscript, I can output to a text file
    that way.  However, I cannot seem to get it to work properly if I want it to search ALL the files in the folder.  At one point, I was able to have it create the output file and appear as if it worked, but it never showed any results when the script
    was executed and folder was scanned.  So I am going back to the drawing board and starting from the beginning.
    I also have a txt file that contains the list of string text entries I would like it to search for.  Just for testing, I placed 4 lines of sample text and one single matching text in various target files and nothing comes back.  The current script
    I use for each file has been executed with a few hundred string text lines I want it to search against to well over one thousand.  It might take awhile, but it works every time. The purpose is to let this run against various log files in a folder and
    let it search.  There is no deleting, moving, changing of either the target folder/files to run against, nor of the file that contains the strings to search for.  It is a search (read) only function, going thru the entire contents of the folder and
    when done, performs the loop function and onto the next file to repeat the process until all files are searched.  When completed, instead of running a cscript to execute the script and outputting the results to text, I am trying to create that as part
    of the overall script.  Saving yet another step for me to do.
    My current script is set to append to the same results file and will echo [name of file I am searching]:  No errors found.  Otherwise, the
    output shows the filename and the string text that matched.  Because the results append to it, I can only run the script against each file separately or create individual output names.  I would rather not do that if I could include it all in one.
     This would also free me from babysitting it and running each file script separately upon the other's completion.  I can continue with my job and come back later and view the completed report all in one.  So
    if I could perform this on an entire folder, then I would want the entries to include the filename, the line number that the match occurred on in that file and the string text that was matched (each occurrence).  I don't want the entire line to be listed
    where the error was, just the match itself.
    Example:  (In the event this doesn't display correctly below, each match, it's corresponding filename and line number all go together on the same line.  It somehow posted the example jumbled when I listed it) 
    File1.txt Line 54 
    Job terminated unexpectedly
     File1.txt Line 58 Process not completed
    File1.txt
    Line 101 User input not provided
    File1.txt
    Line 105  Process not completed
    File2.txt
    No errors found
    File3.txt
    Line 35 No tape media found
    File3.txt
    Line 156 Bad surface media
    File3.txt Line 188
    Process terminated
    Those are just random fake examples for this post.
    This allows me to perform analysis on a set of files for various projects I am doing.  Later on, when the entire search is completed, I can go back to the results file and look and see what files had items I wish to follow up on.  Therefore, the
    line number that each match was found on will allow me to see the big picture of what was going on when the entry was logged.
    I actually import the results file into a spreadsheet, where further information is stored regarding each individual text string I am using.  Very useful.
    If you know how I can successfully achieve this in one script, please share.  I have seen plenty of posts out there where people have requested all different aspects of it, but I have yet to see it all put together in one and work successfully.
    Thanks for helping.

    I'm sorry.  I was so consumed in locating the issue that I completely overlooked posting what exactly I was needing  help with.   I did have one created, but I came across one that seemed more organized than what I originally created.  Later
    on I would learn that I had an error in log location on my original script and therefore thought it wasn't working properly.  Now that I am thinking that I am pretty close to achieving what I want with this one, I am just going to stick with it.
    However, I could still use help on it.  I am not sure what I did not set correctly or perhaps overlooking as a typing error that my very last line of this throws an "Expected Statement" error.  If I end with End, then it still gives same
    results.
    So to give credit where I located this:
    http://vbscriptwmi.uw.hu/ch12lev1sec7.html
    I then adjusted it for what I was doing.
    What this does does is it searches thru log files in a directory you specify when prompted.  It looks for words that are contained in another file; objFile2, and outputs the results of all matching words in each of those log files to another file:  errors.log
    Once all files are scanned to the end, the objects are closed and then a message is echoed letting you know (whether there errors found or not), so you know the script has been completed.
    What I had hoped to achieve was an output to the errors.log (when matches were found) the file name, the line number that match was located on in that file and what was the actual string text (not the whole line) that matched.  That way, I can go directly
    to each instance for particular events if further analysis is needed later on.
    So I could use help on what statement should I be closing this with.  What event, events or error did I overlook that I keep getting prompted for that.  Any help would be appreciated.
    Option Explicit
    'Prompt user for the log file they want to search
    Dim varLogPath
    varLogPath = InputBox("Enter the complete path of the logs folder.")
    'Create filesystem object
    Dim oFSO
    Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")
    'Creates the output file that will contain errors found during search
    Dim oTSOut
    Set oTSOut = oFSO.CreateTextFile("c:\Scripts\errors.log")
    'Loop through each file in the folder
    Dim oFile, varFoundNone
    VarFoundNone = True
    For Each oFile In oFSO.GetFolder(varLogPath).Files
        'Verifies files scanned are log files
        If LCase(Right(oFile.Name,3)) = "log" Then
            'Open the log file
            Dim oTS
            oTS = oFSO.OpenTextFile(oFile.Path)
            'Sets the file log that contains error list to look for
            Dim oFile2
            Set oFile2 = oFSO.OpenTextFile("c:\Scripts\livescan\lserrors.txt", ForReading)
            'Begin reading each line of the textstream
            Dim varLine
            Do Until oTS.AtEndOfStream
                varLine = oTS.ReadLine
                Set objRegEx = CreateObject("VBScript.RegExp")
                objRegEx.Global = True  
                Dim colMatches, strName, strText
                Do Until oErrors.AtEndOfStream
                    strName = oFile2.ReadLine
                    objRegEx.Pattern = ".{0,}" & strName & ".{0,}\n"
                    Set colMatches = objRegEx.Execute(varLine)  
                    If colMatches.Count > 0 Then
                        For Each strMatch in colMatches 
                            strText = strText & strMatch.Value
                            WScript.Echo "Errors found."
                            oTSOut.WriteLine oFile.Name, varLine.Line, varLine
                            VarFoundNone = False
                        Next
                    End If
                Loop
                oTS.Close
                oFile2.Close
                oTSOut.Close
                Exit Do
                If VarFoundNone = True Then
                    WScript.Echo "No errors found."
                Else
                    WScript.Echo "Errors found.  Check logfile for more info."
                End If
        End if

  • How can I script a Flash .exe file to always stay on top of all other windows?

    Hi All,
    I'm new to action script, and I just need this one script
    > How can I script a Flash .exe file to always stay on top of
    all other windows?
    Basically what i want to do is have a flash-created
    step-by-step instructional movie, but for the movie to remain on
    top of all windows so the instructee is able to follow the
    instructions on-screen...
    It would be preferable to not have to buy another product
    just to do this... as I said, this is the only scripting I need.
    Thanks in advance
    Cheers
    Rick

    if you create your exe with mProjector you can use one of its
    new AS
    commands to do this.
    setZOrder
    http://www.screentime.com/software/mprojector/docs/mWin_setZOrder.htm
    all APIS
    http://www.screentime.com/software/mprojector/docs/index.html
    Demo
    http://www.screentime.com/software/mprojector/demo.html
    mProjector installs new classes and help into Flash, to
    enable them you
    must build your app with mProjector (its input is your swf)
    John Pattenden
    Screentime Media - Flash Tools since 1997
    http://www.screentime.com

  • Error in loading data into essbase while using Rule file through ODI

    Hi Experts,
    Refering my previous post Error while using Rule file in loading data into Essbase through ODI
    I am facing problem while loading data into Essbase. I am able to load data into Essbase successfully. But when i used Rule file to add values to existing values I am getting error.
    test is my Rule file.
    com.hyperion.odi.essbase.ODIEssbaseException: com.hyperion.odi.essbase.ODIEssbaseException: Cannot put olap file object. Essbase Error(1053025): Object [test] already exists and is not locked by user [admin@Native Directory]
    at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:146)
    at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.execInBSFEngine(SnpScriptingInterpretor.java:346)
    at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.exec(SnpScriptingInterpretor.java:170)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java:2458)
    at oracle.odi.runtime.agent.execution.cmd.ScriptingExecutor.execute(ScriptingExecutor.java:48)
    at oracle.odi.runtime.agent.execution.cmd.ScriptingExecutor.execute(ScriptingExecutor.java:1)
    at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2906)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2609)
    at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:540)
    at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:453)
    at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1740)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:338)
    at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:214)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:272)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:263)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:822)
    at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:123)
    at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:83)
    at java.lang.Thread.run(Thread.java:662)
    from com.hyperion.odi.common import ODIConstants
    from com.hyperion.odi.connection import HypAppConnectionFactory
    from java.lang import Class
    from java.lang import Boolean
    from java.sql import *
    from java.util import HashMap
    # Get the select statement on the staging area:
    sql= """select C1_HSP_RATES "HSP_Rates",C2_ACCOUNT "Account",C3_PERIOD "Period",C4_YEAR "Year",C5_SCENARIO "Scenario",C6_VERSION "Version",C7_CURRENCY "Currency",C8_ENTITY "Entity",C9_VERTICAL "Vertical",C10_HORIZONTAL "Horizontal",C11_SALES_HIERARICHY "Sales Hierarchy",C12_DATA "Data" from PLANAPP."C$_0HexaApp_PLData" where (1=1) """
    srcCx = odiRef.getJDBCConnection("SRC")
    stmt = srcCx.createStatement()
    srcFetchSize=30
    #stmt.setFetchSize(srcFetchSize)
    stmt.setFetchSize(1)
    print "executing query"
    rs = stmt.executeQuery(sql)
    print "done executing query"
    #load the data
    print "loading data"
    stats = pWriter.loadData(rs)
    print "done loading data"
    #close the database result set, connection
    rs.close()
    stmt.close()
    Please help me on this...
    Thanks & Regards,
    Chinnu

    Hi Priya,
    Thanks for giving reply. I already checked that no lock are available for rule file. I don't know what's the problem. It is working fine without the Rule file, but throwing error only when using rule file.
    Please help on this.
    Thanks,
    Chinnu

  • Error while using Rule file in loading data into Essbase through ODI

    Hi Experts,
    I am facing problem while loading data into Essbase. I am able to load data into Essbase successfully. But when i used Rule fule to add values to existing values am getting error.
    test is my Rule file.
    com.hyperion.odi.essbase.ODIEssbaseException: com.hyperion.odi.essbase.ODIEssbaseException: Cannot put olap file object. Essbase Error(1053025): Object [test] already exists and is not locked by user [admin@Native Directory]
         at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:146)
         at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.execInBSFEngine(SnpScriptingInterpretor.java:346)
         at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.exec(SnpScriptingInterpretor.java:170)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java:2458)
         at oracle.odi.runtime.agent.execution.cmd.ScriptingExecutor.execute(ScriptingExecutor.java:48)
         at oracle.odi.runtime.agent.execution.cmd.ScriptingExecutor.execute(ScriptingExecutor.java:1)
         at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2906)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2609)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:540)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:453)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1740)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:338)
         at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:214)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:272)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:263)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:822)
         at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:123)
         at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:83)
         at java.lang.Thread.run(Thread.java:662)
    from com.hyperion.odi.common import ODIConstants
    from com.hyperion.odi.connection import HypAppConnectionFactory
    from java.lang import Class
    from java.lang import Boolean
    from java.sql import *
    from java.util import HashMap
    # Get the select statement on the staging area:
    sql= """select C1_HSP_RATES "HSP_Rates",C2_ACCOUNT "Account",C3_PERIOD "Period",C4_YEAR "Year",C5_SCENARIO "Scenario",C6_VERSION "Version",C7_CURRENCY "Currency",C8_ENTITY "Entity",C9_VERTICAL "Vertical",C10_HORIZONTAL "Horizontal",C11_SALES_HIERARICHY "Sales Hierarchy",C12_DATA "Data" from PLANAPP."C$_0HexaApp_PLData" where      (1=1) """
    srcCx = odiRef.getJDBCConnection("SRC")
    stmt = srcCx.createStatement()
    srcFetchSize=30
    #stmt.setFetchSize(srcFetchSize)
    stmt.setFetchSize(1)
    print "executing query"
    rs = stmt.executeQuery(sql)
    print "done executing query"
    #load the data
    print "loading data"
    stats = pWriter.loadData(rs)
    print "done loading data"
    #close the database result set, connection
    rs.close()
    stmt.close()
    Please help me on this...
    Thanks & Regards,
    Chinnu

    Hi Priya,
    Thanks for giving reply. I already checked that no lock are available for rule file. I don't know what's the problem. It is working fine without the Rule file, but throwing error only when using rule file.
    Please help on this.
    Thanks,
    Chinnu

Maybe you are looking for

  • JNDI Context Retrieval in EJB 3.0

    I have a doubt about JNDI context retrieval in EJB 3.0. I know that when I call a bean from another bean I can use this line: InitialContext ctx=new InitialContext(); But I'd like to know whether in a Client I am obliged to pass this parameter: Initi

  • Copying a Huge iPAD3 video to Windows

    I have recently recorded a Video Clip using my New iPad 3 . The video size is quite huge size around 9GB I guess. When I connect the iPAd to Laptop(HP) this video is not shown in the list . Any reason why I will not be able to copy. Is there a size l

  • Screen flicker for Mac Mini

    I got the Mac Mini for about one week. When I connect it to my LG W1952TQ monitor, the monitor become flicker.  I have to turn the monitor off for several times and wait for the Mac mini to warm up before the monitor screen improved. Did anyone got a

  • I Can`t put files on my server

    I have trouble whit send file on my server. Fetch and Capitan FTP stop transfer files after few sec. When I put one big file there is no problem. My router is Linksys WAG54G v.1. PS. Sorry for my English ^^

  • Oracle.forms.engine.RunformException: Forms session 1 failed during start

    Dears, I have newly installed APPS R12 on Windows 2003 (32-bit),I'm facing the below issue while using the web page to access any forms, oracle.forms.engine.RunformException: Forms session <3> failed during startup: no response from runtime process K