Scale matrix & strokes in Illustrator CS2

Hi!
I have one problem… Im creating some script for scaling page items… and after succesful scaling there is “little” suprise in document:
ANY OBJECT WITH SOME STROKE after scaling have HUGE stroke size like 100 points (before it was 1 point)…

Its me, or Illustrator bug?

There is example of script:
– first create some rectangle or path with stroke (etc) then run script

tell application “Adobe Illustrator”
activate
set allPageItems to every page item of current document
set selection to allPageItems

set my_selection to selection

set my_scale to get identity matrix
set my_scale to concatenate scale matrix my_scale horizontal scale 100 vertical scale 50
transform my_selection using my_scale about document origin

end tell

I will be glad and happy for any help,
Best regards
Mirek

Model: iMacG5 17"
AppleScript: AppleScript 1.9.3
Operating System: Mac OS X (10.3.9)

Hi MirDur

Does this help

tell application "Illustrator CS"
	activate
	set allPageItems to every page item of current document
	set selection to allPageItems
	
	set my_selection to selection
	
	tell document 1
		scale page item 1 horizontal scale 100.0 vertical scale 50.0 about center
		end tell
end tell

MirDur,

I tried Pidge1’s script and it works just fine. Of course the question is why does the tell document statement make the difference? Anyway, using your first code you can also do it like this:

tell application "Illustrator CS"
	activate
	set allPageItems to every page item of current document
	set selection to allPageItems
	
	set my_selection to selection
	
	set my_scale to get identity matrix
	set my_scale to concatenate scale matrix my_scale horizontal scale 100 vertical scale 50
	transform my_selection using my_scale about document origin line scale 0 -- where the line scale is a percentage
end tell

PreTech

Hi MirDur/Pretech

Previous script only did the one selected page item,

tell application "Illustrator CS"
	activate
	set allPageItems to every page item of current document
	set selection to allPageItems
	
	set my_selection to selection
	
	tell document 1
		scale every page item horizontal scale 100.0 vertical scale 50.0 about center
	end tell
end tell

As I was curious about the result of this AS, I also tried it…and it really works.
But I was wondering, when I have a folder with a lot of files who need to be scaled, how should adjust this AS? I have to scale AI-files on a regular basis (customer wants to have their design today on this size, tomorrow on another size, etc. This takes a lot of time of course:))

All tips are welcome :slight_smile:

Model: Powerbook 17"
AppleScript: 2.1
Browser: Safari
Operating System: Mac OS X (10.4)

Hi KGE

This should help it won’t save them, though you will have to add that bit of code…
Sorry didn’t have time to add it.

property myfiletypes : {".ai"}
on open myfinderitems
	repeat with myfinderitem in myfinderitems
		tell application "Finder" to set myitemisfolder to (kind of myfinderitem = "folder")
		if myitemisfolder then
			tell application "Finder" to set myfoldercontents to (every item of myfinderitem)
			open myfoldercontents
		else
			tell application "Finder" to set myitemextension to "." & (name extension of myfinderitem) as string
			if myfiletypes contains myitemextension then
				tell application "Illustrator CS"
					open myfinderitem as alias
					set mydocumentname to name of document 1
					set current document to document (mydocumentname as string)
					set allPageItems to every page item of current document
					set selection to allPageItems
					
					set my_selection to selection
					
					tell document 1
						scale every page item horizontal scale 100.0 vertical scale 50.0 about center
					end tell
				end tell
			end if
		end if
	end repeat
end open

I could really use some help in regards to this same topic.

How do you scale a complex Illustrator file, i.e., a PDF opened in Illustrator that has many clipping masks and embedded images with many subgroups. Ungrouping won’t work because it removes the clippings masks. And in all my finding simply scaling all items into one group doesn’t seem to scale the embedded images?

But the program itself will scale all the images fine by manually grouping the items and then using Transform>Scale. So this leads me to believe that it should be scriptable?

I have attached an example file that demonstrates the issue with the scripts. I am using CS4, but that shouldn’t make a difference for what I am dealing with.

http://dl.dropbox.com/u/89164/Archive.zip