Quantcast
Channel: VBForums - ASP, VB Script
Viewing all articles
Browse latest Browse all 688

Auto Import Script not Working

$
0
0
Hi all,

I'm an absolute beginner with VB hence I might ask some silly questions.
I have a VB script getting triggered via a Batch file which resulots in data being imported for last day.
Below is the code for VB and Batch file.
Please let me know if you see any error in the code.

VB Script
Code:

rem
rem XLink_Import.vbs
rem

Set oShell = WScript.CreateObject("WScript.Shell")

' filename = oShell.ExpandEnvironmentStrings("today_xlink.bat")
' Set objFileSystem = CreateObject("Scripting.fileSystemObject")
' Set oFile = objFileSystem.CreateTextFile(filename, TRUE)

Dim i
Dim ImportStartOffset, ImportedNumberOfDays

If WScript.Arguments.length > 0 Then
    For i=0 to WScript.Arguments.length-1
        Arg = WScript.Arguments(i)
        If Left(Arg,1) = "-" Then
            If ( Arg = "-o" ) Then
                ImportStartOffset = WScript.Arguments(i+1)
            End if
            If ( Arg = "-n" or Arg = "-l" ) Then
                ImportedNumberOfDays = WScript.Arguments(i+1)
            End if
        End if
    Next
End If

rem Prepare the import start date

Dim Dy, Mth
Dim ImportDate
ImportDate = Now + ImportStartOffset
Dy = Day(ImportDate)
Mth = Month(ImportDate)
If Len(Dy) = 1 Then Dy = "0" & Dy
If Len(Mth) = 1 Then Mth = "0" & Mth
ImportStartDate = Dy & "/" & Mth & "/" & Year(ImportDate)

rem Prepare import script to run (not useed yet)
rem oFile.WriteLine("isps_ul.exe -t -d " & todaydate & " -L 1")
rem oFile.Close

rem Run XLink import

wscript.echo "isps_ul.exe -t -d " & ImportStartDate & " -L " & ImportedNumberOfDays
oShell.Run "isps_ul.exe -t -d " & ImportStartDate & " -L " & ImportedNumberOfDays, 1, true

Batch File
Code:

@echo off
rem
rem XLink_Import.bat
rem
rem Manually starts an Xlink import starting today + a StartOffset of some days.
rem Imported number of days can also be set.
rem

set ImportStartOffset=0
set ImportedNumberOfDays=1

cscript XLink_Import.vbs -o %ImportStartOffset% -n %ImportedNumberOfDays%

pause


Viewing all articles
Browse latest Browse all 688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>