• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

script runner Ui palette

Community Beginner ,
May 05, 2022 May 05, 2022

Copy link to clipboard

Copied

Hi, we have multiple .jsx script files using illustrator document, every time we go to file other scripts and run my scripts. Is it possible to make a .jsx script runner Ui palette like an action palette?

TOPICS
Scripting

Views

2.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
May 05, 2022 May 05, 2022

Copy link to clipboard

Copied

Yes, various scripters have made such things in the past. I haven't evaluated any but examples can be found in this thread:

https://community.adobe.com/t5/illustrator-discussions/can-i-make-a-button-to-run-a-script/td-p/1004...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 05, 2022 May 05, 2022

Copy link to clipboard

Copied

This thread was more helpful.

Thanks Doug

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 05, 2022 May 05, 2022

Copy link to clipboard

Copied

Actually I have updated the ScriptPanel_2 just recently. Now it runs scripts in an even better way, and potentially is on the way to be extended to allow user configured sequences of various buttons to execute as a multi-execution. This is now with a new and improved BT method which can output a result for the next script to ingest as a special parameter.
But most importantly for all users is that it now does a couple of new things very differently from the old way:

  1. Copy scripts to temp folder and then execute. <-- I found that scripts in dropbox in some cases don't execute properly. They execute, but the actions in Illustrator they run become disconnected with the document in weird ways. It's the worst kind of error because for the most part and in all basic cases such scripts work OK and fail just when they are needed most. Copying the scripts first seems to solve this issue!
  2. Restarting the panel works with Ctrl+Click on the mini-tab now. Previously due to ScriptUI, it used to take the user two times to ctrl-click the panel, only the 1st one being necessary with Ctrl, because it would not refresh correctly. In fact it was so confusing, I thought I was using a wrong modifier key. Anyways, now it's fixed so the entire window disappears and a whole new one is put into its place. Let me repeat that folks: even if changes are made to this script to make it act differently, a ctrl+click on the mini-tab totally executes a new instance of this script! It does so by being runnable with arguments and one of the arguments is the path to its file. So when it runs a new instance of the script panel with the new & improved code, it passes its location to itself. Basically now users only need to ctrl click to refresh their panel and receive hot changes.

Speaking of the hot changes, at all times due to the mechanical nature of this system, any change to a script file will mean the next time a user clicks the button, they will run the new version of that script. I have made a deployment compilation nodejs script that helps me output certain configurations. My users get a dev version panel to test things out, and then they get promoted to the production-level panel.
It's super cool ^_^

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 05, 2022 May 05, 2022

Copy link to clipboard

Copied

Best you can do is in action flyout use Insert menu Item and type "Other scr" then click find it will fill in the rest and update to Title Case, so you know you got the right command.

MikeGondek_0-1651761150038.png

 

You may wish to move your scripts to this folder  on windows, similar on mac

C:\Program Files\Adobe\Adobe Illustrator 2021\Scripting

 

restart illustrator, and they will show up under File >> Scripts. If you have many scripts you can use folders to group them by category.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 05, 2022 May 05, 2022

Copy link to clipboard

Copied

 

Now we work on the same option but its frustration.

Thank you Mike,

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 06, 2022 May 06, 2022

Copy link to clipboard

Copied

If you are looking for a simple, easy-to-use and straightforward Scripts palette, I can recommend two that are very similar to each other. One is called "ScripshonTrees" and the other is called "Scripts Panel". Both can be simply installed via Creative Cloud Plugin administration and do also work in Photoshop ("ScripshonTrees" also in InDesign).

 

ai_script_palettes_001.png

 

"ScripshonTrees" has a nice search function that may be very useful if you have many scripts inside nested folders.

 

Probably the most sophisticated Scripts palette out there at the moment is called "LAScripts", provided by Alexander Ladygin. It comes with an additional Toolbar palette that may be useful sometimes.

 

"LAScripts" is more than just a script executor. It also has a pretty good source code editor to modify scripts on the fly and some other useful things. It works in Illustrator, InDesign and Photoshop.

 

ai_script_palettes_002.png

 

Unfortunately, at the moment it is a bit tricky to install "LAScripts". Theoretically, it can simply be installed in your Creative Cloud Plugin administration, but this way the installation won't work properly and only shows an empty palette most of the time. You have to install it manually with some additional adjustments. Then it works well.

 

I haven't tried Silly-V's approach so far, but will do it certainly. Thanks for sharing, Silly-V.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 07, 2022 May 07, 2022

Copy link to clipboard

Copied

Silly-V,

 

I tried your Script Panel 2 today. I'm quite impressed about its well thought-out settings and the palette itself looks pretty good.

 

However, I'm facing a major problem: The scripts don't get executed when double-clicking a script item in the palette. Nothing happens at all.

 

Do you perhaps have an idea what I may be overlooking?

 

Illustrator version: 26.2.1
Mac OS version 12.0.1

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 07, 2022 May 07, 2022

Copy link to clipboard

Copied

I believe you just single-click those buttons and it should work.

But, these scripts may have to written in a certain way.

It should work with all ways though, but maybe something in my latest changes makes it only work with this type of script:

 

 

//@target illustrator
function test_1 () {
	alert("Hello World!");
}
test_1();

 

 I haven't tested it with a script that isn't wrapped in a function like so, maybe that's the issue.

 

Edit: I apparently have done some more changes to it and just pushed them up. Not sure if it would make it better or worse though. But it still does work on 'my machine', so you should also see a result like this:

SillyV_0-1651939880498.png

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 07, 2022 May 07, 2022

Copy link to clipboard

Copied

Thanks, Silly-V.

 

Well, of course I made sure that I actually do double click the items. I tried it with about 30 different scripts. It just doesn't work and nothing happens at all. Your test script does not get executed either. No matter if "listbox" or "buttons" are being set in the Script Display options.

 

Hmh.

 

PS: Looks like you are on Windows. Have you also tried it with the latest Illustrator version on the latest Mac OS version?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 07, 2022 May 07, 2022

Copy link to clipboard

Copied

No, you are supposed to only single click them. But, it would just do the script 2 times.

Oh yea, I also have not tested it on a mac of all things. Maybe it just doesn't work on a mac after my latest changes for any number of reasons.

But, just wondering if you have had any of the script files written to the location which is the equivalent of 

C:\Users\YOU\AppData\Local\Temp\ScriptPanel_2 on your system.

If there were files written, it means at least it got some of the way there. Maybe on a mac it's a different folder.

If the files were not written to the location and it's a mac, can you tell me what the path "Folder.temp" alerts?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 07, 2022 May 07, 2022

Copy link to clipboard

Copied

Yes, I thought so when using the button mode, but in the listbox mode it wouldn't be unusual to have to double click.

 

As per your question where the scripts are located: I tried some arbitrary folders somewhere on the HD, but I also tried to use a Startup Scripts folder in the Application folder. No matter, scripts won't be executed with the palette at the moment.

 

Perhaps Ton or some other Mac user may test it as well and report if it does or does not work on their machines.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 07, 2022 May 07, 2022

Copy link to clipboard

Copied

So are there any temp files being written to the application support folder and what foes Folder.temp say on a mac? It would be going to the Folder.temp + "/ScriptPanel_2" directory

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 07, 2022 May 07, 2022

Copy link to clipboard

Copied

Frankly speaking, I'm not quite sure what you mean in this case.

 

As far as I can see, there is no "Folder.temp" on my system. And searching for a folder "ScriptPanel_2 does not yield any result.

 

I'd suggest to wait a bit and see what other Mac users may report about your current approach. No offense, of course, Silly-V.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 07, 2022 May 07, 2022

Copy link to clipboard

Copied

Run the script to alert(Folder.temp) - the Folder object has built in helpful directories like Foldrer.desktop and Folder.myDocuments

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 07, 2022 May 07, 2022

Copy link to clipboard

Copied

Thanks, Silly-V.

 

But at the moment I'd prefer to not do further tests as long as there is no other Mac user that may or may not confirm my statements so far.

 

Perhaps I'm just overlooking something.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 07, 2022 May 07, 2022

Copy link to clipboard

Copied

This turned quite into a problem here. It turns out, at least on my M1 Mac, all File object .modified and .created are null. The documentation says these are NULL for files which are 'not on disk'. Except, my script file and my target file were both in the Desktop folders, not in any Google Drive or Dropbox.

So, whatever, no caching for Mac users - unless I also demand everyone adds a line into their script which is a version or modified-timestamp. I changed it to go ahead and copy the scripts locally every time (this isn't yet in the github and the purpose of this was to enable properly executing Dropbox scripts (on Windows only, apparently)).
However, now there's a new issue: My BridgeTalk isn't working! It says "target could not be launched". Well, this stumps me at the moment so I am looking into it. Meanwhile, totally great for windows users! 😄

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 07, 2022 May 07, 2022

Copy link to clipboard

Copied

Update: the script has been fixed up and edited to get a sense if we have a case of 'bad Mac File props' to go a different path and use a method such as eval("#include 'path/script.jsx'") to launch a script and still be able to provide some arguments to it, because in either case this script panel still writes a dynamic script file to the local temp directory (which I found on my new Mac is to a weird location /var/folders/ch/...).

However, with the Windows working BT-enabled method, we could actually run scripts to different apps from the script panel. With eval script the way I have it, even if adding "#target photoshop" into the top will have no effect; the script still runs in Illustrtor.

The real issue however is the Mac problem with BT, it shows me this:

SillyV_0-1651987795657.png

 

Even on a basic example. Maybe it's the new M1 computers.

So, my new fix entails this condition in a vital place:

const isUnusableMacFile = (SESSION.os == "Mac" && sf.modified === null);

As you see here, the condition states that when the OS is found to be a 'Mac' via my code and the file in question's modified property is a null, then we possibly have a BAD mac that shows null modified-times even when they aren't supposed ot be null. In this case, which I am able to reproduce at will, this fork will make it go eval the file. Still not bad, and we still could potentially get results out of that, thanks to the magic of eval. However, we can't run other apps and we have a potential for some differences in how the scripts may act when called from BT and not from BT. Some differences may take years to spot with a terrible scenario at the worst time in compex edge-cases.

But hey, we can get a decent Hello World out of it now!
Anyways, with the new fix, I think it's still a good tool.
For example, you can arbitrarily nest multiple copies of this panel script along with your other scripts into folders to create pop-out toolboxes. Each one can be named a different name and its settings then will be unique to that tool panel. You can make different tooboxes for all occasions.

SillyV_1-1651988284500.png

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 08, 2022 May 08, 2022

Copy link to clipboard

Copied

Well, your Script panel (version 1) does work very well on the Mac. I really like the ability to add custom sections in its configuration. Also the search function is very useful.

 

I hope you would not be too much disappointed if I were saying that it is certainly the second most sophisticated Scripts palette for Illustrator out there at the moment.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 08, 2022 May 08, 2022

Copy link to clipboard

Copied

EDIT: NOT really fixed at the time of this comment, fixed later.

 

Now you can try the 2 version panel, it's fixed. What these let you do as compared to every other one is to have these pop-out panels. Its advantage is in organizational management and centralization of scripts for a department of multiple users, so due to that it's something I got clients & friends of mine to use because there was always a problem of someone's locally-installed script not being updated when there was an update issued.

It's ok being a second most sophisticated panel, because it's doing all this with just ScriptUI.

However, now that I think about it, for cross-app scripts using even CEP panels, doing so on my mac with a jsx file is not working. So therefore, a CEP panel would have to be installed in all the apps that can listen to a message from a CEP-based script panel in Illustrator.
This is a bad problem with BridgeTalk on my M1 Mac, essentially shutting down the cross-app features using simple JSX. I'm not super happy about it because I can't be sure if that's just the M1 model, just my machine, or all of them. 😞

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 08, 2022 May 08, 2022

Copy link to clipboard

Copied

I've already tried the new version of Script panel 2. Again, thanks for sharing.

 

As far as I can see, "some" scripts will run now, but others still do not. Probably it's about a 50:50 chance at the moment.

 

I don't see an obvious pattern that may explain why it may work and why not in other cases. Also, I don't think it's a specific M1 issue because my tests were done on non-M1 machines.

 

Just to inform you about that.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 08, 2022 May 08, 2022

Copy link to clipboard

Copied

Interesting, please do keep me posted if you find anything. It's good to know that version 1 works ,  maybe I'll find the difference and be able to solve it .

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 09, 2022 May 09, 2022

Copy link to clipboard

Copied

Okay, I have done several things and worked on it some to actually produce a working results now here on my mac.

I fixed some code which apparently wasn't causing a problem in Windows but was doing something bad here.

But most importantly, I have updated my Illustrator to 26.2.1, after which miraculously my BridgeTalk issues went away and it started to work normally.

So, I believe now you can finally try it again and see that some or hopefully all of the scripts are working.

I also added the nested panel example to the github, and you can totally run a photoshop script from an Illustrator script panel if you need to.
One day this will come in handy when the results and inputs are made available to command the buttons to work somewhat autonomously when initiated in a certain way.

I'm sure glad that this was brought up and that whatever my Adobe update did, it fixed the BridgeTalk issues!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 09, 2022 May 09, 2022

Copy link to clipboard

Copied

Apparently, I was a bit too optimistic, Silly.

 

You may for example take a look at this excellent script collection:

 

https://github.com/creold/illustrator-scripts

 

As far as I can see, all of them will run fine in Script Panel version 1, but none of them in Script Panel version 2.

 

Perhaps it may help a bit to troubleshoot.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 09, 2022 May 09, 2022

Copy link to clipboard

Copied

Thanks, Silly-V.

 

I will certainly do some further tests in the upcoming days.

 

By the way, unfortunately your last answer appears above my last answer in this thread. That may be quite confusing for others who may read this topic in the future.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines