VBScript uses file switch

Intel / Xeon(tm) cpu 3.20ghz
January 19, 2009 at 23:31:10
Specs: Windows Server 2003, Xeon - 2G
Hi all,

Would anyone helps me implement the following tasks using VBScripts.

I need a script that does the following:
1- Create file with name of C:\SW.txt
2- Write (inside the file) the number zero (0).
3- Check some thing using IF, I have the script of checking what I need using IF.
4- If the result is true then the content of C:\SW.txt is changed from (0) to (1).
5- Checking continues if content of C:\SW.txt is zero (loop).

Thanks anyone reads this message and double thanks anyone tries to solve it and triple thanks anyone posts a solution.

See More: VBScript uses file switch

Report •

January 20, 2009 at 07:43:30
my second try on vbs, sorry if there is any bug or inefficiency in the code. i use following link
http://msdn.microsoft.com/en-us/lib... in writing the following code.
dim fs,f,ts
set fs=createobject("Scripting.FileSystemObject")

	set ts=fs.OpenTextFile("C:\SW.txt", 2, True)
	ts.Write "0"
	'if statement goes here
	if something=true then
		set ts=fs.OpenTextFile("C:\SW.txt", 2, True)
		ts.Write "1"
	end if

	wscript.sleep 1000
	set ts=fs.OpenTextFile("C:\SW.txt", 1)
Loop While Line=0

hmm, why would you need temporary file. instead you can do this:
//your no#3 script here
loop until yourscriptresult=true

btw, does anyone know the link to VBS API reference that i can download and view offline??

Report •

January 20, 2009 at 22:09:46
Thanks reno, double thanks, and triple thanks.

Report •

Related Solutions

Ask Question