Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003

    Unanswered: Convert VBS to Java

    Hi all,

    I know this may not be the correct place but I'm hoping that someone out there will have the knowledge that I'm lacking. I'm on a bit of a deadline so I'm casting many lines out there...

    I have written a very small piece of script that runs on our oracle linux server. Unfortunately I found out too late that it was a Linux machine and the vbs script that i've written won't work. Java will work, but I know no nothing about Java and it took me long enough to scrape together these few lines.

    The purpose of this is to save the output csv from Oracle OBIEE and copy it to a specific location. Once there, it needs to read the first cell in the csv document and rename the file based on that field.

    Can someone help me to convert this to Java?

    ' Section 1 to save OBIEE report to specified location
    Dim sBasePath
    '    sBasePath = "\\wkse13p1xcboapp01\opt\openbet\logs\campaign_ui\upload\"
        sBasePath = "\\coral\public\users\Christy.O'Connor\"
    Dim objFSO
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    ' Parameter 0 is the original file created by OBIEE
    Dim sFileName
        sFileName = sBasePath & "output_" & Parameter(0)
    Dim objFile
        objFSO.CopyFile Parameter(0), sFileName, True
    Set objFile = Nothing
    Set objFSO  = Nothing
    ' Section 2 to rename file based on 1st entry in csv file
    Const ForReading = 1
    Dim objFolder, objFiles
    Dim tsFile, sLine, fields, sNewFilename
    Set objFso = CreateObject("Scripting.FileSystemObject")
    Set objFolder = objFso.GetFolder(sBasePath)
    Set objFiles = objFolder.Files
    For Each objFile In objFiles 
      If objFile.Name = "CampaignUsers2.csv" Then
        Set tsFile= objFso.OpenTextFile(objFile.Path, ForReading)
        sLine = tsFile.ReadLine   'get 1st record
        fields = Split(sLine,",")
        sNewFilename = fields(0)  'get 1st field
        'Rename file (or use objFile.Copy to copy it)
        objFile.Move objFile.ParentFolder & "\" & sNewFilename & ".csv"
      End If

  2. #2
    Join Date
    Nov 2015
    U can use VB to Java Converter (Free Edition).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts