Applescript select all graphic elements?

I am trying to make an applescript that will scale images from 1024x1024 to 512,256,128,64,57 etc, so I can quickly create icons for the different platforms.

The script works now, apart from the fact that I have to select the graphic elements by hand.

This is the relevant part:

set selectedPathList to (every path in the selection)
copy selectedPathList
set scaleDocument to make new document
set page size to {1024.0, 1024.0}
set drawing size to {1, 1}
paste selectedPathList
set selectedPathList2 to (every path in the selection)
-- size becomes 512
scale selectedPathList2 by {0.5, 0.5} about {0, 0}
set page size to {512.0, 512.0}
set drawing size to {1, 1}
save scaleDocument in file (thefolderPath & ":icon512png") as "public.png" quality 1024

Any suggestions how I can select all the graphical elements? Is there any kind of operation like

   for each path in the document

or something equivalent?


Intaglio mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

If I understand you correctly this should work:

set thePaths to every path of the front document
repeat with aPath in thePaths
	-- scale aPath to the desired size here
end repeat

Intaglio mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thanks for the tip.

I found out that what I actually wanted was to scale all the graphics, not just the paths (I found out that paths does not cover the text blocks, nor the background layers). In the end I accomplished that via:

set theGraphics to every graphic of the front document
--	set theTexts to every text block of the front document
select theGraphics
set selectedGraphicsList to (every graphic in the selection)
    scale selectedGraphicsList by {0.5, 0.5} about {0, 0}

This will select all the stuff in the document and scale it accordingly.


Intaglio mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options