The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniGraffle > OmniGraffle General
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Export issue / Modify the selection in a Document via AppleScript / Scripting Bridge Thread Tools Search this Thread Display Modes
Hi all,

Using the Scripting Bridge in 10.5 and OmniGraffle 5 Pro I'd like to do the following:
I'd like to export the individual parts of a user-selected Illustration within a Document. The Illustration should not be exported as one entity (I got this working already), but as individual images. The reason for this is that I plan to use the individual parts for animation purposes in PowerPoint 2008 / Keynote 08. The Problem now is the following:
The export using the Document works
Code:
self.selectedItems = self.selectedOmniGraffleWindow.selection;
NSString *tempDirectory = [openPanel directory];
NSLog(@"Chosen directory: %@",tempDirectory);
for (int i=0; i< [self.selectedItems count]; i++) 
{
	OmniGraffleGraphic *item = [self.selectedItems objectAtIndex:i];
	NSString *fileName = [NSString stringWithFormat:@"/%d",i];
	NSString *finalDirectory = [tempDirectory                                      
                                                   stringByAppendingString:fileName];
	NSURL *exportDirectory = [NSURL URLWithString:finalDirectory];
	[currentDocument saveAs:@"png" in:exportDirectory]; 
          // This does work - It just exports the whole selection!
}
However, If I replace the call to currentDocument with item, as it was originally intended to iterate over the different graphics in the selection,
Code:
[item saveAs:@"png" in:exportDirectory];
it fails with an exception.

My questions:

1. Is it mandatory to use the OmniGraffleDocument class to export items?

The AppleScripts regarding export I've seen so far seem to indicate that.
However, in the generated header file used by the Scripting Bridge (generated using the sdef command in Terminal), both OmniGraffleDocument and OmniGraffleGraphic inherit from OmniGraffleItem, which supplies the saveAs: in: method.

2. If it is mandatory to use OmniGraffleDocument, is it somehow possible to modify the selection of the Document?
With that, I also would get the desired effect of iterating over the Array of selections and exporting the items one by one.

I appreciate any comments!

Thx in advance!

Toby
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Scripting bridge: crash when trying to get child tasks of a task amorya OmniFocus Extras 8 2013-11-10 05:00 AM
Scripting Bridge & NSColor pixel OmniGraffle General 0 2009-12-07 11:19 AM
Problem Using Scripting Bridge and OmniGraffle pixel OmniGraffle General 1 2009-12-03 08:52 AM
Scripting Bridge & OOP namedStyles oopFan AppleScripting Omni Apps 0 2008-11-03 02:46 PM
Problems using Scripting Bridge and OmniFocus 2shortplanks OmniFocus Extras 8 2008-08-09 09:35 PM


All times are GMT -8. The time now is 03:12 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.