API

Share and discuss your flows and ideas with other users.

Moderator: Martin

Post Reply
User avatar
Bluscre
Posts: 144
Joined: 31 Aug 2017 13:58
Location: Germany
Contact:

API

Post by Bluscre » 10 Sep 2017 14:21

Since i kept using the same stuff over and over again in many different flows i wanted to have the most important stuff in a common API flow that i can execute from within another flow. This is what i came up with (TheSlingShotChannel reference, lol)

Preview: Github | AutoMagic

Download: Github (recommended) | AutoMagic

Source: Github
Unofficial AutoMagic Telegram Group: http://t.me/automagic4android
Check out my other flows here: https://github.com/Bluscream/AutoMagicFlows or here.
Sent from my Lenovo TAB 2 A10-70L running Android 6.0.

User avatar
Bluscre
Posts: 144
Joined: 31 Aug 2017 13:58
Location: Germany
Contact:

Functions Reference

Post by Bluscre » 10 Sep 2017 14:30

Function: api_openSettings
Parameter: java.lang.String: api_OpenSettings
Description: Uses Androids native method to open a settings screen (List of all possible screens)

Code: Select all

Script: api_openSettings = "ACCESSABILITY_SETTINGS";
Execute Flows: API
Function: api_splitURL
Parameter: java.lang.String: api_splitURL
Return: java.util.Map: api_splitURL
Description: Performs several tests and actions on the input string to check wether its a valid URL and returns a map with the results.

Code: Select all

Script: api_splitURL = "https://www.youtube.com/path/to/file.html?key1=value1&key2=value2&key3=value3#body";
Execute Flows: API
Notification on Screen: {api_splitURL["valid"]} (long)

Code: Select all

{
  "url": "https://www.youtube.com/path/to/file.html?key1=value1&key2=value2&key3=value3#body",
  "valid": true,
  "scheme": "https",
  "fullhost": "www.youtube.com",
  "host": {
    "sub": "www",
    "main": "youtube",
    "tld": "com"
  },
  "port": 443,
  "fullpath": "/path/to/file.html",
  "path": [
    "",
    "path",
    "to",
    "file.html"
  ],
  "fullquery": "key1=value1&key2=value2&key3=value3",
  "query": {
    "key1": "value1",
    "key2": "value2",
    "key3": "value3"
  },
  "fragment": "body"
}
Function: api_getApp
Parameter: java.lang.String: api_getApp
Parameter: java.lang.String: api_getApp_title
Parameter: java.lang.String: api_getApp_default
Return: java.lang.String: api_getApp_app
Description: Asks the user to select a app from a input dialog and returns that app. (Based on this flow. Also visually shows the user that the apps are currently loading through a widget.

Code: Select all

Script: api_getApp = true;api_getApp_title = "Select app to kill";api_getApp_default = "AutoMagic Premium";
Execute Flows: API
Execute Root Command: am kill {api_getApp_app}
Function: api_getApps
Parameter: java.lang.String: api_getApps
Parameter: java.lang.String: api_getApps_title
Parameter: java.lang.String: api_getApps_default (comma seperated)
Return: java.util.list: api_getApps_apps
Description: Asks the user to select one or more apps from a input dialog and returns that apps. (Based on this flow. Also visually shows the user that the apps are currently loading through a widget.

Code: Select all

Script: api_getApps = true;api_getApps_title = "Select apps to kill";api_getApps_default = "AutoMagic Premium,Youtube";
Execute Flows: API
Execute Root Command: am kill {join(api_getApp_apps, " ")}
Function: api_getColorByID (WIP)
Parameter: java.lang.String: api_getColorByID (Element ID as used in Action: UI Script)
Description: Returns the pixel color of a element by ID. Currently in Progress, unusable!

Code: Select all

Script: api_getColorByID = "com.google.android.apps.youtube.gaming:id/like_button";
Execute Flows: API
Notification on Screen: {api_getColorByID} (long)
Unofficial AutoMagic Telegram Group: http://t.me/automagic4android
Check out my other flows here: https://github.com/Bluscream/AutoMagicFlows or here.
Sent from my Lenovo TAB 2 A10-70L running Android 6.0.

Post Reply