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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

file.writeline problems 1

Status
Not open for further replies.

krappleby025

Programmer
Sep 6, 2001
347
NL
Hi all im having a problem writing to a text file.. i am using the following code

<%
Groupid = &quot;testfolder&quot;
Adminpass = &quot;testing123&quot;
set fs = CreateObject(&quot;Scripting.FileSystemObject&quot;)
set file = fs.CreateTextFile(&quot;E:/GroupMLM/&quot; & Groupid & &quot;/includes/config.txt&quot;, true, false)
file.writeline(&quot;<%&quot;)
file.writeline(&quot;Memberstable = &quot;&quot; & Groupid & &quot;Members&quot;&quot;)
file.writeline(&quot;TransactionTable = &quot;&quot; & Groupid & &quot;Transactions&quot;&quot;)
file.writeline(&quot;AdminLogin = &quot;&quot;admin&quot;&quot;)
file.writeline(&quot;Adminpassword = &quot;&quot; & adminpass & &quot;&quot;)
file.writeline(&quot;Group = &quot;&quot; & Groupid & &quot;&quot;)
file.writeline(&quot;%>&quot;)
file.close
set file = nothing
%>

But it is not working, I need to generate a file in the following format
<%
memberstable = &quot;testfoldermembers&quot;
transactionstable = &quot;testfoldertransactions&quot;
adminlogin = &quot;admin&quot;
adminpassword = &quot;testing123&quot;
group = &quot;testfolder&quot;
%>

i have tried alsorts and cannot get it to generate the file as i need it, any ideas
 
You may need to replace the ASP delimiters with their equivalent character codes.

Maybe your ASP page that is creating these text files is inadvertently reading the <% and %> in file.writeline(&quot;<%&quot;) and file.writeline(&quot;%>&quot;) as its own delimiters???

Are you actually getting an error when you try to create the files or is the script running OK but the files not being created??
Tony
reddot.gif WIDTH=500 HEIGHT=2 VSPACE=3

 
The file works, however it is printing the follwoing

<%
memberstable = testfoldermembers
transactionstable = testfoldertransactions
adminlogin = admin
adminpassword = testing123
group = testfolder
%>

i tried by placing & quot; in the asp file but ended up with

memberstable = & quot;testfoldermembers& quot;

i actually need it to read

memberstable = &quot;testfoldermembers&quot;

but it is not working
i have tried alsorts

any ideas

 
I have not tested this but give it a shot.

file.writeline(&quot;Memberstable = &quot;&quot;&quot; & Groupid & &quot;Members&quot;&quot;&quot;)

Use three &quot; instead of two. When VBScript sees two &quot;, it changes it to one, thus you need three. The first two to create a single &quot; in the string and the thrid to terminate the string.

Let me know if this works,

Thanks,

Gabe
 
great mate. thanks

that worked for three of the lines

the last two lines of the created text file end up as

adminpassword = &quot; & adminpass & &quot;
group = &quot; & groupid & &quot;

the codeing for these two lines is

file.writeline(&quot;Adminpassword = &quot;&quot; & adminpass & &quot;&quot;&quot;)
file.writeline(&quot;Group = &quot;&quot; & Groupid & &quot;&quot;&quot;)

i am gonna try by removing one of the &quot; at the front. maybe it will work, but give me your ideas
 
If you post your new code, I may be able to see what is going on.

Thanks,

Gabe
 
YIPPPEEE i managed to solve it.. Thanks for all your help

keith... Enjoy your star
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top