I am so new to xojo scripting I simply don't know and can't seem to find out; how do I reference a line at a time in a method with scripting language?
I mean in the IDE script I am creating, If I assume that all the text,lines, etc in the module can be referenced by refering to the word Text, can I do this?
dim x as integer
if x <> -1 then
I want to be able to replace any matching string I give it with something else. The ReformatCode.xojo.script script works fine, but I want to create a simple script that only replaces certain instances of words with something else. If I am somehow referring to all lines of code in my method by using the word Text, then how can I specify the line I'm on?
By the way the above code does not work it gives me Compiler error (87).
Might I suggest you grab this https://github.com/JulianSamphire/ReformatCode
Either alter the source and add your personal additions to RC_ReplaceList() on line 25 or add the following string constant to your app:
Inside that string constant write
and the alterations will be picked up automagically ;)
Oops, I forgot to answer your actual question. Unfortunately the reformat code script can't reference anything outside of the line or code block that it's currently working on. Also, there's currently a bug (Feedback Case #52343) so you can't even reference each line of a block that you're processing (i.e. from a pasted chunk of code).
Thank you so much. I have been doing exactly that and it works beautifully, but I am trying to learn how to use this feature and it is pretty cryptic to me. I am attaching an image of the IDE. This is what thought you meant, but it doesn't work for me, or at least it doesn't change anything. What I am confused about now is if I create a new script with only the word ReplaceWords in it, am I doing it correctly? Will putting this constant in my app take care of it or do I have to mention it in my script?
As you can see I tried to insert the image but I don't know how to change the path to my Desktop. If it doesn't ask me to upload or drag and drop I don't know how to get it on the page. When I tried to drag it, it took over the entire window and wouldn't let me do anything else.
Its only possible because Norman implemented it in the IDE so I could write that reformat code script :)
Technically ReplaceWords will work for changing the case too, so you could enter:
and it would change hello to HELLO and similarly for case
would change hello to HeLLo
Or had you some other method/system in mind?