Skip to main content
Lindquist
Participating Frequently
August 31, 2018
Answered

Can I make a button to run a script?

  • August 31, 2018
  • 6 replies
  • 11780 views

I have a script that I will be using frequently, but going to File > Scripts every time may become pretty tiring - even though it's very useful.

Is it possible to build a panel or create a button that will activate a script? I have some coding knowledge and am willing to try making it myself if someone can point me in the right direction...

Correct answer Silly-V

It's possible to create a pure extendscript panel using the floating panel JET mentions, but in order to do this you will have to know the Adobe extendscript javascript, the ScriptUI methods for creating the visual interface such as the dialogs/palettes and then because we're using Illustrator, you will need to use the BridgeTalk object to send the communication between a floating panel and the actual Illustrator application.

Luckily, I've made one some time ago: Adobe-Illustrator/ScriptPanel_2.jsx at master · Silly-V/Adobe-Illustrator · GitHub

The idea is to have a reference to this script inside your startup scripts, so it launches when you start up Illustrator and produces the buttons for your various scripts. The panel works by living somewhere on your network, or desktop, and when the script panel is placed in the same folder and is launched, it will turn all surrounding scripts into buttons and folders with scripts into category sections. Put a nested script panel in there to get a different set of tools to pop out.

6 replies

Inventsable
Legend
January 15, 2020

A lot of good answers and extensions here but I feel the thread is missing some crucial information. Evaluation of a script is as easy as:

 

$.evalFile(pathToFile)

 

So long as you can create a button, whether through HTML panel or ScriptUI, and trigger the above you can run any script from any button.

Silly-V
Legend
May 8, 2022

This does work, but not for cross-app methods. If you eval a file which has #target photoshop at the top, in Illustrator, the file will still run in Illustrator and not photoshop.

Alexander Ladygin
Inspiring
September 6, 2018
Known Participant
November 20, 2019

Hi Alexander, your extension is very very fantastic but unfortunately I can't install the latest version LAScripts_v1.1.0.zxp
It gives me this error "The extension has invalid signature or damaged. Please try to re-download it"
I tried to download with firefox, Chrome, Safari ... always same mistake when I install with Anastasiy's Extension Manager.
furthermore the previous version LAScripts_1.0.9.zxp only works the first time and then stops working ...
Thanks so much!

 

schroef
Inspiring
January 13, 2020

I had the same issue, but you can actually install it manually aswell.

  1. Change ZXP extension to zip and than unzip the folder
  2. Find the CEP folder on your OS, if you dont have "extensions" folder, simply make one
    Path

 

Mac: ~/Library/Application Support/Adobe/CEP/extensions/ Win 32bit: C:\Program Files\Common Files\Adobe\CEP\extensions\ Win 64bit: C:\Program Files (x86)\Common Files\Adobe\CEP\extensions\​

 

For me this worked and the panel showed 

Silly-V
Silly-VCorrect answer
Legend
September 4, 2018

It's possible to create a pure extendscript panel using the floating panel JET mentions, but in order to do this you will have to know the Adobe extendscript javascript, the ScriptUI methods for creating the visual interface such as the dialogs/palettes and then because we're using Illustrator, you will need to use the BridgeTalk object to send the communication between a floating panel and the actual Illustrator application.

Luckily, I've made one some time ago: Adobe-Illustrator/ScriptPanel_2.jsx at master · Silly-V/Adobe-Illustrator · GitHub

The idea is to have a reference to this script inside your startup scripts, so it launches when you start up Illustrator and produces the buttons for your various scripts. The panel works by living somewhere on your network, or desktop, and when the script panel is placed in the same folder and is launched, it will turn all surrounding scripts into buttons and folders with scripts into category sections. Put a nested script panel in there to get a different set of tools to pop out.

Lindquist
LindquistAuthor
Participating Frequently
September 4, 2018

This script is brilliant. This is exactly what I needed. Thank you!

Silly-V
Legend
September 4, 2018

Yea, have fun with it, keep in touch on here to let me know how it goes or if there's any problems you encounter along the way. I always push companies without an existing IT automation delivery mechanism to implement this panel because it means less headache for everyone involved when there's not duplicate or mis-versioned code sitting in individual people's desktop machines.

Srishti Bali
Community Manager
Community Manager
September 4, 2018
JETalmage
Inspiring
September 1, 2018

You can create dialogs (which can contain buttons, fields, and other controls), both as modal alerts and as non-modal palettes in ExtendScript. That doesn't perform the initial launch of the dialog, but as mentioned, an Action can do that.

So you can, for example, create an Action to serve as the button to avoid the arduous task of File>Scripts>MyElaborateScriptedSolution to simply open your scripted palette.

But that palette in turn can contain buttons, fields, and other controls to serve as a floating user interface for the options and interaction you want to provide while using the script.

It's not for scripting beginners. You'll need to search out the current documentation for it. As I recall, the buzzword for it was "ScriptUI" or some such.

JET

S_Gans
Community Expert
Community Expert
August 31, 2018

Hi. The closest answer to this would be to create actions. As of Illustrator CC2018, actions can include calls to a script. When you save an action that includes a script, the connection to the script remains with the action.

To create actions in Illustrator, please visit: Use actions to automate tasks in Illustrator

Adobe Community Expert / Adobe Certified Instructor