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

OmniGraffle current font bug (scripting) Thread Tools Search this Thread Display Modes
If you change the font of shape text through the GUI:
  1. Any subsequent scripting will incorrectly report the current font (returning the name of the font in use when the file was last opened).
  2. If the font size is changed by script, the current font will be lost - replaced by the font in use when the file was last opened.

It seems that GUI font changes are only seen by script (and only safe from being lost by script) when the file has been closed and reopened. Simply saving the file is not enough ...

This seems analogous to (perhaps consanguineous with) the Peter Pan abandoned shadow bug.

tell application id "OGfl"
	tell front window
		set lstSeln to selection
		if length of lstSeln < 1 then return
		set oShape to item 1 of lstSeln
		-- (Reports the font in use when file last closed & reopened)
		font of text of oShape
	end tell
end tell

Last edited by RobTrew; 2012-02-09 at 01:41 AM..
The twin sibling of this bug is that if you change the formatting of a piece of text through script:
  1. The change will not be visible in the GUI until you adjust the zoom level, and
  2. strangest of all, if you then return to the original zoom level, you will find yourself staring into the past, and looking at an earlier snapshot of the document's state ...

(This certainly applies to the font, size, and shadow of text - I haven't tested it for other properties, but it may well apply to them too ...)

[UPDATE it even applies to the wording of text itself - what you see on the editing screen may not be what shows on the Presentation screen, or in print ...]

Something is architecturally amiss here ...
  • Sometimes the screen is deceiving users about the state of their data,
  • and sometimes the Applescript interface is deceiving them ...

Good enough for idle play, but is it good enough for professional work ?


Last edited by RobTrew; 2012-02-09 at 03:51 AM..
What is placed on the clipboard if you do a copy operation (incl. copy as AppleScript) of one of these treacherous objects? What you see, or what you get?
Good question !

What you copy is not what you see ...

If you create this shape,

and run this script,
tell application id "OGfl"
	tell canvas of front window
		tell text of first shape
			set last word to "fool"
		end tell
	end tell
end tell
And then copy and paste the apparently unchanged shape, you get a potentially baffling result:

Copy as Applescript also gets something at variance with what you see ...

Attached Thumbnails
Click image for larger version

Name:	Gaon.png
Views:	782
Size:	8.1 KB
ID:	2251   Click image for larger version

Name:	CopyPaste.png
Views:	810
Size:	11.9 KB
ID:	2252  
And the fact that you can see two different versions sitting next to each other on the same canvas at the same zoom level does seem to confirm that the fault lies somewhere deeper than a neglected screen refresh ...

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
Omnigraffle 5.4 - Apple Script Font Issue marxes OmniGraffle General 6 2012-06-13 09:17 AM
Setting screen font vs. print/export font [A: text zoom coming in OO4.] gmiddleton OmniOutliner 3 for Mac 26 2012-05-06 02:56 AM
Change Page Setup params through AppleScript GUI Scripting for OmniGraffle 5 coswald007 AppleScripting Omni Apps 1 2011-10-13 04:43 AM
Problem Using Scripting Bridge and OmniGraffle pixel OmniGraffle General 1 2009-12-03 08:52 AM
Crashes when scripting "group rank" property in OmniGraffle timcoffman AppleScripting Omni Apps 1 2009-07-09 06:50 AM

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

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