Re: How come this Script Doesn't work?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Joe McMillan (MoeJoe_at_hcnews.com)
Date: 03/04/05


Date: Fri, 4 Mar 2005 12:04:46 -0600

OKAY! I discovered that, using no path on the outfile, my computer wrote
the file to c:\. Is that possible for you?

-- 
Joe Phillips, Support Technician
HCN Internet Services
"I am not an expert, just experienced."
"Jim Bayers" <spamity@spam.spam> wrote in message
news:Pine.WNT.4.61.0503041008110.2752@VirtualXP2.em.arizona.edu...
I'm not sure what else to add.  If I hardcode the file paths into the
script, it works.  If I drag and drop the file on the script, it doesn't
work.  Just the filename is causing the problem. The script works
otherwise.
If I drag and drop the delimited text file onto the script, it will read
the delimited text file, however, it won't write to the new file.
ø¤°`°¤ø,¸_¸,ø¤°`°¤ø,¸_¸,ø
On Fri, 4 Mar 2005, Jim Bayers wrote:
>
> I wanted to set this up so that when I drag and drop a
> delimited text file onto it, it would create a sql
> script.  It works if I hardcode the filename but if I
> drag and drop, it fails.
>
> ''''''''''''''''''''''''''''''''''
> ' script to create sql updates from
> ' delimited files
> '
>
> Const ForReading = 1
>
> main
>
> sub main()
> Dim fso, fin, fout, line, objArgs, infile, ary, str
> Set objArgs = WScript.Arguments
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set fout = fso.CreateTextFile("updateout.sql", True)
> Set fin = fso.OpenTextFile(objArgs(0), ForReading)
> While Not fin.AtEndOfStream
> line = fin.ReadLine()
> ary = split(line, vbTAB)
> if ary(2) = "" then
> ary(2) = "NULL"
> else
> ary(2) = "'Y'"
> end if
> str = "UPDATE HOL_Students SET IsInternational='" & _
> ary(1) & "', Resident=" & ary(2) & ", AcademicIndex="
> & _
> ary(3) & " WHERE SID='" & ary(0) & "'"
> fout.WriteLine str
> Wend
> fin.Close
> fout.Close
> end sub
>
>
> ø¤°`°¤ø,¸_¸,ø¤°`°¤ø,¸_¸,ø
>


Relevant Pages

  • Re: To drag a file as parameter to script
    ... I have never drag and dropped .prn files to a printer, ... Yes, it is a nuisance to see the word window pop up on the screen, but it is ... .prn files to the script as prarameter, then they can get the printout. ...
    (microsoft.public.scripting.wsh)
  • Re: How come this Script Doesnt work?
    ... delimeted text file icon on the script icon, it gives the script the file ... studentid vbTAB isinternational vbTAB isresident vbTAB index ... Just drag and drop the file on the script and you'll see what I mean. ...
    (microsoft.public.scripting.vbscript)
  • Re: help on fopen
    ... make a drag and drop script, to drag and drop files and maps on one ... the map ../map1 and in the config file appears after file3.html. ...
    (comp.lang.php)
  • Scripting in Drag
    ... I am trying to modify the below script ... functions) the coordinates of a dragged object after the drag ... var evtobj=window.event? ...
    (comp.lang.java.programmer)
  • Scripting problem in drag!-)
    ... Can any of you Jscipters help me? ... functions) the coordinates of a dragged object after the drag ... Drag and Drop Script: © ... var evtobj=window.event? ...
    (microsoft.public.scripting.jscript)