Jump to content
UBot Underground

How to Open a File?


Recommended Posts

Hello,

 

How to open a file?

 

Sorry, but these bots doesn't work at all:

 

http://ubotstudio.com/forum/index.php?app=core&module=attach&section=attach&attach_id=1056

 

http://ubotstudio.com/forum/index.php?app=core&module=attach&section=attach&attach_id=1057

 

Even with this file saved in the same directory as robots:

 

http://ubotstudio.com/forum/index.php?app=core&module=attach&section=attach&attach_id=1055

 

Is there any simple functions "Open File", "Read Line #", "Write Line #", "Save File" without having to write code on kilometers long?

 

Maybe my qestion is too simple...

 

 

Rise

Link to post
Share on other sites

Under UI commands, there is UI Open file and then UI Save File.

 

In the constants, there is a constant for read file (that comes up when a parameter window pops up depending on what you are trying to do.)

 

Again, check out the tutorials at ubotstudio.com/tutorials.aspx

Link to post
Share on other sites

Tutorial 5 - Variables/Set/UI

 

Thank you Lilly,

 

I watched 10 times this video.

 

Comments between 4:09 and 4:15:

 

That's works the exact same way, we can put save file, open file

 

However, this is only a 6 seconds comment. No demonstration, so I don't understand yet how to open and read a file.

 

Even after 2 hours of watching many videos, and many testing. :(

 

 

Rise and fall

Link to post
Share on other sites

I understand.

 

For UI Open File Command,

 

Drag UI open file into the script. It will ask you to create a variable for it in the parameter window. If you fill a field with the variable, it will change that field to whatever file name you have in UI open file, which will be at the top left corner of UBot.

 

UI Open file requires you to have an existing file available since you are opening the file. You can use the variable for the UI open file wherever you need to.

 

The Read File constant just returns the contents of a file.

Your basically telling it to give you the literal contents of the file.

 

So for example:

If I want to fill a field without lists and adding a file to a list, I just click and drag the field into the script. When the parameter window pops up, go under variable constants and drag "$read file" into the right side of the window. Add the file of your choice, click ok.

 

when you run the script, the field will be filled with the contents of the file.

 

I hope that helps :)

Link to post
Share on other sites

First of all Lilly, you're a nice person.

 

Understand me, I bought uBot on 23rd of Jully. We are on 02 of August. I tried, and tried and tried without any success all by myself.

 

The only things working are from you. I cannot live through your knowledge and kind help.

 

Understand me Lilly, I have a company to manage. I cannot spend time just to try to live on my dreams.

 

I understand you Lilly, you cannot spend your precious time with a stupid old man.

 

I know, uBot is a VERY powerful tool (at least, in my mind, because I have so many projects) however...

 

I come from the old school. I learned Assembly on a green screen without WYSIWYG. Coding line after line.

 

I need to read code on paper (screen) to understand it. To learn of it. To cut and paste it. I need to open a file with one line, for example in PHP:

 

$file=fopen("url.txt","r");

 

It's short, fast, easy, and unforgetable.

 

Click and drop and WYSIWYG is absolutly disturbing for me:

 

I understand nothing.

 

I'm very sad of me.

 

I'm a total disaster.

 

 

Rise and fall.

 

PS: Publish a "coding by hand" uBot, that's will help me.

Link to post
Share on other sites
  • 3 weeks later...

attached is an example that shows the equivalent of the code you mentioned.

 

read file example.ubot

 

Hey... okay here is a problem I have. I want someone to upload a csv, like using the UI file open stuff, and then, get data from that csv... how do i do that? Its kinda quite confusing.. help! and ya i checked all tuts, none matching :(

Link to post
Share on other sites
  • 1 month later...

Sorry to revive an old thread, but this is the closest solution and others could likely benefit from this knowledge..

 

How does one discard lines when reading lines from a CSV file and creating a list that begin with a given comment character? ; or # ? The CSV will contain comments for readability, I do not want my list to. Something like

if #line matches /^[^#;].*/, keep #line

 

Thanks

Link to post
Share on other sites

ubot isn't really set up to do that sort of thing (although I do plan on adding some commands that will help with that soon), but if I were stuck with this problem, I would just remove the comment line ahead of time with a text editor that is capable of regular expressions. I recommend textpad.

Link to post
Share on other sites

Thank you both for the suggestions.

 

From the examples at your listed URL the Contains node appears only useful for exact matches, not pattern matching. Pattern matching is what I need. It could be my lack of UBot Dev knowledge..

 

Notepad++ has a great RE capability and is open source (no nags or evaluation copies..). Give it a try if you haven't used it before. Manipulating the data file outside of UBot is not the challenge rather having UBot do the processing is my challenge.

 

Thanks again for your advice.

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...