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

 
text background and omnioutliner import Thread Tools Search this Thread Display Modes
Rather than waiting too piously for an Omni-solution on this one (those guys are busy) here is an experimental solution - an applescript which seems to be working for me, and which another contributor to this forum has been kind enough to test.
  • For each attribute run in the text of each shape in the canvas of the current window, it records the text properties that OmniGraffle actually understands,
  • deletes the text entirely (to zap its background color),
  • and then tries to reset the text and its formatting to the cleaned list of attribute run properties.

i.e. fairly drastic - so make a back-up and experiment first ...

Code:
-- VER 0.3
-- CLEAR ANY TEXT BACKGROUND COLOR FROM SHAPES RESULTING FROM THE PASTING OF MATERIAL FROM OMNIOUTLINER, VISIO, SAFARI ETC.

-- EXERCISE CAUTION - THIS IS FAIRLY DRASTIC:

-- 	1.	COPIES THE TEXT ATTRIBUTE RUN PROPERTY LISTS FOR EACH SHAPE
-- 	2.	PURGES THESE OF NOISE (CLASS PROPERTY) AND BUGS (THERE IS A BUG IN THE TEXT PROPERTY OF OG5 ATTRIBUTE RUNS, SEE BELOW)
-- 	3.	**ENTIRELY DELETES** ALL TEXT FROM THE SHAPE
-- 	4.	ATTEMPTS TO RECREATE THE TEXT USING THE COPIED PROPERTIES

-- NB ONLY USE ON A FILE WHICH HAS BEEN BACKED UP ...

tell application id "OGfl"
	tell canvas of front window
		repeat with oShape in shapes
			set refText to (a reference to text of oShape)
			set lstAttribProps to properties of attribute runs of refText
			set lstClean to {}
			repeat with oRun in lstAttribProps
				set {varOff, varSup, varAlign, blnUnderlined, lstColor, strText, strFont, rSize} to {baseline offset, superscript, alignment, underlined, its color, its text, font, size} of oRun
				set strText to item 1 of strText
				-- there seems to be a bug in the text property of an attribute - instead of a string it returns a list which includes the name of the font
				set end of lstClean to {text:strText, font:strFont, size:rSize, color:lstColor, baseline offset:varOff, superscript:varSup, alignment:varAlign, underlined:blnUnderlined}
			end repeat
			
			-- RESET THE TEXT TO THE COPIED PROPERTY LIST
			tell oShape to set its text to lstClean
		end repeat
	end tell
end tell

Last edited by RobTrew; 2012-02-08 at 04:07 AM..
 
Mixed results, I would say.

It's removing the text background color, as intended, but not always preserving all the formatting ...

(Underlining and text foreground color do seem to be preserved)

--
 
It turns out that the cases in which this script loses the font/size applied to text runs are rooted in a fairly deep and architectural bug in the interface between Applescript and OmniGraffle.

In a number of respects (principally involving texts) the state of a document seen by Applescript differs from that seen by the GUI. Sometimes different levels of zoom show different snapshots of the editing history of the document.

In this case, to reconcile the state of play seen by Applescript with that seen by the GUI, you would need to save, close, and reopen the document before you run the script ...

--

Last edited by RobTrew; 2012-02-09 at 01:48 PM..
 
That's great. Just note; OmniGraffle's issue has NOT been solved!
 
Well, I think they are quite overstretched by the sheer number of applications - doubled now by the arrival of the iToy platform, which has inevitably created a few areas of relative neglect in the more serious and work-related OS X applications.
 
Thanks for finding this, Rob - it is a bug and we'll write it up.

Re: "neglect", all I'll say is that we think it's important that we be sensitive to the way that customers use our apps when planning our work. The number of folks that use AppleScript is very small - and the number of folks that use it in this manner is even smaller.

In an ideal world, we'd be able to spend time fixing this issue, but it would be unfair to the larger community to prioritize this over other work that benefits more customers.
 
Quote:
Originally Posted by Brian View Post
The number of folks that use AppleScript is very small
Since you brought it up, what is that number (fraction of the whole is fine, no need to disclose total sales figures), and how did you determine it? What would be an example of a feature (and associated fraction of the whole) which just makes it over the line into non-marginal territory?
 
Quote:
Originally Posted by Brian View Post
The number of folks that use AppleScript is very small
Well, you seem to say that with confidence, so I'm sure you're right :-) ( In strictly epistemological terms I'm not quite sure how one would actually know how often users run scripts ... )

I personally think that script has quite a useful role as a sort of Rube Goldberg band-aid - a good way of coping with gaps between how applications are written and how particular people actually use them ...

Quote:
Originally Posted by Brian View Post
it would be unfair to the larger community to prioritize this over other work that benefits more customers.
Yes, the majoritarian hegemony approach does have many virtues. I'm not sure that it's always optimal. Anglo-Saxon voters, for example, will tend to be more numerous than other Omni customers (at least in the short term) but how good an argument is that for neglecting buggy localisations ?

Should bugs which destroy data really wait for votes ? (Well-formed scripts which destroy manual formatting by the user because of an architectural flaw in the implementation [as above]... well ... borderline perhaps ...).

Luckily, many bugs can be mitigated by script (the various auto-layout bugs would all fall into this category).

There are however, some bugs which simply can't be fixed by script, and my personal view is that those should probably be attended to pretty quickly regardless of voting. If the product is failing to provide what it offers on the can, and users have no scripting remedy, then the case for action would seem fairly strong to me ...

Anyway no complaints - it's quite understandable that moving into the iToy stuff has consumed a high proportion of resources. And maybe that is indeed where the money lies these days ...
 
Quote:
Originally Posted by Brian View Post
Re: "neglect", all I'll say is that we think it's important that we be sensitive to the way that customers use our apps when planning our work. The number of folks that use AppleScript is very small - and the number of folks that use it in this manner is even smaller.
Looking again at your post Brian, I realise that you have probably read this thread a little hurriedly and misunderstood it - I know you guys are busy :-)

The theme of relative neglect was not in any way related to Applescript ...

( It was a comment on an expression of customer exasperation at the neglect, since the first posting in 2008, of the background color pasting bug ... still not fixed ... maybe when the iToy stuff settles down ?)
 
Erh - I do not use Applescript - but I was intending to use OmniGraffle to make website wireframes.. I think it's quite normal to paste website content into the program, for many reasons. And that's where the bug arrises for me.

The bug has been there for over 4 years, where web content could not be pasted probably. And many people have complained. Thats what I call neglect.
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Import from OmniOutliner to OmniFocus steve OmniFocus 1 for Mac 15 2010-09-05 07:28 PM
how can I keep OmniOutliner in the background when I add clippings? clamshell OmniOutliner 3 for Mac 3 2008-11-17 12:49 PM
Import OmniOutliner outlines? Lightstorm OmniFocus 1 for Mac 2 2007-11-23 05:26 PM
Can't import from OmniOutliner adhamh OmniPlan General 2 2007-09-10 03:11 PM
Import from OmniOutliner Dan Smart OmniPlan General 4 2007-06-01 01:11 PM


All times are GMT -8. The time now is 01:24 AM.


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