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 > Developer > AppleScripting Omni Apps
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Removing Row Style Elements OO3 Thread Tools Search this Thread Display Modes
Hi,

I am writing a script that removes and sets named styles based on the values set by the user in certain columns. The script works but....... if at some point the user sets for example the font colour and size then these settings override the settings contained in the named style. Does anyone know the syntax required to remove all the styles set by the user from a given row?

best wishes

Simon
 
Didn't spot this, and I imagine you've probably solved it by now, but essentially you should be able to drop the manually applied styles by converting from a text object to a plain string and back again.

Code:
tell application id "OOut"
	tell front document
		-- WHICH OF THE COLUMNS ARE RICH TEXT ?
		set lstColID to id of columns where its type = rich text
		
		-- WITH SELECTED ROWS, FOR EXAMPLE
		repeat with oRow in selected rows
			repeat with strColID in lstColID
				
				-- EXTRACT THE PLAIN TEXT, AND RESET THE TEXT OBJECT
				tell cell id strColID of oRow
					set strText to value
					set value to strText
				end tell
			end repeat
		end repeat
	end tell
end tell
 
You might, of course, want to exclude the note from this, as in:

Code:
tell application id "OOut"
	tell front document
		-- WHICH OF THE COLUMNS ARE RICH TEXT ?
		set lstColID to id of columns where its type = rich text
		
		-- EXCLUDE THE NOTE ?
		set strNoteID to id of note column
		
		-- WITH SELECTED ROWS, FOR EXAMPLE
		repeat with oRow in selected rows
			repeat with strColID in lstColID
				
				-- UNLESS THIS IS THE NOTE, RESET THE TEXT OBJECT
				if (contents of strColID) ≠ strNoteID then ¬
					tell cell id strColID of oRow to set value to value as string
			end repeat
		end repeat
	end tell
end tell

Last edited by RobTrew; 2013-05-11 at 10:24 AM..
 
I noticed that, and I think I probably decide now, but in fact, you should be able to abandon the style applied manually by converting a text object in a string and returns regularly.

tell application id "OOut"
tell front document
-- WHICH OF THE COLUMNS ARE RICH TEXT ?
set lstColID to id of columns where its type = rich text

-- EXCLUDE THE NOTE ?
set strNoteID to id of note column

-- WITH SELECTED ROWS, FOR EXAMPLE
repeat with oRow in selected rows
repeat with strColID in lstColID

-- UNLESS THIS IS THE NOTE, RESET THE TEXT OBJECT
if (contents of strColID) ≠ strNoteID then ¬
tell cell id strColID of oRow to set value to value as string
end repeat
end repeat
end tell
end tell
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disconnect elements trinix OmniGraffle General 0 2011-06-04 01:03 AM
How can you make a Column Style *override* a Row Style? JimmyMcVideo OmniOutliner 3 for Mac 2 2011-05-23 09:16 PM
Elements in OG that aren't scriptable? browniejr OmniGraffle Extras 0 2009-09-19 09:32 AM
Clearing Style, same style for several actions/projects? jasong OmniFocus 1 for Mac 5 2008-01-02 07:20 PM
Aqua Elements? Flounder OmniWeb Feature Requests 4 2007-05-29 01:17 PM


All times are GMT -8. The time now is 03:43 PM.


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