|
Naming CreateTextFile using File System Object
|
|
10-16-2009, 04:21 AM
Post: #1
|
|||
|
|||
|
Naming CreateTextFile using File System Object
Here's my script:
VBS Programming
The script works fine. I even have it creating a text file named "today's date". If I run the script more than once per day it overwrites the text file created before it. My question is: How do you get it to name each new text file different than the first while still maintaining the system date? undefined |
|||
|
10-16-2009, 09:43 AM
Post: #2
|
|||
|
|||
RE: Naming CreateTextFile using File System Object
(10-16-2009 04:21 AM)hondabones Wrote: How do you get it to name each new text file different than the first while still maintaining the system date? Add the time. Scripting problems? Windows questions? Ask the Windows Guru! Stay up to date with all of my latest content. Follow me on Twitter! Help us help you! Post your exact error message with these easy tips! |
|||
|
10-16-2009, 03:28 PM
Post: #3
|
|||
|
|||
RE: Naming CreateTextFile using File System Object
(10-16-2009 09:43 AM)Nilpo Wrote:(10-16-2009 04:21 AM)hondabones Wrote: How do you get it to name each new text file different than the first while still maintaining the system date? Yep, That makes sense. It would be better if the script could read an existing text file then recall the "Running Balance: $" Use this amount for the strStart User would then input new amounts the script would then write these amounts with the new balance to the same text file without overwriting the original text. How could I do that? undefined |
|||
|
10-16-2009, 03:54 PM
(This post was last modified: 10-16-2009 04:36 PM by Nilpo.)
Post: #4
|
|||
|
|||
|
RE: Naming CreateTextFile using File System Object
Well, you could do that too.
To begin, you'll need to use the constant ForAppending to write to the file without overwriting its existing contents.Of course, you'd use that as the second parameter in the OpenTextFile field. Then you'll want to read in the text file and remember the last line. I can't tell you how to parse out the amount because I don't know what that line looks like for you. But here's how to retrieve the last line of the file.Basically, this will assign each line of the file to strLine. When the loop exits, strLine will contain the last line of the file and the file's pointer will be at the end of the file--exactly where you want to start writing. If your file has a line something like "Running Balance: $" where the amount is immediately following a dollar sign and running to the end of the line, then you can parse it easily like this: Scripting problems? Windows questions? Ask the Windows Guru! Stay up to date with all of my latest content. Follow me on Twitter! Help us help you! Post your exact error message with these easy tips! |
|||
|
10-16-2009, 04:21 PM
(This post was last modified: 10-16-2009 04:29 PM by hondabones.)
Post: #5
|
|||
|
|||
|
RE: Naming CreateTextFile using File System Object
I could just read from the bottom up like this:
VBS Programming
But that reads every line and echoes each line back. undefined |
|||
|
10-16-2009, 04:28 PM
Post: #6
|
|||
|
|||
RE: Naming CreateTextFile using File System Object
(10-16-2009 03:54 PM)Nilpo Wrote: Well, you could do that too. so i would then enter strBal for the input strStart? undefined |
|||
|
10-16-2009, 04:35 PM
Post: #7
|
|||
|
|||
|
RE: Naming CreateTextFile using File System Object
Scripting problems? Windows questions? Ask the Windows Guru! Stay up to date with all of my latest content. Follow me on Twitter! Help us help you! Post your exact error message with these easy tips! |
|||
|
10-16-2009, 04:37 PM
Post: #8
|
|||
|
|||
RE: Naming CreateTextFile using File System Object
(10-16-2009 04:21 PM)hondabones Wrote: I could just read from the bottom up like this: Big time over kill. Don't make it more complicated than it is. And don't use unnecessary objects/arrays/loops. It will just make your code less efficient. Scripting problems? Windows questions? Ask the Windows Guru! Stay up to date with all of my latest content. Follow me on Twitter! Help us help you! Post your exact error message with these easy tips! |
|||
|
10-16-2009, 04:40 PM
Post: #9
|
|||
|
|||
RE: Naming CreateTextFile using File System Object
(10-16-2009 04:37 PM)Nilpo Wrote: Big time over kill. Don't make it more complicated than it is. And don't use unnecessary objects/arrays/loops. It will just make your code less efficient. How do I use your method but read from the bottom select the first line of text and use that for strBal? undefined |
|||
|
« Next Oldest | Next Newest »
|
| Forum Permissions |
| You cannot post new threads. You cannot post replies. You cannot post attachments. |
| HTML is turned off. MyCode is turned on. Smilies are turned on. [img] is turned on. |


Search
Member List
Calendar
Help




