Praney Behl 314 Posted July 26, 2012 Report Share Posted July 26, 2012 Hi fellows, I requested this feature many moons ago here :http://www.ubotstudio.com/forum/index.php?/topic/9325-must-have-append-and-prepend-to-file/page__view__findpost__p__47674 But as it is not so hard to accomplish and the Ubot Dev. team is busy I thought I'll build a custom work around till they could implement it. Alright here we go: Append to File: define $append to list(#Filename, #Text To Append To List) { set(#list, $read file(#Filename), "Local") save to file(#Filename, "{#list} {#Text To Append To List}") } Prepend to file define $prepend to list(#Filename, #Text To Prepend To List) { set(#list, $read file(#Filename), "Local") save to file(#Filename, "{#Text To Append To List} {#List}") } Usage Instructions: - Copy the code provided above into your Ubot script. - Use the functions from > Parameters > Custom Functions $prepend to list $append to list Drag Drop and Enjoy Here is a screenshot on where to find them: http://img688.imageshack.us/img688/4519/ubotnewcustomfunctionsb.png Hope it helps. Cheers!Praney 4 Quote Link to post Share on other sites
Praney Behl 314 Posted July 26, 2012 Author Report Share Posted July 26, 2012 Ok here is a shorter version for it: Append to File:define $append to list(#Filename, #Text To Append To List) { save to file(#Filename, "{$read file(#Filename)} {#Text To Append To List}") } Prepend to file: define $prepend to list(#Filename, #Text To Prepend To List) { save to file(#Filename, "{#Text To Append To List} {$read file(#Filename)}") } Cheers! 4 Quote Link to post Share on other sites
blumi40 222 Posted July 26, 2012 Report Share Posted July 26, 2012 shortest versionstrg+o c/p alt+f4 :) Quote Link to post Share on other sites
Legend 181 Posted July 27, 2012 Report Share Posted July 27, 2012 shortest versionstrg+o c/p alt+f4 :) OK... you're gonna have to explain this one... its got me stumped... http://www.ubotstudio.com/forum/public/style_emoticons/default/blink.gif Quote Link to post Share on other sites
Praney Behl 314 Posted July 27, 2012 Author Report Share Posted July 27, 2012 Hmm... it was 4:30 am when I posted this, Strange let me see what I stuff up, checking now. Quote Link to post Share on other sites
Praney Behl 314 Posted July 27, 2012 Author Report Share Posted July 27, 2012 Ok after a few splashes of Water on my eyes, I now see the problem. I added the prong variable. Here: Prepend to file(Corrected) define $prepend to list(#Filename, #Text To Prepend To List) { set(#list, $read file(#Filename), "Local") save to file(#Filename, "{#Text To Prepend To List} {#List}") } define $prepend to list(#Filename, #Text To Prepend To List) { save to file(#Filename, "{#Text To Prepend To List} {$read file(#Filename)}") } Hey Praney thanks for sharing. The append code works fine for me but the prepend doesn't. The first prepend code (version on the OP) erases everything on the file and the second code (short version)just ads a blank space on top. Any one else having this issue? Now I just need to figure out how to do the same with tables 3 Quote Link to post Share on other sites
Praney Behl 314 Posted July 27, 2012 Author Report Share Posted July 27, 2012 Also if you prefer using the shell command you can use the following command: cat file.txt | pbcopy && echo "Text to prepend" > file.txt && pbpaste >> file.txt 2 Quote Link to post Share on other sites
blumi40 222 Posted July 27, 2012 Report Share Posted July 27, 2012 copy file1 + file2 > file3 works fine for cmd copy *.csv > newfile.txt also Quote Link to post Share on other sites
wiremarket 1 Posted March 30, 2013 Report Share Posted March 30, 2013 Do I have to have the Dev version in order to add this command to my ubot studio? Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.