Jump to content


Photo

Append File


  • Please log in to reply
12 replies to this topic

#1 Bob The Builder

Bob The Builder

    Advanced Member

  • UBot Users
  • PipPipPip
  • 699 posts
  • LocationNew England, USA
  • OS:Windows 7
  • Total Memory:More Than 9Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 12 September 2011 - 05:03 PM

Right now there is no append file option and you have to load the old file into memory, then save it again. This is OK for basic stuff, but if the file is large and you have to frequently update it, it doesn't work out so hot. It is also a lot of unnecessary steps.

I'd like to also see an option on the save file dialog that you can check to specify if you are updating or overwriting a file, this way when you are updating a file it doesn't prompt the user "You will overwrite this file, is this ok?".
Can we build it? Yes we can!

#2 pr0m

pr0m

    Advanced Member

  • UBot Users
  • PipPipPip
  • 118 posts

Posted 17 September 2011 - 09:04 AM

+1, really need this too

#3 Bob The Builder

Bob The Builder

    Advanced Member

  • UBot Users
  • PipPipPip
  • 699 posts
  • LocationNew England, USA
  • OS:Windows 7
  • Total Memory:More Than 9Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 24 October 2011 - 03:09 PM

The more and more I thread, the more and more I need this function. This is useful for a lot of things, but the most important reason I need it is to be able to easily log in my application to a file what is going on.

I found a work around using shell command, which is really nice since it doesn't open a cmd window, but it causes the screen to flash repeatedly when run in loops.

An 'append' file similar to save to file would be extremely helpful. I'd love to see a "log()" function as well, but I can make my own if I had an append file. Loading an old file up and then saving it again works, but it isn't very efficient as a log file grows plus append file it extremely quick and light weight to just add line(s) to the end of a file or create it if it doesn't already exist.
Can we build it? Yes we can!

#4 JohnB

JohnB

    Advanced Member

  • UBot Users
  • PipPipPip
  • 3350 posts
  • LocationNJ
  • OS:Windows 7
  • Total Memory:8Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 24 October 2011 - 05:03 PM

Bob, if you're using .bat files to accomplish tasks, keep in mind you can create them on the fly (inserting variables, etc) before saving and running them. Just a thought if you're using shell a lot.

John

#5 Bob The Builder

Bob The Builder

    Advanced Member

  • UBot Users
  • PipPipPip
  • 699 posts
  • LocationNew England, USA
  • OS:Windows 7
  • Total Memory:More Than 9Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 24 October 2011 - 05:06 PM

Bob, if you're using .bat files to accomplish tasks, keep in mind you can create them on the fly (inserting variables, etc) before saving and running them. Just a thought if you're using shell a lot.

John


No, i'm using native cmd commands. All I am trying to do is append a file, so I am using shell echo.
Can we build it? Yes we can!

#6 Duane

Duane

    Advanced Member

  • UBot Users
  • PipPipPip
  • 1441 posts
  • LocationJapan
  • OS:Windows 7
  • Total Memory:8Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 24 October 2011 - 07:12 PM

+1, this would be very useful...

All Are Welcome To Join Us At The NEW "Uncensored" UBot Forum

__________________________________________

... this message has been approved by me...

ola.gif


#7 Ubot_guy

Ubot_guy

    Advanced Member

  • UBot Users
  • PipPipPip
  • 70 posts

Posted 21 December 2011 - 11:51 AM

I would like this also, but since I need it now this is what I've done.


I wrote a batch file to take a parameter and append the new information to the old info. Then I use the shell command to execute the batch. (IE 'filename.bat variable') It works great. Using the variable makes sure that I don't overwrite the old data. HTH

Here is the exact code...

copy /a /y results%1.csv+temp_results%1.csv results1%1.csv
del results%1.csv
rename results1%1.csv results%1.csv
del temp_results%1.csv

#8 Bob The Builder

Bob The Builder

    Advanced Member

  • UBot Users
  • PipPipPip
  • 699 posts
  • LocationNew England, USA
  • OS:Windows 7
  • Total Memory:More Than 9Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 15 January 2012 - 11:36 AM

Eddie, any chance you can throw this in soon, it should be fairly simple to do but would make life a lot easier when trying to create our own logging routines. The current method of loading the existing file is very resource intensive.
Can we build it? Yes we can!

#9 Chainsaw

Chainsaw

    Advanced Member

  • UBot Users
  • PipPipPip
  • 155 posts
  • OS:Windows XP
  • Total Memory:1Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 19 February 2012 - 10:25 AM

I'm been looking around for the append command. And there isn't one? :o

This is something fundamental that needs to be there.

#10 Bob The Builder

Bob The Builder

    Advanced Member

  • UBot Users
  • PipPipPip
  • 699 posts
  • LocationNew England, USA
  • OS:Windows 7
  • Total Memory:More Than 9Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 19 February 2012 - 10:26 AM

I'm been looking around for the append command. And there isn't one? :o

This is something fundamental that needs to be there.


No, you have to load the old file, append it in memory, and save it out.
Which is fine for small files, but when using it to log stuff it adds unnecessary complexity and overhead. Large files it just slows it down too much.
Been asking for this for a while myself as well. Really would love to see it and it isn't complex.


Can we build it? Yes we can!

#11 Abs1

Abs1

    Newbie

  • Members
  • Pip
  • 2 posts
  • OS:Windows 7
  • Total Memory:8Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 23 February 2012 - 06:51 AM

This isn't the most practical. But here is an idea for logging.
Instead of writing to one big file from an ever growing list.
You can create a folder structure that your bot uses to dump single status files.
For example one folder named failed and another folder named success.
As you process your list or do anything else you want to log, you can then save the results into the success or failed folders. But instead of writing anything into the file, you can just name the file the data or status you want to log or if the result does not lend itself to this, write the line into the file. You can use underscores for spaces in long results then strip them later.
This will require a bit more processing at the end but wont slow the bot down during the main process.
You can insert the underscores and the save to file command inside a thread. You can use the ext as a incremental number in case of duplicates. Once your done just read in the contents of the folders back into lists and save and do to them as you wish.

Edited by Abs1, 23 February 2012 - 06:56 AM.


#12 Bob The Builder

Bob The Builder

    Advanced Member

  • UBot Users
  • PipPipPip
  • 699 posts
  • LocationNew England, USA
  • OS:Windows 7
  • Total Memory:More Than 9Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 23 February 2012 - 04:25 PM

This isn't the most practical. But here is an idea for logging.
Instead of writing to one big file from an ever growing list.
You can create a folder structure that your bot uses to dump single status files.
For example one folder named failed and another folder named success.
As you process your list or do anything else you want to log, you can then save the results into the success or failed folders. But instead of writing anything into the file, you can just name the file the data or status you want to log or if the result does not lend itself to this, write the line into the file. You can use underscores for spaces in long results then strip them later.
This will require a bit more processing at the end but wont slow the bot down during the main process.
You can insert the underscores and the save to file command inside a thread. You can use the ext as a incremental number in case of duplicates. Once your done just read in the contents of the folders back into lists and save and do to them as you wish.


Yeah that is much to much. I have a few ways around it but I really just want a direct low impact way.
Can we build it? Yes we can!

#13 Bob The Builder

Bob The Builder

    Advanced Member

  • UBot Users
  • PipPipPip
  • 699 posts
  • LocationNew England, USA
  • OS:Windows 7
  • Total Memory:More Than 9Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 28 May 2012 - 11:17 AM

Anyway we can get this Eddie? This seems like a very simple addition but would be a huge help for coding with threads and other tasks.
Can we build it? Yes we can!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users