objective of this post. At a general level, it consists inf learn to find files, and search within those files At a specific level, the motivation for this post responds to a particular need. imagine that you want to overwrite at a specific node, the particular content of a file that is in another directory. If you don't use script groove, the solution is to go directly to the file location, open it, and then copy / paste. Here I provide you with some simple commands to easy your work. You can see...
I already found the solution, thanks to this link, http://chuwiki.chuidiang.org/index.php?title=Leer_y_Escribir_ficheros_de_texto_en_Groovy it is in Spanish because my native language is Spanish here the commands def dir = "C:/Users/My-PC/example.txt"; String [] def file = new File(dir) as String[] def size = file.size() def lastLine = file.getAt(size -1) this code is configured to locate the last line of a file... Basically, the solution is to convert the file into an array of String look here String...
I had diverted the conversation to another post https://sourceforge.net/p/freeplane/discussion/758437/thread/8d66f6869f/ , but the moderator is a bit stressed with me and is censoring me the reason for this change is because the objective of the post was changing. Initially the purpose was to send emails from freeplane But then I have observed that I was switching to reading files with freeplane With the intention of maintaining order in the forum, I decided to send new comments to another post
another problem. When the searched file does not have a .txt extension, the behavior is not always the same. we have two files, one has a .txt extension but the other does not Option A = "C:/example.txt" Option B = "C:/example" then we apply this command def lastLine = file.eachLine {line -> line} the result is Option A = "last line of the file" Option B = in option B, there is no result
I had diverted the conversation to another post https://sourceforge.net/p/freeplane/discussion/758437/thread/8d66f6869f/ , but the moderator is a bit stressed with me and is censoring me
observations with .txt files if the searched file has a .txt extension.. and we apply a code like this.. def dir = "C:/Users/My-PC/example.txt"; def file = new File(dir) we get all the text with these commands def data = file.getText() or def data = file.text get size def size = file.size() check and receive a boolean true / false def contains = file.contains('hello') get last line of file def lastLine = file.eachLine {line -> line} get the first line def firstLine = {it -> readLine()} file.withReader...
I also need some indications to solve my problems, as I indicated in https://sourceforge.net/p/freeplane/discussion/758437/thread/b00cc8df64/, and on the other hand, you do not help me, you only say that I am stressful. I don't quite understand why he rejects my post. in my previous post, send emails .(https://sourceforge.net/p/freeplane/discussion/758437/thread/b00cc8df64/). I found a difficulty related to the search for a specific line within a file. It is a problem that can happen to any user...
ok. for example the example.txt file searched has this content: Hola Hello salut if i apply this order file.each {it} file.each {println it} result in editor is Hola Hello salut result in node C:\User\My-PC\example.txt ¿...?