HARPA.AI
LIBRARYAPIGUIDESAI COMMANDSBLOG

📋  Say Command + Global Storage Management

The Say command returns what the user has typed. There is also a "Add" or " Delete" option to easily save text to the global storage, or delete a saved parameter.

Created by Morteza
Updated on Jan 14, 19:46
Installed 3 times
RUNS JS CODE

How to Use

IMPORT COMMAND

Content

- message: 'Please provide content to echo it:'
  options:
    - label: 🔎 SELECTED TEXT
      value: '{{selection}}'
    - label: 🔻 TRANSCRIPT
      value: '{{transcript}}'
    - label: 📑 PAGE
      value: '{{page}}'
    - label: ➕ ADD
      value: add
    - label: ➖ DELETE
      value: delete
    - $custom
  vision:
    enabled: false
    mode: area
    hint: ''
    send: true
  type: ask
  param: textContent
  default: ''
  optionsInvalid: false
  label: SAY INPUT
- type: group
  steps:
    - type: ask
      param: textContentGlobal
      message: Which text would you like to save globally?
      options: null
      default: ''
      vision:
        enabled: false
        mode: area
        hint: ''
        send: true
      condition: '{{textContent}} = add'
      label: SET TEXT | ADD
    - type: ask
      param: addParameter
      message: >-
        Create a parameter name! What should the global parameter be called?
        Like “param1” without “g.”
      options: null
      default: ''
      vision:
        enabled: false
        mode: area
        hint: ''
        send: true
      label: PARAMETER NAME | ADD
    - type: calc
      func: set
      param: g.{{addParameter}}
      format: ''
      value: '{{textContentGlobal}}'
      label: SET PARAMETER
    - type: say
      message: >-
        The parameter was created successfully and the list is saved in
        {{g.list.global.parameter}}!
      interpolate: false
      label: DISPLAY GLOBAL VARIABLES | ADD
    - type: js
      args: addParameter, g.list.global.parameter
      code: |-
        let globalList = args['g.list.global.parameter'] || '';
        const newParam = args.addParameter;

        if (globalList === '') {
          globalList = newParam;
        } else {
          globalList += ',' + newParam;
        }

        return globalList;
      param: globalList
      timeout: 15000
      onFailure: SET NEW VALUES TO LIST.GLOBAL.PARAMETER
      silent: true
      label: ADD TO GLOBAL PARAMETER LIST
  condition: '{{textContent}} = add'
  label: ADD PARAMETER GLOBAL STORAGE
- type: group
  steps:
    - type: ask
      param: deleteParameter
      message: >-
        Provide the name of the parameter you want to delete, such as: `param1`
        without the `g.`.
      options: null
      default: ' '
      vision:
        enabled: false
        mode: area
        hint: ''
        send: true
      label: PARAMETER NAME | DELETE
    - type: calc
      func: delete
      param: g.{{deleteParameter}}
      label: DELETE PARAMETER
    - type: say
      message: >-
        The parameter was deleted successfully and the list is shown in
        {{g.list.global.parameter}}!
      interpolate: false
      label: DISPLAY GLOBAL VARIABLES | DELETE
    - type: js
      args: deleteParameter, g.list.global.parameter
      code: |-
        let globalList = args['g.list.global.parameter'] || '';
        const paramToDelete = args.deleteParameter;

        if (globalList !== '') {
          const params = globalList.split(',');
          const updatedParams = params.filter(param => param !== paramToDelete);
          globalList = updatedParams.join(',');
        }

        return globalList;
      param: globalList
      timeout: 15000
      onFailure: SET NEW VALUES TO LIST.GLOBAL.PARAMETER
      silent: true
      label: DELETE FROM GLOBAL PARAMETER LIST
  label: DELETE PARAMETER GLOBAL STORAGE
  condition: '{{textContent}} = delete'
- type: group
  steps:
    - type: say
      message: User input is empty!
      condition: '{{textContent}} ='
      label: OUTPUT NULL
    - type: say
      message: '{{textContent}}'
      label: SAY OUTPUT
      condition: '{{textContent}} !='
    - type: jump
      to: SAY INPUT
  label: JUST THE SAY INPUT | ECHO
  condition: '{{textContent}} =~ \b(?!add$|delete$)\w+|\s+'
- type: group
  steps:
    - type: say
      message: ▶️ GROUP
    - type: calc
      func: set
      param: g.list.global.parameter
      format: auto
      value: '{{globalList}}'
      label: SET NEW VALUES TO LIST.GLOBAL.PARAMETER
    - type: say
      message: |-
        **Global Parameters List:**

        `{{g.list.global.parameter}}`
      label: DISPLAY EXISTING GLOBAL PARAMETER
    - type: jump
      to: SAY INPUT
  label: LIST GLOBAL PARAMETER
  condition:
    - '{{textContent}} = add'
    - '{{textContent}} = delete'
Notice: Please read before using

This automation command is created by a community member. HARPA AI team does not audit community commands.

Please review the command carefully and only install if you trust the creator.

Contact us
HomeUse CasesGuidesPrivacy PolicyTerms of Service
CAN WE STORE COOKIES?
Our website uses cookies for the purposes of accessibility and security. They also allow us to gather statistics in order to improve the website for you. More info: Privacy Policy