Web-based Macro Editor

Jack

New member
I've been using Macrodroid for several years and its great, but a pain to made macros with. All the menus and options are good but slow you down.

I think a web based macro generated/editor designed for a pc could really speed things up. You could insert actions, but instead of navigating all those menus to configure it, they would all be accessed in properties menu. You could do a command shift then start typing to search and insert actions.

I know macros are probably supposed to be small and simple, but with so many features are in Macrodroid, you have a lot of power, the UI it just limiting you based on how many menus you want to navigate.

I know this is a massive suggestion; its just an idea to consider when your deciding which direction you want to take this app.
 

Chilangosta

New member
An IDE, especially a web-based one, might be a big leap. Something that could translate to/from the macro file export (it's a JSON structure) wouldn't be too hard probably - like a config file that could be built to generate the macro. Then you could use ADB to connect directly to your phone and quickly write and test macros.
 

dsnz

Well-known member
an easier solution to implement initially is to import/export a plain text of a new programming language (mdroid language ? :))
 

Jack

New member
An IDE, especially a web-based one, might be a big leap. Something that could translate to/from the macro file export (it's a JSON structure) wouldn't be too hard probably - like a config file that could be built to generate the macro. Then you could use ADB to connect directly to your phone and quickly write and test macros.
I agree it would be a big leap. It doesn't seem like a small feature though. Is there any documentation on the JSON structure? Connecting with ADB would be really helpful for even faster testing.

an easier solution to implement initially is to import/export a plain text of a new programming language (mdroid language ? :))
That was actually my original idea. I don't know if it would be easier to make a programing language or a something like I suggested. I'd personally prefer the language vs the gui, however a language would be a massive undertaking and might only be used by a fraction of the community. Maybe the PC version could have an option for both?
 

dsnz

Well-known member
I don't mean a full new language like used today. Something simpler and line oriented like basic. A simple text line by line representation of the program. what you see on screen in text and not json.
And initially not all commands will be fully represented but instead a subset and the user would need to configure manually these commands (sorry... but I propose this so the developer can work in improvement steps in his limited time).

To make more clear the proposal here are some examples for 'set variable' action

gv var2 bool = true
-- this is a comment
-- in the following vars are represented simply by name instead [lv=var5] because it's much easier this way and the [] notation is kept for the other system/mdroid variables
lv var3 dec = var1/10+var5^2
gv user_data = prompt(title, descr, cancel=>true)
-- the => above is for default value that gets a different value at call
...

there are some choices to be made initially, if most actions should be language statements or function calls
(personally I think statements are more fluid and more natural for mdroid)
 

Jack

New member
That still would be a massive undertaking. How would you handle things like triggers and constraints?
 

dsnz

Well-known member
as I said the main idea is to present in a plain text form what we now see visually ,
or think how you would read code from macrodroid ui and write it down yourself on paper line by line

it's certainly much less effort than a web based ide

about the triggers and constraints, quite simply have sections of code, for example

. triggers
screen-unlocked
screen-off

. code
...

. constraints
time-of-day 08:00 21:00
 

Chilangosta

New member
I agree that it would be nice, and that it would be less work than a full IDE much less a web IDE.

Tasker has some standard text formatting that can be parsed; I've attached an example below (more here):

Code:
    Control:
    "
    version_number: 0.3.0
    "
    
    Input %par1: #optional
    "
    indent_character_type
    min_indent_character_count
    max_indent_character_count
    single_indent_character_count
    cap_indents_at_max_indent_character_count
    split_action_parameters_on_multiple_lines
    convert_code_to_markdown_code_block
    set_clipboard_to_formatted_code
    "
    
    If task is successful, then formatted_code will contain the formatted code description.
    Otherwise it will not be set.>
    A1: Anchor

    A2: Variable Set [
        Name:%task_name
        To:Format Task Description For Markdown
        Recurse Variables:Off
        Do Maths:Off
        Append:Off
        Max Rounding Digits:3 ]
...

As I said before though, Macrodroid already has a JSON-based text output that we could start manipulating already:
Code:
{
  "localVariables": [
    {
      "excludeFromLog": false,
      "isLocal": true,
      "m_booleanValue": false,
      "m_decimalValue": 0,
      "m_intValue": 0,
      "m_name": "flags",
      "m_stringValue": "a",
      "m_type": 2
    },
    {
      "excludeFromLog": false,
      "isLocal": true,
      "m_booleanValue": false,
      "m_decimalValue": 0,
      "m_intValue": 0,
      "m_name": "props",
      "m_stringValue": "this",
      "m_type": 2
    },
    {
      "excludeFromLog": false,
      "isLocal": true,
      "m_booleanValue": false,
      "m_decimalValue": 0,
      "m_intValue": 0,
      "m_name": "json_raw",
      "m_stringValue": "{\"args\": [\"-a yet -b another -c capture capture2 234()\"]}",
      "m_type": 2
    },
    {
      "excludeFromLog": false,
      "isLocal": true,
      "m_booleanValue": false,
      "m_decimalValue": 0,
      "m_intValue": 0,
      "m_name": "parse_output",
      "m_stringValue": "%arg(),",
      "m_type": 2
    }
  ],
  "m_GUID": -9098729433414658000,
  "m_actionList": [
    {
      "m_option": 2,
      "m_text": "-a yet -b another -c capture capture2 234",
      "m_textManipulation": {
        "type": "ExtractTextManipulation",
        "params": [
          "(?<arg>(-.+?\\s)?.+?)(\\s|$)",
          "2"
        ]
      },
      "m_variable": {
        "excludeFromLog": false,
        "isLocal": true,
        "m_booleanValue": false,
        "m_decimalValue": 0,
        "m_intValue": 0,
        "m_name": "ls_args",
        "m_stringValue": "",
        "m_type": 2
      },
      "m_SIGUID": -4623476115158164000,
      "m_classType": "TextManipulationAction",
      "m_constraintList": [],
      "m_isDisabled": false,
      "m_isOrCondition": false
    },
    {
      "m_plugin": {
        "mActivityClassName": "com.joaomgcd.autotools.activity.ActivityConfigRegex",
        "mConfiguration": {
          "mAlternatives": [],
          "mIsBackwardsCompatibilityEnabled": false,
          "mIsBlacklisted": false,
          "mIsBuggy": false,
          "mIsDisruptsConnectivity": false,
          "mIsDrainsBattery": false,
          "mIsRequiresConnectivity": false
        },
        "mPackageName": "com.joaomgcd.autotools",
        "mReceiverClassName": "com.joaomgcd.autotools.broadcastreceiver.BroadcastReceiverFire",
        "mRegistryName": "com.joaomgcd.autotools:com.joaomgcd.autotools.activity.ActivityConfigRegex",
        "mType": "SETTING",
        "mVersionCode": 180
      },
      "m_pluginInstanceData": {
        "mBlurb": "Text: -a yet -b another -c capture capture2 234\nRegex: (?<arg>.*)\nUse Regex Plus: true\nGet Multiple Results: true\nOutput Text: %arg(),",
        "mRegistryName": "com.joaomgcd.autotools:com.joaomgcd.autotools.activity.ActivityConfigRegex",
...
      }
    }
  ]
}
...

Some builder/parser for the JSON would be in order, but that would probably be far simpler and quicker than a full language, or rewriting the JSON output.
 

Jack

New member
So in essences, we just want an easier syntax then the JSON .macro syntax, possibly text based.

Could this parser hinge on a JSON config file with all triggers/actions/constraints and all their acceptable values? It could also provide a text based syntax that uses regex to parse it?

If this where the case then the majority of the work would actually be in creating this JSON file and maintaining it. If this JSON file exists, adding a web based UI wouldn't be nearly as hard as it could take advantage of that.
 

Chilangosta

New member
JSON readers come native with most modern high-level languages nowadays; parsing it would be fairly easy and wouldn't require regex. I think the biggest piece of this would just be a map file that connected the terms used in the JSON output file with the more understandable terms we want to use in this "IDE" or whatever translation layer it lives in.

I'd be happy to share whatever I build; I've got a current project on the backburner that involves parsing that out already, so I'll add those findings here when I get a chance to dig into it.
 

Jack

New member
JSON readers come native with most modern high-level languages nowadays; parsing it would be fairly easy and wouldn't require regex. I think the biggest piece of this would just be a map file that connected the terms used in the JSON output file with the more understandable terms we want to use in this "IDE" or whatever translation layer it lives in. I'd be happy to share whatever I build; I've got a current project on the backburner that involves parsing that out already, so I'll add those findings here when I get a chance to dig into it.

Interesting. I completely agree that the map file would be the biggest piece. If designed correctly we could use this in many different places like text to macro or even ui to macro without much work.

How are you parsing your file currently (and in what language)? Regex was just my go-to because it can be stored in text (easy to be part of a config). In my mind, everything unique goes in the config, and everything else goes in code. Would you have like the first word it the key word and then the rest are just parameters for that function?
 

OscariBot

Active member
I am a huge Macrodroid user. I use text editor on pc to write all my macros then export them to macrodroid. It's simple and faster. But i know macrodroid wasn't design to be use that way, i just find it useful and faster especially when writing huge macros. I remember i propose something like this some time ago but it seems admin never intend macrodroid to be use that way.
 

Jack

New member
I am a huge Macrodroid user. I use text editor on pc to write all my macros then export them to macrodroid. It's simple and faster. But i know macrodroid wasn't design to be use that way, i just find it useful and faster especially when writing huge macros. I remember i propose something like this some time ago but it seems admin never intend macrodroid to be use that way.
Are you familiar with the JSON schema? I got an interface similar to what MacroDroid has, just optimized for a larger screen so widgets, the macro and their configuration could all be shown at the same time. I never got to know the JSON schema well enough or had the time to get it to export and then import to MacroDroid properly though.
 

FrameXX

Well-known member
I use text editor on pc to write all my macros then export them to macrodroid. It's simple and faster.
Doubt your statement. remembering all the properties names where a lot of them normal MacroDroid user won't even come around that they are being saved and dealt with. I can already see you remembering all the image resources MacroDroid uses in notification action, popup etc... Sounds like pain in the ass. Nonsense.
 

Endercraft

Moderator (& bug finder :D)
Doubt your statement. remembering all the properties names where a lot of them normal MacroDroid user won't even come around that they are being saved and dealt with. I can already see you remembering all the image resources MacroDroid uses in notification action, popup etc... Sounds like pain in the ass. Nonsense.
When I edit macros outside MacroDroid, I first create the macro with MacroDroid then export it to edit it directly to modify, remove and duplicate some parts. This way it is way easier to understand even if I have never (rarely) touched JSON before.
 

OscariBot

Active member
Doubt your statement. remembering all the properties names where a lot of them normal MacroDroid user won't even come around that they are being saved and dealt with. I can already see you remembering all the image resources MacroDroid uses in notification action, popup etc... Sounds like pain in the ass. Nonsense.
Hey!

I can't believe people still doubt possibilities of anything this days. (A wise man once said "if you wake up one day only to hear in the news that Ants now have the ability to swallow a whole human; believe it; for if it's true then you have saved your life, but if it's a lie then you have got nothing to loose.")

I want you to believe that anything is possible in this our tech age. I won't come to the forum here to post something i haven't tried. of what benefits will that be to me?

Like i said earlier, I am a huge MD user. I found a work-around to write macros on PC using text editor and it really speed things up for me. I understand MD wasn't programmed to be use this way hence your worries about the image resources MacroDroid uses in notification action, popup etc...

Very Possible.
 

chaoscreater

Active member
Hey!

I can't believe people still doubt possibilities of anything this days. (A wise man once said "if you wake up one day only to hear in the news that Ants now have the ability to swallow a whole human; believe it; for if it's true then you have saved your life, but if it's a lie then you have got nothing to loose.")

I want you to believe that anything is possible in this our tech age. I won't come to the forum here to post something i haven't tried. of what benefits will that be to me?

Like i said earlier, I am a huge MD user. I found a work-around to write macros on PC using text editor and it really speed things up for me. I understand MD wasn't programmed to be use this way hence your worries about the image resources MacroDroid uses in notification action, popup etc...

Very Possible.
Care to share the workaround?
 

CHZMN

New member
Just a thought (and maybe this was said earlier, but I didn't understand), but what if the editor wasn't exactly tied to MD?
My thinking:
  1. Use web based tool on macrodroid.com to create macro
  2. tool generates QR code scannable by MD with all macro info contained within it
  3. MD creates macro according to QR code, but waits for confirmation from user (that way it can be edited to precisely what the user wants)
Is this impossible?
 
Top