SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 4 of 4
  1. #1
    Senior Member
    Join Date
    Jun 2004
    Location
    Miami,FL
    Posts
    949
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Write a list to a File and Read the File

    This is how to write to a file
    Dim fso, MyFile, AcctNo
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set MyFile = fso.OpenTextFile("c:\Accounts.txt", 8, True)
    AcctNo= DataTable("accountNo", dtGlobalSheet)
    MyFile.WriteLine(AcctNo)
    MyFile.Close
    to read from file use the above with changing 8 to 1 and MyFile.WriteLine to MyFile.ReadLine
    by the way the above script is for writing the account number stored in the global sheet as an output parameter you need to tweak the script little bit
    "I realize it's an error, but no one is going to try to do that!"
    From "Top 10 Stupid Comments from Developers".

  2. #2
    Junior Member
    Join Date
    May 2005
    Location
    Mid Atlantic
    Posts
    16
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Write a list to a File and Read the File

    I am having trouble writing to a file in VB script and reading the info out to a file for a Quick Test Pro script.
    I am basically working with a list of account numbers that I create in 1 script and I'd like to write the list of account numbers out to a file and then have another script grab the file and read those account numbers.
    Any gurus have some insight.
    Something simple.

    I have been working with the following


    Dim fso, MyFile

    Set fso=CreateObject("Scripting.FileSystemObject")
    SetMyFile=fso.CreateTextFile("C:\acctfile.txt",Tru e)

  3. #3
    Junior Member
    Join Date
    May 2005
    Location
    Mid Atlantic
    Posts
    16
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Write a list to a File and Read the File

    Chillyhouse52556,

    Where in the script do you place this coding segment?
    There is also another conditional IF-THEN-ELSE-END IF loop in the script.
    Does the coding segment that you mentioned have to be at the end of the script?
    Let's talk offline, I'd probably benefit from it.
    I can be emailed at duason2@yahoo.com

    thanks, HollisB

  4. #4
    Member
    Join Date
    May 2005
    Location
    Noida
    Posts
    131
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Write a list to a File and Read the File

    Hi HollisB,

    The Creation of Object and the File opening can be done at the start of the script. Then the commands for Writing and the reading of lines to/from the file can be written as and how your script process. If you want that writing to file should done after checking some if condition then you can place that code within the if condition otherwise you can put it outside.

    But make sure when you write to the file the data to be written should be available with you. and when you are reading the file the file should be open.

    Hope you got it

    Thanks

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.71%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 06:26 AM.

Copyright BetaSoft Inc.