View Single Post
Thanks Rob for your response.
The problem I'm having is not in finding and iterating over the shared layers, but rather in iterating over their contained shapes, and, in particular in actually selecting them, so that they can be individually exported as images.

The following code is what is NOT working, but might illustrate my intent better that the previous example (I've stripped it down to show just the relevant part). In your provided code, this would be inserted just under the comment line beginning with 'harvest each shared layer'...

The error I'm getting is:
"Can't set window 1 of canvas 1 of document 1 to { item 1 of every graphic of item 1 of {layer "title" of canvas id 7 of document "test.graffle", layer "bg" of canvas id 7 of document "test.graffle"} }

Any ideas??? Thanks again.
ST
Code:
repeat with currentGraphic in every graphic of oSharedLayer
  set gclass to class of currentGraphic
  log "Current SHARED graphic: " & gclass
  set selectionGraphics to {}
  set end of selectionGraphics to currentGraphic
  set selection of front window to selectionGraphics

  set exportFileName to export_folder & exportName & "." & exportFileExtension
  log "Exporting IMAGE: " & exportName & "." & exportFileExtension & " …"
  set exportType to exportFileType
						
  -- export settings
  set include border of current export settings to false
						
  -- exports each item separately
  set area type of current export settings to selected graphics
						
  set draws background of current export settings to false
  set export scale of current export settings to myScale
  set resolution of current export settings to myResolution
  set border amount of current export settings to 0.0
  						
  -- do the export and save
  save oDoc as exportFileType in exportFileName
end repeat