Jump to content
UBot Underground

Looping through txt files in a folder


Recommended Posts

I want to specify a folder for ubot to look in for plr articles.

 

Then I want it to open the first txt file in the specified folder, select all, copy then paste it into a wysiwyg editor on my webpage then hit save

Then open the next txt file and select all, copy and paste it into the second wysiwyg editor on my webpage and so on and so forth for 10 articles.

 

How do I do this?

Link to post
Share on other sites

set(#path, "C:\\Users\\yourPhat", "Global")

add list to list(%MyFiles, $get files(#path, "No"), "Delete", "Global")

loop($list total(%MyFiles)) {

set(#file, "{#path}\\{$next list item(%MyFiles)}", "Global")

add list to list(%file, $list from file(#file), "Delete", "Global")

comment("DO WHAT EVER U WANNA DO HERE")

}

 

try this

Link to post
Share on other sites

set(#path, "C:\\Users\\yourPhat", "Global")

add list to list(%MyFiles, $get files(#path, "No"), "Delete", "Global")

loop($list total(%MyFiles)) {

set(#file, "{#path}\\{$next list item(%MyFiles)}", "Global")

add list to list(%file, $list from file(#file), "Delete", "Global")

comment("DO WHAT EVER U WANNA DO HERE")

}

 

try this

 

thanks for that help. I am getting a problem with the apostrophes are getting replaced with a weird black diamond shape in the file it is reading. Is there a way to fix that?

Link to post
Share on other sites

okay

i thing thats because of Encodeingformat

ubot use utf8 windowsmaschines use ANSI

 

in this case i would try this.... (depence on whats your skills with dos-promt)

 

create with notepad a new textdocument save this document as yourname.txt

on the saveoption in notepad u can change the encodeingformat to utf8

 

open a dos-promt (cmd.exe)

walk to your documentroot where all the lists in (like: cd c:\user\me\mydocs\mylists)

then u can fillup your newUTF8 created yourname.txt file whit this command dir > "c:\thePathToTheFile\yourname.txt"

 

maybe if u open yourname.txt u have to clean some things too but u can do that easy with search/replace in Notepad.

 

after that u can load the file into ubot

 

instead of

add list to list(%MyFiles,$get files(#path,"No"),"Delete","Global")

use

add list to list(%MyFiles, $list from file(c:\pathToTheFile\yourname.txt"), "Delete", "Global")

 

hope that helps u

 

by the way

try to save your lists in a clear format no specialcharakters

 

wrong -> this is my super dok.txt

fine -> this_is_my_super_dok.txt

 

http://www.ubotstudio.com/forum/public/style_emoticons/default/tongue.gifhttp://www.ubotstudio.com/forum/public/style_emoticons/default/wink.gifhttp://www.ubotstudio.com/forum/public/style_emoticons/default/smile.gifhttp://www.ubotstudio.com/forum/public/style_emoticons/default/biggrin.gif

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...