Find and Replace for Script and Expression Elements

Post your feature requets for new triggers, conditions, actions and other improvements.

Moderator: Martin

Locked
Pepy
Posts: 76
Joined: 31 Oct 2018 10:53
Location: Canada

Find and Replace for Script and Expression Elements

Post by Pepy » 22 Jun 2019 06:48

Could be that I'm bad at searching but I'm surprised something like this hasn't been requested yet.

This could be useful:
  • when you want to change all instances of a variable's name.
  • for editing flow descriptions. For example, I often write "This flow works in conjunction with flow_name" to explicitly state that they cannot function without one another so if I were to change the name of the mentioned flow, I would have to go through and update the name of the flow in the description of all flows where it is mentioned.
  • making small grammar changes. This one might be stupid, but I occasionally change a word from time to time whether it's something as simple as adding a hyphen in between or changing the casing of words. Having to go through each and every instance of this in every flow description is an absolute pain.
Last edited by Pepy on 22 Jun 2019 20:44, edited 1 time in total.
Hope my post was helpful :D
Device: OnePlus 5T running crDroid, rooted with Magisk 8-)

User avatar
webtrekker
Posts: 14
Joined: 30 May 2019 23:58

Re: Find and Replace for Script and Expression Elements

Post by webtrekker » 22 Jun 2019 11:01

Yes, this would be very useful.

I now edit most scripts in Notepad++ on my PC, where I can use more powerful features, such as the Find/Replace mentioned to change the name of all instances of a particular variable in the script. Syncing between Notepad++ and my PC is easily done using ClipSync on my Android phone, as I've described in another recent post.

Pepy
Posts: 76
Joined: 31 Oct 2018 10:53
Location: Canada

Re: Find and Replace for Script and Expression Elements

Post by Pepy » 22 Jun 2019 21:17

Good idea using a third-party app to edit code and then copying it over; this way you won't have to worry about other things in addition to this such as spacing and tabs plus the fact that you can have a more customizable theming experience as well. I've given ClipSync a try in the past, but don't remember why I ended up uninstalling it, perhaps because Pushbullet already offers that functionality in addition to many more.

Thanks for your suggestion, I'll be using Atom editor to edit the code and then then using Pushbullet to transfer the code for now, at least until the built-in editor gets better. But using this method you would lose the functionality to insert snippets, variables and functions directly into the code. It's also going to be quite annoying to have to copy and paste the code over every time you want to test it out.
Hope my post was helpful :D
Device: OnePlus 5T running crDroid, rooted with Magisk 8-)

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Find and Replace for Script and Expression Elements

Post by Desmanto » 23 Jun 2019 17:33

+1 for this.
I also use Notepad++, mirrored using scrcpy for flow overview. But if I don't have access to PC, I use MiXplorer text/code editor instead. It has the standard feature that notepad++ has.

Maybe script editor UI can be added with some extra feature : Line numbers, find and replace, go to, custom user function (similar to autotext). This works only for this script/expression/control UI. For all flow replacing, it is quite dangerous, so I would not recommend it.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Pepy
Posts: 76
Joined: 31 Oct 2018 10:53
Location: Canada

Re: Find and Replace for Script and Expression Elements

Post by Pepy » 23 Jun 2019 22:46

Desmanto wrote:
23 Jun 2019 17:33
Maybe script editor UI can be added with some extra feature : Line numbers, find and replace, go to, custom user function (similar to autotext). This works only for this script/expression/control UI. For all flow replacing, it is quite dangerous, so I would not recommend it.
I've already sent a request to Martin (to which he added to his to-do list) for line numbers. I can add them to this thread though and make the title more generic (eg. Script Enhancements).
Hope my post was helpful :D
Device: OnePlus 5T running crDroid, rooted with Magisk 8-)

Locked