# Recreate Designer's Script Console in Perspective?

**URL:** <https://forum.inductiveautomation.com/t/recreate-designers-script-console-in-perspective/93631>\
**Category:** Ignition\
**Tags:** vision, perspective\
**Created:** [July 23, 2024, 7:54pm UTC](https://forum.inductiveautomation.com/t/recreate-designers-script-console-in-perspective/93631 "2024-07-23T19:54:28Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![DonPancoe](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/donpancoe/32/28698_2.png) [@DonPancoe](https://forum.inductiveautomation.com/u/DonPancoe)\
**Post date:** [July 23, 2024, 7:54pm UTC](https://forum.inductiveautomation.com/t/recreate-designers-script-console-in-perspective/93631/1 "2024-07-23T19:54:28Z")

</div>

I am having data analysts run scripts built around `system.tag.queryTagHistory()` in order to get "wide" tables out of our Historian (Postgres), suitable for use within analytics tools like JMP.

I need to add more analysts to this group, but I don't like giving them all full Designer access just to have them use the Script Console. Is there a way to recreate this function as a Perspective app so they can use it in their browser? Failing that, could I do it in Vision? Or are there other ways to go about this that I am missing? Thank you.

---

<div class="post-metadata">

**Author:** ![DonPancoe](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/donpancoe/32/28698_2.png) [@DonPancoe](https://forum.inductiveautomation.com/u/DonPancoe)\
**Post date:** [July 23, 2024, 7:58pm UTC](https://forum.inductiveautomation.com/t/recreate-designers-script-console-in-perspective/93631/2 "2024-07-23T19:58:01Z")

</div>

Is there a way to access the Ignition Gateway domain from an external Python scripting environment? Meaning that I could use `system.tag.queryTagHistory()` in another Python environment to access the Historian data?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 23, 2024, 8:23pm UTC](https://forum.inductiveautomation.com/t/recreate-designers-script-console-in-perspective/93631/3 "2024-07-23T20:23:24Z")

</div>

> [@DonPancoe](#):
>
> Is there a way to recreate this function as a Perspective app so they can use it in their browser?

Sure. A Perspective UI can certainly call this API, and produce CSVs or Excel files for download.

Some reading for you:

[https://forum.inductiveautomation.com/search?q=system.tag.queryTagHistory%20system.perspective.download](https://forum.inductiveautomation.com/search?q=system.tag.queryTagHistory%20system.perspective.download)

---

<div class="post-metadata">

**Author:** ![DonPancoe](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/donpancoe/32/28698_2.png) [@DonPancoe](https://forum.inductiveautomation.com/u/DonPancoe)\
**Post date:** [July 24, 2024, 12:18pm UTC](https://forum.inductiveautomation.com/t/recreate-designers-script-console-in-perspective/93631/4 "2024-07-24T12:18:11Z")

</div>

Thank you for the info. It will be useful to build a CSV export application, with check boxes, pull-down lists etc. to configure the file to be downloaded.

I was also hoping to build a more generic-use Python script console though, since I so often use that for experimentation. ChatGPT and I could extract the script from a text area object and execute it using the Python `exec(script)` command, but getting the console output to appear in the Perspective window proved problematic. Many "can't write str to text stream" errors ensued.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 24, 2024, 12:26pm UTC](https://forum.inductiveautomation.com/t/recreate-designers-script-console-in-perspective/93631/5 "2024-07-24T12:26:08Z")

</div>

> [@DonPancoe](#):
>
> generic-use Python script console though

Extremely dangerous in a Web Application. It is the poster child for "Remote Code Execution" vulnerability.

Note that the designer script console doesn't execute on the gateway. It executes on the designer workstation with workstation privileges. Perspective runs all its script on the gateway, where the slightest mistake (or malice) could be catastrophic.

That you are using ChatGPT tells me you are too inexperienced to to be trusted with such a tool.

When you are sufficiently experienced to not use ChatGPT, you will understand why it is a terrible idea, and not do it at all.

---

<div class="post-metadata">

**Author:** ![DonPancoe](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/donpancoe/32/28698_2.png) [@DonPancoe](https://forum.inductiveautomation.com/u/DonPancoe)\
**Post date:** [July 24, 2024, 1:35pm UTC](https://forum.inductiveautomation.com/t/recreate-designers-script-console-in-perspective/93631/6 "2024-07-24T13:35:25Z")

</div>

I'm now realizing that providing full scripting access could be just as dangerous as providing full Designer access, which is what I was trying to avoid with this exercise.

Belittling my skill and experience just because I've used ChatGPT was uncalled for, however.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 24, 2024, 1:46pm UTC](https://forum.inductiveautomation.com/t/recreate-designers-script-console-in-perspective/93631/7 "2024-07-24T13:46:22Z")

</div>

> [@DonPancoe](#):
>
> because I've used ChatGPT

This [forum's rules](https://forum.inductiveautomation.com/faq) _ **strongly** _ discourage use of any LLM--not quite banned, but close--for Ignition tasks.

On top of that, I've seen too many posts on other technical fora where an LLM produced utterly bogus code that fooled an inexperienced person. LLMs are really good bull-[expletive]s when they don't find the right answer in their training material.

My criticism of your use of ChatGPT is not personal at all. (I reject the "belittling" characterization. It's just an uncomfortable truth.)

Moving forward, consider making a Perspective user interface that accepts the common parameters you need for history queries and downloads, with a fixed script.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [July 25, 2024, 4:24am UTC](https://forum.inductiveautomation.com/t/recreate-designers-script-console-in-perspective/93631/8 "2024-07-25T04:24:27Z")

</div>

> [@DonPancoe](#):
>
> exec(script)

This is always going to get barked at no matter where it's posted because having `exec` in a position that accepts user inputs is a well known bad practice.

> [@DonPancoe](#):
>
> ChatGPT

I'm aware that a lot of experienced developers have been creating novel ways to interface with chatGPT's API, but we don't see much of the cool stuff in this schema. The regular volunteers of this forum have been confronted with a lot of embarrassingly hallucinogenic LLM code, and from what I've read, other forums haven't fared that much better. I imagine that there a scenarios where the prompt outputs have been a success, but there simply isn't much cause to post code that isn't causing a problem, so we never see that.

Well earned cognitive biases aside, I am curious, what is your use case here? Why is code entered into a web facing script console being sent to chatGPT?

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [July 25, 2024, 6:01am UTC](https://forum.inductiveautomation.com/t/recreate-designers-script-console-in-perspective/93631/9 "2024-07-25T06:01:11Z")

</div>

Maybe you could set up a read only access to the database and skip the ignition part entirely for this ?
