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

Running action with script not working

Community Beginner ,
Oct 06, 2020 Oct 06, 2020

Copy link to clipboard

Copied

Hello. I am working with a programmer to write a script for me to automate some of our production work in our print shop. I have a set of actions and he wrote a script to run this action set but when it goes to the first command, "addcutcontourswatch" I always get an error that that object is not avaialble.

 

I have all the neccessary scripts loaded in the script folder but cannot get past the first step.

 

Any ideas?

TOPICS
Scripting

Views

1.2K

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

correct answers 1 Correct answer

Valorous Hero , Oct 07, 2020 Oct 07, 2020

Hey, I used to do this by making an action that would place a single ai file which contains a spot-color cut contour swatch. When I pressed the button, it would automatically place the rectangle into my active document from the filesystem and immediately delete the swatch. Now the spot color is in the active document!

But to help you with your script, we really need to see what the code is. It could be anything and everything.

 

After watching your video the problem is clear: your add cutcontour

...

Votes

Translate

Translate
Adobe
Valorous Hero ,
Oct 07, 2020 Oct 07, 2020

Copy link to clipboard

Copied

Hey, I used to do this by making an action that would place a single ai file which contains a spot-color cut contour swatch. When I pressed the button, it would automatically place the rectangle into my active document from the filesystem and immediately delete the swatch. Now the spot color is in the active document!

But to help you with your script, we really need to see what the code is. It could be anything and everything.

 

After watching your video the problem is clear: your add cutcontour swatch is created by a script, which is played by an action. But you are also trying to run that action by a script in the 2nd round when it doesn't work. That is because, well, it doesn't work like that. You can only play an action from a script that has no scripts, or you can play an action that has a script, but only from inside Illustrator.

For your swatch needs though, you really don't need a programmer because you can use my technique and simply place & delete a rectangle. When you do need a programmer, keep in mind the action-script interoperability so that you guys don't write a huge library around your current perception and it doesn't work.

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 ,
Oct 07, 2020 Oct 07, 2020

Copy link to clipboard

Copied

Hello. Thanks for the input. I uploaded a video to show the script and the first action failing. This is just a test script, not the one the programmer is working on.

 

app.doScript("Action 1","Set 1") is the script I am running. It should run the action I have in my panel. I get an error message saying the "addcutcontourswatch" is unvailable. I have 'addcutcontourswatch' in my scripts folder. I can run it fine using the play button.

 

Screenshot 2020-10-07 095641.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
Valorous Hero ,
Oct 07, 2020 Oct 07, 2020

Copy link to clipboard

Copied

The input is your answer and solution.

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 ,
Oct 07, 2020 Oct 07, 2020

Copy link to clipboard

Copied

Thank you for the answer. Got it, we cannot run an action from a script if it contains scripts. We will have to add those scripts and delete the actions accordingly. Hopefully that will give us the results we need for step 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
Community Beginner ,
Oct 07, 2020 Oct 07, 2020

Copy link to clipboard

Copied

Thanks for the updated reply. I really do need a programmer because this goes beyond just creating a contour line for our cut path. He is creating a second script to auto layout all of our saved .ai files, in numerical order and vendor, left to right, output front and back print files and a .dxf cut file.

 

Here is a video running the action in illustrator and then trying his script.

 

The programmer shows me a video of him being able to run his script out of ExtendedScript. Trying to explain to him it is not working and why.

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 ,
Oct 07, 2020 Oct 07, 2020

Copy link to clipboard

Copied

Good, so the main solution is for your programmer to put the swatch thing into the script and not in an action (matter of fact everything script-wise like this), or you can keep the swatch deal in your actions and avoid a script for that step.

If you are using scripts to activate your process, you can make as many of them that his scripts can trigger, but ensure no menu-item scripts are in those actions. If you are really looking to start off with an action though, you can only have the scripts as menu-item scripts intertwined with your actions. That could be very hairy, plus you have to put scripts into the app folder, what a mess.

 

If I was the programmer I'd define what's easiest for you and me so that the script can utilize all your actions that are your domain and the script stitches them together but also does the things an action can't do.

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 ,
Oct 07, 2020 Oct 07, 2020

Copy link to clipboard

Copied

Much appreciated. He was working with the action set I created. Apparently he wasn't aware of the issue. We plan on splitting the actions up into several little actions and calling all the necesary scripts to complete the action into his main scripting. Thank you!!!

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 ,
Oct 07, 2020 Oct 07, 2020

Copy link to clipboard

Copied

Only as a sidenote:

It is always better to do what is possible in one script without additional actions (or an action without script). Use such combinations only for app functions which are not available in the scripting engine (or in case that an action is much much more quicker as for example time consuming loops through the whole artwork).

 

Creating a swatch is easy possible with scripting. There is no need to use an action for that.

 

my 2 cent

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 ,
Oct 07, 2020 Oct 07, 2020

Copy link to clipboard

Copied

I belive actions can be a nice tool for a versatile workflow because the users can change their own actions and even use some sort of system with scripting to inject parameters, etc. Creating a swatch is possible with scripting, but if they wanted to change the swatch.. with the action they wouldn't even have to necessarily change the action, just the referenced file. Furthermore a script can choose which action to run, so that is dynamic, but on top of that the place can replace the swatch file too, even more control. Of course you can do all sorts of data-storing and web-api stuff to do all-code, but that's more work and takes a longer time. When the users can make as many actions (with an informed perspective of course), they can begin testing and work sooner, even if the actions take forever to execute and the whole thing needs porting over to a full script later - they can start working now and earning something with what they have to later invest in a more technically-intensive solution.
One day I'll need to do a Europe tourist vacation and drop by if I may!

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 ,
Oct 07, 2020 Oct 07, 2020

Copy link to clipboard

Copied

LATEST

@Silly-V 

You are always welcome.

🙂

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