PDA

View Full Version : write to text file and run ???


ButtonMaker
02-16-2009, 01:47 AM
i want to write data to text file and then run the text file... how can i do it ???

links = WebBrowserExtension.GetLinks();
for i, v in links do
--how to write links to txt file ???
end

XeroX
02-16-2009, 03:15 AM
Hi,

Do you mean something like that ?

ButtonMaker
02-16-2009, 03:24 AM
thanks but not what i want !!! what i want is;
get links from the page and save it to txt file and run the text file...

something like that but this doesnt work...
links = WebBrowserExtension.GetLinks();
TextFile.WriteFromString("AutoPlay\\Docs\\links.txt", links, true)
File.Run("AutoPlay\\Docs\\links.txt", "", "", SW_SHOWNORMAL, false);

Imagine Programming
02-16-2009, 04:45 AM
thanks but not what i want !!! what i want is;
get links from the page and save it to txt file and run the text file...

something like that but this doesnt work...
links = WebBrowserExtension.GetLinks();
TextFile.WriteFromString("AutoPlay\\Docs\\links.txt", links, true)
File.Run("AutoPlay\\Docs\\links.txt", "", "", SW_SHOWNORMAL, false);

File.Run is for executable files, try to use File.Open

File.Open("AutoPlay\\Docs\\links.txt", "", SW_SHOWNORMAL);

ButtonMaker
02-16-2009, 04:58 AM
it doesnt write data to txt file !!!

links = WebBrowserExtension.GetLinks();
for i, v in links do
TextFile.WriteFromString("AutoPlay\\Docs\\links.txt", v, true)
end
File.Open("AutoPlay\\Docs\\links.txt", "", SW_SHOWNORMAL);

Imagine Programming
02-16-2009, 05:02 AM
Try to check tbl links for being empty... perhaps it doesn't contain anything so the for loop won't do anything.

links = WebBrowserExtension.GetLinks();
if(links)then
for i, v in links do
TextFile.WriteFromString("AutoPlay\\Docs\\links.txt", v, true)
end
else
Dialog.Message("Error", "No links retrieved");
end
File.Open("AutoPlay\\Docs\\links.txt", "", SW_SHOWNORMAL);

ButtonMaker
02-16-2009, 05:06 AM
thanks C B programming and webdesign :yes

but is it possible to r/n/ after everylink in txt file ???

example txt file :
www.google.com
www.msn.com
www.yahoo.com

Imagine Programming
02-16-2009, 06:47 AM
thanks C B programming and webdesign :yes

but is it possible to r/n/ after everylink in txt file ???

example txt file :
www.google.com
www.msn.com
www.yahoo.com

Sure, just add the red part :)
links = WebBrowserExtension.GetLinks();
if(links)then
for i, v in links do
TextFile.WriteFromString("AutoPlay\\Docs\\links.txt", v.."\r\n", true)
end
else
Dialog.Message("Error", "No links retrieved");
end
File.Open("AutoPlay\\Docs\\links.txt", "", SW_SHOWNORMAL);