# Help With Back To Basics Using Functions

**URL:** <https://forums.creativeclouddeveloper.com/t/help-with-back-to-basics-using-functions/4469>\
**Category:** UXP Plugin API\
**Created:** [March 28, 2022, 10:23am UTC](https://forums.creativeclouddeveloper.com/t/help-with-back-to-basics-using-functions/4469 "2022-03-28T10:23:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![IanBarber](https://avatars.discourse-cdn.com/v4/letter/i/94ad74/32.png) [@IanBarber](https://forums.creativeclouddeveloper.com/u/IanBarber)\
**Post date:** [March 28, 2022, 10:23am UTC](https://forums.creativeclouddeveloper.com/t/help-with-back-to-basics-using-functions/4469/1 "2022-03-28T10:23:21Z")

</div>

I would appreciate it if someone can help me with this basic function question.

Here is some code which returns whether the image is RGBColor or something else.

```auto
async function imageMode() {

  await exeModal(doStuff, {
    "commandName": "Please Wait"
  });

  async function doStuff(executionContext) {

    //do stuff here..
    const result = await batchPlay(
      [{
        _obj: "get",
        _target: [{
          _ref: "document",
          _id: 219
        }],
        _options: {
          dialogOptions: "dontDisplay"
        }
      }], {
        synchronousExecution: false
      });
    const pinned = result[0].mode._value;
    
    console.log(pinned);

  }
}

```

This works fine and outputs the result to the console.  
What I am trying to learn is how to call this function anywhere and output the result.

---

<div class="post-metadata">

**Author:** ![Karmalakas](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/karmalakas/32/1048_2.png) [@Karmalakas](https://forums.creativeclouddeveloper.com/u/Karmalakas)\
**Post date:** [March 28, 2022, 10:57am UTC](https://forums.creativeclouddeveloper.com/t/help-with-back-to-basics-using-functions/4469/2 "2022-03-28T10:57:01Z")

</div>

You don’t need `exeModal()` for getters 🤔 Just do a BP and get the result

---

<div class="post-metadata">

**Author:** ![IanBarber](https://avatars.discourse-cdn.com/v4/letter/i/94ad74/32.png) [@IanBarber](https://forums.creativeclouddeveloper.com/u/IanBarber)\
**Post date:** [March 28, 2022, 10:58am UTC](https://forums.creativeclouddeveloper.com/t/help-with-back-to-basics-using-functions/4469/3 "2022-03-28T10:58:12Z")

</div>

Can you give me an example from my code so I can learn please if you have time

---

<div class="post-metadata">

**Author:** ![IanBarber](https://avatars.discourse-cdn.com/v4/letter/i/94ad74/32.png) [@IanBarber](https://forums.creativeclouddeveloper.com/u/IanBarber)\
**Post date:** [March 28, 2022, 11:00am UTC](https://forums.creativeclouddeveloper.com/t/help-with-back-to-basics-using-functions/4469/4 "2022-03-28T11:00:08Z")

</div>

Ah, I see what you mean thank you
