Skip to main content
Inspiring
February 6, 2024
Answered

Apply Offset Path with specific values via script

  • February 6, 2024
  • 3 replies
  • 2935 views

I am trying to make an action that has many steps. One of the steps is a Menu Item which is Effect > Path > Path Offset.  When I execute the the action, Path Offset window pops up and wait for me to enter values (Offset, Joins). I enter Offset: 0.1 mm, Joins: Round then I click Ok for the action to continue. I am looking for a way to set these values automatically so the action continues without me entering the same values every time.

 

I think this has two routes to solve. I should either add a script to implement a series of keystrokes right after the Path Offset menu item, in my case the key strokes in order should be "0.1 mm > tab > downarrow > enter". These key strokes will set Offset: 0.1 mm, Joins: Round and then click Ok.

 

Or, I should implement the Path Offset command with the desired values via calling Path Offset function in a script.

 

Would you please help me with this. Is this something doable? Thank you in advance.

This topic has been closed for replies.
Correct answer femkeblanco

This snippet will apply an offset effect with the parameters you specified to a selected path. 

var string = '<LiveEffect name="Adobe Offset Path">' + 
'<Dict data="I jntp 0 R mlim 4 R ofst 0.283"/>' + 
'</LiveEffect>';
app.selection[0].applyEffect(string);

 

3 replies

Kurt Gold
Community Expert
Community Expert
February 6, 2024

In case this is related to your other request, I've added two alternative approaches there.

 

Fast way or a script to offset only the outside path of a compound path

femkeblanco
femkeblancoCorrect answer
Legend
February 6, 2024

This snippet will apply an offset effect with the parameters you specified to a selected path. 

var string = '<LiveEffect name="Adobe Offset Path">' + 
'<Dict data="I jntp 0 R mlim 4 R ofst 0.283"/>' + 
'</LiveEffect>';
app.selection[0].applyEffect(string);

 

Inspiring
February 6, 2024

That worked!! Thank you so much! Would you please explain the parameters inside in case I wanted to change the offset and joins.

Kurt Gold
Community Expert
Community Expert
February 6, 2024

Can you please add your further requests in the original thread?

RobOctopus
Inspiring
February 6, 2024

just did a quick test. double check whether the dialog option is turned on or not

there will either be an empty box (its off) or the square next to the check mark is filled with a little icon

Inspiring
February 6, 2024

In Action menu, I can't see the options of the Offset Path. There is also no drop down menu for me to choose from. I am not sure what Dialog is. Is it the Offset Path window? I can only toggle Dialog for the whole action. I've toggled it on and off but nothing changed. Am I missing something here?

 

RobOctopus
Inspiring
February 6, 2024

instead of using effect - path - offset. go to object - path - offset and see if that still does what you want

 

also from your screenshot. the square box next to the "offset outside path" down arrow and checkbox. click that to remove the dialog interactions