Illustrator Stroke Weight Not working on compound paths

Thank you Yarnin,
I really appreciate all that you have done so far.

I could be wrong, but this change may have solved what I was after. After looking at the event log I noticed that it was repeating the stroke weight to single compound path items.

So I changed this line: repeat with x from 1 to ItemsinSelection
to read:
if ItemsinSelection > 1 then repeat with x from 1 to ItemsinSelection

There is still a parameter I cannot seem to change the strokes for. This is for when two or more compound paths are grouped.

The entire script now looks like this below.
I am still going to test this a lot more.
Thanks again for all of your help, and thanks to everyone else who worked on this script as well.
-jeff

tell application "Illustrator CS"
	(*   Check for selection Objects  *)
	if number of items in selection is 0 then
		display dialog "No item is selected." & return & "Please select an item and try again." buttons {"OK"} default button 1
		error number -128
	end if
	
	(*   set stoke width increment  *)
	tell document 1
		--display dialog "set stoke width increment" default answer "0.5" --buttons {"OK", "Cancel"} default button 1
		--copy the result as list to {text_returned, button_pressed}
		--if button_pressed is "Cancel" then
		--error number -128
		--else
		set Add_2_Width to 0.5 --as number
		--end if
		
		(*   plugin item  *)
		if class of selection is plugin item then
			activate
			tell application "System Events" to tell process "Illustrator CS" to tell menu bar 1 to tell menu bar item "Object" to tell menu "Object" to click menu item "Expand Appearance"
			set selection to selection
			try
				set tt to every group item of selection
				delete last item of tt
				tell application "System Events"
					keystroke "g" using command down & shift down
					keystroke "g" using command down & shift down
				end tell
			end try
		end if
		try
			
			(*   text box converted to outline  *)
			set ItemsinSelection to number of every compound path item of selection
			if ItemsinSelection > 1 then repeat with x from 1 to ItemsinSelection
				set theItem to path item 1 of compound path item x of selection
				if stroke width of theItem > 0 then set (stroke width of theItem) to (stroke width of theItem) + Add_2_Width
			end repeat
		end try
		if class of selection is compound path item then
			set theItem to first path item of selection
			if stroke width of theItem > 0 then set (stroke width of theItem) to (stroke width of theItem) + Add_2_Width --end try
		end if
		
		set sel to selection
		
		if class of sel is list then
			repeat with thisPath in sel
				try
					if class of thisPath is not text frame and class of thisPath is not group item then
						if stroked of thisPath then set stroke width of thisPath to (stroke width of thisPath) + Add_2_Width
					else if class of thisPath is text frame then
						if class of stroke color of (text of story of thisPath) is not no color info then
							tell text of story of thisPath to set stroke weight to stroke weight + Add_2_Width
						end if
						
					else if class of thisPath is group item then
						try
							set pathItemList to count every path item of compound path items of selection
							if pathItemList > 0 then
								set pathWidth to stroke width of (path item 1 of compound path items of selection) as number
								if pathWidth > 0 then set stroke width of (path item 1 of compound path items of selection) to (pathWidth + Add_2_Width)
							end if
						end try
						
						set tmp to every path item of thisPath
						repeat with thisGroupItem in tmp
							if stroked of thisGroupItem then set stroke width of thisGroupItem to (stroke width of thisGroupItem) + Add_2_Width
						end repeat
					end if
				end try
			end repeat
		else if class of sel is text then
			if class of stroke color of sel is not no color info then
				tell sel to set stroke weight to stroke weight + Add_2_Width
			end if
		end if
		
	end tell
end tell

Well Jeff
try this one

without Jeromes way for now but you can try and implement it your self and see if it works

tell application "Illustrator CS"
	(*   Check for selection Objects  *)
	if number of items in selection is 0 then
		display dialog "No item is selected." & return & "Please select an item and try again." buttons {"OK"} default button 1
		error number -128
	end if
	
	(*   set stoke width increment  *)
	tell document 1
		set Add_2_Width to 0.5 as number
		
		(*   plugin item  *)
		if class of selection is plugin item then
			activate
			
			tell application "System Events"
				keystroke "1" using command down & shift down
			end tell
			
			set selection to selection
			try
				set tt to every group item of selection
				delete last item of tt
				tell application "System Events"
					keystroke "g" using command down & shift down
					keystroke "g" using command down & shift down
				end tell
			end try
		end if
		
		(*   text box converted to outline and Other Cumpounds  *)
		try
			set ItemsinSelection to number of every compound path item of selection
			repeat with x from 1 to ItemsinSelection
				set theItem to path item 1 of compound path item x of selection
				if stroke width of theItem > 0 then set (stroke width of theItem) to (stroke width of theItem) + Add_2_Width
			end repeat
		end try
		if class of selection is compound path item then
			set theItem to first path item of selection
			if stroke width of theItem > 0 then set (stroke width of theItem) to (stroke width of theItem) + Add_2_Width --end try
		end if
		
		set sel to selection
		
		if class of sel is list then
			repeat with thisPath in sel
				try
					if class of thisPath is not text frame and class of thisPath is not group item then
						if stroked of thisPath then set stroke width of thisPath to (stroke width of thisPath) + Add_2_Width
					else if class of thisPath is text frame then
						if class of stroke color of (text of story of thisPath) is not no color info then
							tell text of story of thisPath to set stroke weight to stroke weight + Add_2_Width
						end if
						
					else if class of thisPath is group item then
						set tmp to every path item of thisPath
						repeat with thisGroupItem in tmp
							if stroked of thisGroupItem then set stroke width of thisGroupItem to (stroke width of thisGroupItem) + Add_2_Width
						end repeat
					end if
				end try
			end repeat
		else if class of sel is text then
			if class of stroke color of sel is not no color info then
				tell sel to set stroke weight to stroke weight + Add_2_Width
			end if
		end if
		
	end tell
end tell

Yarnin,
This is working very well. Upon further glances I didn’t realize all the parameters that need to be accounted for. :frowning:
Most of the issues fall into the range of multiple selected grouped objects that are compounded. This is not a big concern since it wouldn’t relate to the simple shapes that such a script will be used on.
On the average a few operators would use this script when recreating simple logos, trying to match a font, etc. For such instances it would be nice to be able to hit a keyboard shortcut a few times to tweak the stroke weight.
There is one instance that I didn’t notice before that I will have to work on, and I may be able to do this myself. It relates to those plugin items that must have the appearances expanded: After those items are expanded they lose their fill color they once had. This could be dangerous since the effects are not noticed if the object was filled with white and it was on top of a white background. (the stroke is increasing correctly) It would actually be preferred that if such items couldn’t retain their fill color that a warning box came up prompting the user that the script will not work on such an object until its appearance is expanded and its fill and stroke is set.
The other instance that isn’t working is when I select two objects that both contain compound paths. For instance, if I took the letter “e” converted it to outlines, then duplicated that letter. If I select both letter e’s (now outlined) the script will not increase the stroke weight.

But other than those two snafus this script is amazing. I am very impressed and very excited about this.
Thank you so much for all of your hard work.

-jeff

Hi Jeff

For the last 2 matters I will live it to you.
for the fill thing - before you do what you want to do store the fill in to a verible - aplay the stroke width and then set the fill back.

as for the multiple selection try to find the number of object selected and the set it in to a repeat loop.

It was nice to work on this one.

see you round…:wink: