Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing files

Status
Not open for further replies.

minoad

Programmer
Mar 28, 2001
138
US
I have writen a file which creates another file. It uses a do.. Loop to cycle throguh and write lines to the file in order. This ussually works just fine, but from time to time it will rewrite a line it has already written. Does anyone know of any way to insure this does not happen? I am using the "Writeline" function.

And one more question, where would i find a good resource to convert this to an ".HTA" file?

Thanks in advance,

Micah A. Norman
 
Alot of code, but here is the part that writes the file.

''''''''''''''''''''Begin the loop
Do While n = 0

''''''''''''''''''''Logic for Setting Up URL's
'xurl = trim(inputbox(&quot;Will this be a <W>site or a <P>ram.(W for website; P for program &quot;))


''''''''''''''''''''Prepare the xurl variable
cstr(xurl)
xurl = ucase(xurl)


''''''''''''''''''''Set linktype to proper data type
'(Unsuported in VBScript) cint(lnktype)

''''''''''''''''''''Set the lynk variable
lynk = trim(inputbox(&quot;Enter the program or web you wish to have automatically linked. For websites the <http:\\www> is not necassary&quot;))


yAuth = instr(1, lynk, &quot;.&quot;, 1)

if yauth <> 0 then
lnktype = &quot;1&quot;
Else
lnktype = &quot;2&quot;
End if

If lnktype = &quot;2&quot; then

' write file info
objOutputFile.WriteLine(&quot;Wshshell.run&quot; & &quot; &quot; & pa & lynk & pa)

elseif lnktype = &quot;1&quot; then


xauth = instr(1, lynk, &quot;call&quot;, 1)

if xauth = 0 then

iexplore = &quot;iexplore&quot;
objoutputfile.writeline(xn & &quot; &quot; & pa & iexplore & &quot; &quot; & lynk & pa)
Else

iexplore = &quot;iexplore&quot;
objoutputfile.writeline(xn & &quot; &quot; & pa & iexplore & &quot; &quot; & &quot;http:\\&quot; & user & &quot;:&quot; & pass & &quot;@&quot; & lynk & pa)
End IF
End if

''''''''''''''''''''Set variable to hold url info
iUrl = Trim(InputBox(&quot;If you would like to add another program or website to your auto startup file (Y/N) now&quot;))

''''''''''''''''''''Confirm set as string
Cstr(iUrl)

''''''''''''''''''''Confirm upper case
iurl = Ucase(iurl)
if iurl = &quot;Y&quot; then
n = 0
else
n = 1
End if

Loop
''' END LOOP

'''Write Cleanup Code to file
objoutputfile.writeline(&quot;Set objfilesystem = Nothing&quot;)
objoutputfile.writeline(&quot;WScript.Quit(0)&quot;)

 
If you're comfortable with VB-style programming, you can find a helpful example of an HTA at
Ignore most of that web page, scroll to the bottom and read the last couple paragraphs to find the downloadable example, then just look at it in NotePad or InterDev or something.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top