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 > OmniOutliner > OmniOutliner 3 for Mac
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Help! Reformat using applescript Thread Tools Search this Thread Display Modes
I've got a great service package, WordService, which is very good at reformatting text that has been copied from another application (say, an email application like Postbox) in to Omni Outliner.

Now--that pasted text has lots of spaces, blank lines, etc., that all need to be removed. The 'Reformat' service in WordService's pack works great. And, I've even assigned it a keyboard command of command/shift/7 (aka command &).

Now--I want to create an applescript that goes through all selected rows and executes the service. However, I am just unable to figure out how to tell OmniOutliner in Applescript how to move from one row to the next within the selection.

Something like:

tell front document of application "OmniOutliner Professional"
repeat for every object of selected rows
tell application "System Events" to keystroke "7" using {command down, shift down}
end repeat
end tell

I'm sure that won't work, however, as I'm not even sure that first 'repeat' command is valid. How would I do this?
 
Perhaps like sth like this ?

Code:
tell application id "OOut"
	activate
	tell front document
		set lstRows to selected rows
		repeat with oRow in lstRows
			select oRow
			tell application id "sevs" to keystroke "7" using {command down, shift down}
			delay 0.1
		end repeat
	end tell
end tell
 
This worked, with modifications. The reformat function does not work without the text in the row being selected, so I had to modify it to first enter edit mode for the row and then select all. You can't just select all when you have a row selected, because it selects all in outliner file--performing the 'E' command puts the cursor in the row for editing, and localizes the select all to the current row.

For some reason, I couldn't use keystroke 7 but could use key code 26 (key code for 7).

Code:
tell application id "OOut"
	activate
	tell front document
		set lstRows to selected rows
		repeat with oRow in lstRows
			select oRow
			tell application id "sevs" to keystroke "e"
			tell application id "sevs" to keystroke "a" using {command down}
			tell application id "sevs" to key code 26 using {command down, shift down}
			delay 0.1
		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
XML and AppleScript seanprice OmniFocus Extras 0 2013-03-14 02:07 PM
$$ for Applescript Help Hewdini OmniFocus Extras 1 2009-08-14 12:34 PM
Applescript Help ryan_marsh OmniFocus 1 for Mac 3 2008-11-24 09:51 AM
How to reformat Dot files Kbrock OmniGraffle General 3 2008-06-17 02:27 PM
Reformat visited links Gregory OmniWeb Feature Requests 4 2006-05-29 12:57 PM


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


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